Re: [Pharo-users] Playground auto-save?

2019-06-19 Thread Peter Uhnak
Hi Hilaire,

this is a known problem. I've been losing code to Playground for years.
(e.g. using undo (ctrl+z) is a good way to lose code)

What helps a lot is to look into pharo-local/play-cache directory (you can
open Spotter and type in "pharo-local" (without quotes)) which contains a
log of probably 90% of playgrounds you executed.

There are still some conditions under which you can lose code even with
play-cache (e.g. ctrl+z sometimes)... so good to keep that in mind.

Peter

On Wed, Jun 19, 2019 at 3:20 PM Hilaire  wrote:

> Beside that, auto-save is a nice feature, but it needs to be predictable.
>
> Hilaire
>
> Le 18/06/2019 à 21:53, Hilaire a écrit :
> > Hi,
> >
> > I have to admit it is working randomly in P7 with Dr.Geo. (19.06 rel)
> >
> > Sometime script can be retrieved with the playpage button other time no:
> > executed script can not be retrieved.
> >
> > Its behavior is not predictable and it is a problem for me and the kids
> > playing code.
> >
> > Hilaire
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>
>


Re: [Pharo-users] How to intercept every instance variable write on all objects

2019-02-02 Thread Peter Uhnak
Hi,

3) Metalinks - it's based on intercepting method calls, right? But I need
to intercept direct instance variable write, so probably not possible

no, you can attach metalink to any AST node, including an Assignment Node.
Some years ago I've made a small utility for this that also
auto-reinstalled when the method has changed.
Should work with P6, not sure about the current P7
https://github.com/peteruhnak/metalinks-toolkit .

But of course you can attach the MetaLink directly.

P


On Fri, Feb 1, 2019 at 12:43 AM Petr Fischer via Pharo-users <
pharo-users@lists.pharo.org> wrote:

> Hello,
>
> is possible to intercept (before writeú all instance variable writes on
> every existing objects?
>
> I found a discussion here:
>
> http://forum.world.st/Is-it-possible-to-follow-an-object-through-a-computation-td5092459.html
>
> Known solutions:
>
> 1) jugglery with object read only state + ModificationForbidden - not
> ideal, it's probably slow via exceptions and every nested on:do: stop
> change detection
>
> 2) it's possible to do it via slots - but it does not work on any existing
> object (only on my specially prepared objects with slots)
>
> 3) Metalinks - it's based on intercepting method calls, right? But I need
> to intercept direct instance variable write, so probably not possible
>
> Is there any way? Thanks! pf
>
>
>
>


Re: [Pharo-users] subpackages in P7

2018-11-27 Thread Peter Uhnak
The main benefit of using separate packages instead of tags is that you can
choose what to load.

That's why MyPackage-Test is best kept separate, because when other project
is loading your project, they don't need to load such package (which can
speed up dependency loading and makes for smaller images).

As changing it in either direction is usually simple, don't worry about not
using the "right" style.

Peter

On Tue, Nov 27, 2018 at 3:36 PM Esteban Lorenzano 
wrote:

>
>
> > On 27 Nov 2018, at 15:03, Roelof Wobben  wrote:
> >
> > Thanks,
> >
> > So better is leave it this way. So three seperate packages as I
> understand you well.
>
> I just said I would keep “tests” separated. The rest I do not have any
> opinion :)
>
> Esteban
>
> >
> > Roelof
> >
> >
> >
> >
> > Op 27-11-2018 om 10:47 schreef Esteban Lorenzano:
> >> Yes, you can :)
> >> (But I would recommend it doing it with tests)
> >>
> >> Usually, what you do is to create your package “Project” and then
> inside that package you can add the tags “test” and “Actions”,
> >>
> >> But now you already have three packages, and you want to move, for
> example “Project-Actions” into “Project”. To do this you need to select
> “Project-Action” and with right click select the option “extras” in your
> context menu. From there, you need to select “demote to package with tag”.
> This will move all Project-Action package into “Project” package, “Action”
> tag.
> >>
> >> Cheers,
> >> Esteban
> >>
> >>
> >>> On 27 Nov 2018, at 09:33, Roelof Wobben  wrote:
> >>>
> >>> Hello,
> >>>
> >>> Right now I have three seperate packages.
> >>>
> >>> Project
> >>> Project-test
> >>> Project-Actions
> >>>
> >>>
> >>> Is it possible in P7 to have something like this
> >>>
> >>> Project
> >>> ---   Tests
> >>>   Actions
> >>>
> >>> and if so, how to I make it work,
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
>
>
>


Re: [Pharo-users] Problems with NeoCSV Package

2018-11-27 Thread Peter Uhnak
Hi,

> Instance of ByteString doesn’t understand #atEnd.

This is a very typical error when you have accidentally passed a String
instead of a Stream.

... which you did here:
> stream := workingDir/myFileName readStreamDo: [ :stream | stream
contents].

You can either operate directly on the file stream, e.g.

file := 'D:\tmp\rules.csv' asFileReference.

result := file readStreamDo: [ :stream | |reader|
reader := NeoCSVReader new.
reader on: stream.
reader upToEnd.
].

Or if you already have a string, then ask it for its readStream

file := 'D:\tmp\rules.csv' asFileReference.

contents := file contents.
reader := NeoCSVReader new.
reader on: contents readStream.
reader upToEnd.



On Mon, Nov 26, 2018 at 11:27 PM William L. Cleveland 
wrote:

> I need to manually tag a large number of sentences choosing between a
> small, fixed number of short strings as tags for each sentence. I would
> like to do this with a Pharo GUI that displays sentences one at a time and
> permit choice of tags using radio buttons. The results need to be saved as
> a CSV file on the hard drive for further manipulations with python.
>
> As a first step, I used Excel to create a test CSV file with two sentences
> that was saved on the disk drive in the Pharo working directory.
>
> I have subsequently tried to import the sentences into Pharo 6.1 32 bit
> stable. This was done as follows.
>
> |workingDir reader result|
>
> workingDir := FileSystem disk workingDirectory.
>
> myFileName := 'MoonCSV.csv'.
>
> stream := workingDir/myFileName readStreamDo: [ :stream | stream
> contents].
>
>
>
> reader := (NeoCSVReader new) separator: Character cr.The separator
> was changed from a comma to a cr because the inspector showed a cr, not a
> comma separating the two imported sentences.
>
> result := (reader on: stream).
>
> result upToEnd.
>
>  This failed with the following error:
>
> Instance of ByteString doesn’t understand #atEnd.
>
>
> I don’t see how to proceed further. Also I am not clear on the best way to
> export the sentence and tags to the disk drive..
>
>
> Any help would be appreciated.
>
> Lou Cleveland
>


Re: [Pharo-users] Examples of bad code

2018-11-13 Thread Peter Uhnak
Not necessarily unreadable, but I always find the UIManager & co. very
confusing. There's a very recent discussion on part of it here
http://forum.world.st/Streams-and-FileDialog-in-Pharo-6-and-7-td5084352.html

And the combinations and variations of arguments is also a mess
https://gist.github.com/peteruhnak/8ac6667b8eb11daee71517d0172b7355 ...
question:title:, confirm:label:, edit:label: ... and the code is also a
mess with respect to default values.

If you want unreadable code, then look at SpecInterpreter which is
responsible for building all Spec ui... 139 lines of code and so far I've
probably spent an hour per every five lines of code trying to
comprehensively understand this...

Peter

On Mon, Nov 12, 2018 at 5:34 PM webwarrior  wrote:

> In old Pharo code (Morphic, etc.) there's a lot of wierd stuff.
>
> My favourite is DockingBarMorph>>#predominantDockingBarsOfChastes:
>
> Though it explains what "predominant" means in a long comment, it's
> absolutely unclear what the heck "chaste" is.
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] ToManyRelationSlot variant with an ordered collection?

2018-11-13 Thread Peter Uhnak
Maybe useful... some months ago I've reimplemented FAME's links (and added
support for ToOne, etc.) https://github.com/openponk/synchronized-links
I wanted to add supports for slots, but didn't get around to it yet... but
maybe it will be easier to adapt this than to rewrite everything from
scratch.

Peter

On Mon, Nov 12, 2018 at 9:31 AM Marcus Denker 
wrote:

>
>
> > On 10 Nov 2018, at 22:52, Tudor Girba  wrote:
> >
> > Hi,
> >
> > The current implementation of ToManyRelationSlot is based on a
> RelationSet which holds the items in a Set.
> >
> > Is there an implementation that holds the items in an ordered collection?
>
>
> Not that I know, but it would be interesting to experiment with this!
>
> Marcus
>


Re: [Pharo-users] what must be instead of the ??

2018-11-09 Thread Peter Uhnak
>
> but how do I find now the answer do I have to do something like   puzzle1
> stepChanges detectIndex ?


How do you mean? It would be the same

santaFloorOnBasement
"calculates which step take Santa to the basement"

stepChanges := input collect: [ :c |
floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]).
floor
].

stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input
yo' ].

then I see this error message :  Improper store to indexable object.


Because earlier you were comparing strings and not characters, I assumed
your input was an array of strings like #('(' '(' '('). but you can fix
that by changing `input collect:` -> `input asArray collect:` and `c = '('`
-> `c = $(`.

I have thought of something but I found it wierd that you do steps when you
> have already the answer.


That is indeed true, personally I would decide based on how often the
method is called and how large the input is. Because this cumulative change
makes it much easier to debug any issues... and usually I prefer
debuggability over performance (unless it is an actual bottleneck).

Peter


On Fri, Nov 9, 2018 at 6:38 PM Gabriel Cotelli  wrote:

> It's bug in the collect: implementation used in String. I've opened
> https://pharo.fogbugz.com/f/cases/22652/collect-over-Strings-is-broken
>
> On Fri, Nov 9, 2018 at 2:17 PM Roelof Wobben  wrote:
>
>> hmm.
>>
>> When I try this on P7
>>
>> |input stepChanges floor|
>> input := '((('.
>> floor := 0.
>> stepChanges := input collect: [ :c |
>> floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]).
>> floor
>> ].
>>
>> stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input
>> yo' ].
>>
>> then I see this error message :  Improper store to indexable object.
>>
>> Roelof
>>
>>
>> Op 9-11-2018 om 17:39 schreef Roelof Wobben:
>>
>> stepChanges := input collect: [ :c |
>> floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]).
>> floor
>> ].
>>
>> stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input
>> yo' ].
>>
>>
>>


Re: [Pharo-users] what must be instead of the ??

2018-11-09 Thread Peter Uhnak
On Fri, Nov 9, 2018 at 1:26 PM Roelof Wobben  wrote:

> Thanks all.
>
> This code seems to do the job
>
> santaFloorOnBasement
> "calculates which step take Santa to the basement"
>  | index|
>  index := 1.
>  [floor ~= -1 ] whileTrue:
> [ floor := ((input at: index) = '(' )
> ifTrue: [ floor + 1 ]
> ifFalse: [ floor - 1 ].
>  index := index + 1 ].
>
> ^ index -1
>


You can also think of it from the perspective of data processing and not
instruction coding (and mangling of indexes).

stepChanges := input collect: [ :c |
floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]).
floor
].

stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input yo'
].

Peter


Re: [Pharo-users] ring deprecation in pharo 7

2018-10-23 Thread Peter Uhnak
Hi Doru,

I imagine the replacement is Pavel's Ring2
https://github.com/pavel-krivanek/ring2

Peter

On Fri, Oct 19, 2018 at 10:56 PM Tudor Girba  wrote:

> Hi,
>
> Ring seems to be deprecated in Pharo 7. Is there something else it will be
> replaced with?
>
> In particular, I am looking for the correct class that should correspond
> to RGMethodDefinition.
>
> Cheers,
> Doru
>
>
> --
> www.feenk.com
>
> "Value is always contextual."
>
>
>
>
>
>
>


Re: [Pharo-users] RBParser bug ? (Morphic corruption)

2018-10-17 Thread Peter Uhnak
Yes, this is fixed in P7
https://pharo.fogbugz.com/f/cases/20212#BugEvent.193460

solution is to close your image and open again, or go to process browser
and kill the new UI loop that started.

As a workaround you can do parseExpression:onError: (or whatever the name
is)... or I've made a small wrapper which doesn't suffer from thsi
https://github.com/peteruhnak/pharo-changes-builder

Peter

On Wed, Oct 17, 2018 at 5:00 PM Dimitris Chloupis 
wrote:

> If I do something normal in the Playground like
> RBParser parseExpression: 'bac' and inspect it , it works fine
>
> If I do something like
> RBParser parseExpression: 'bac->'. Then it displays an error and things
> really get weird
>
> I get redraw problems with Morphic(if I start moving windows around), with
> windows leaving trailing images behind and Pharo slowing down.
>
> Can anyone reproduce my problem ?
>
> I can reproduce this behavior in 6.1 32 bit and 64 bit and with other
> incorrect syntax strings.
>


[Pharo-users] library to chain select:/collect:/ ... via cascade

2018-10-17 Thread Peter Uhnak
Hi,

is there some library that will allow me to chain select:/collect:/... via
cascade?

E.g.

#(12 7 'a' nil #(0)) query reject: #isNil; select: #isNumber; collect:
#squared; select: #even?

The point is to not have to write billion parentheses when building a more
complex query.

I imagine this would be pretty easy to write, but figured I ask first.

Thanks,
Peter


Re: [Pharo-users] TxText ?

2018-10-14 Thread Peter Uhnak
I think it is "going to be replaced" for several years now, so I wouldn't
worry about it too much.

Peter

On Sun, Oct 14, 2018 at 10:53 AM Hilaire  wrote:

> Hi,
>
> I read on some Rubric class comment, it will be replaced or merged with
> TxText.
>
> I heard about TxText on this list, but what is the status of TxText?
>
> Thanks
>
> Hilaire
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>
>


[Pharo-users] finding dependees of a package

2018-10-07 Thread Peter Uhnak
Hi,

I know I can "Browse Dependencies" of a particular package, but this only
shows me the dependencies of the selected package X.

What I am looking for is a list of packages that depend on X ... is that
possible?

Thanks,
Peter


[Pharo-users] Metacello load baselines/configurations only

2018-10-03 Thread Peter Uhnak
Hi,

is there a way to instruct Metacello to only install
BaselineOfs/ConfigurationOfs instead of the entire project? For the
purposes of analyzing dependencies.

Thanks,
Peter


Re: [Pharo-users] [ANN] Migrated Artefact to GitHub

2018-10-02 Thread Peter Uhnak
On Tue, Oct 2, 2018 at 4:55 PM Sean P. DeNigris 
wrote:

> Guillermo Polito wrote
> > when somebody migrates the repository.
>
> Who has access to the Pharo-contributions GH organization? Is that the
> "go-to" repository for this case? I'm not often clear about under which GH
> user/org something should be ported if one is not the owner. Do we have a
> policy? In this case, to get the ball rolling would it be possible to
> create
> under one's own user account and then transfer to ownership the appropriate
> entity?


If the project is actively maintained, then please ask the maintainer (e.g.
I'm waiting for monty to respond to my offer to migrate XMLParser).

Migrating it under your own account is sending signal to the community "I
am going to take care and MAINTAIN this project.".
Unless that is your intention, then pharo-contribs seems like the best
choice. Unlike the old approach it is easy for anyone to contribute with
pull requests without having to wait for access rights or whatnot.

Peter


Re: [Pharo-users] TextEditor

2018-09-21 Thread Peter Uhnak
Hi,

depending on your use-case you might also consider Spec or Playground
http://forum.world.st/Using-Playgrounds-as-a-notepad-tp4869129p4869227.html

Peter

On Fri, Sep 21, 2018 at 5:06 PM Hilaire  wrote:

> Hello Hernán,
>
> Thanks to point Rubric which I did not know until now. Any doc/pointer
> about this new boy in town?
>
> What is the differences with the TextEditor?
>
> Can the text contains arbitrary Morph?
>
> I am exploring the idea of an infinite roll with text, code and morph.
>
> Hilaire
>
>
> Le 21/09/2018 à 00:19, Hernán Morales Durand a écrit :
> > StandardWindow new
> >  addMorph: (
> >   RubScrolledTextMorph new
> >withLineNumbers;
> >appendText: '/path/to/file' asFileReference contents)
> >  fullFrame: (0@0 corner: 1@1) asLayoutFrame;
> >  openInWorld.
> >
> > Cheers,
> >
> > Hernán
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>
>


Re: [Pharo-users] overriding FileReference>>copyTo: behavior

2018-09-17 Thread Peter Uhnak
Ideally something that works as updater only (doesn't touch nor change
modification time if the contents is the same)

On Mon, Sep 17, 2018 at 1:16 PM Peter Uhnak  wrote:

> Hi,
>
> is there an API to copy a file that will override the target destination
> if it already exists? I was quite surprised that #copyTo: (and #copyAllTo:)
> will throw up when the target file already exists.
>
> Do I need to explicitly remove the file before copying / copy the contents
> instead?
>
> Thanks,
> Peter
>


[Pharo-users] overriding FileReference>>copyTo: behavior

2018-09-17 Thread Peter Uhnak
Hi,

is there an API to copy a file that will override the target destination if
it already exists? I was quite surprised that #copyTo: (and #copyAllTo:)
will throw up when the target file already exists.

Do I need to explicitly remove the file before copying / copy the contents
instead?

Thanks,
Peter


Re: [Pharo-users] is class-side name setter used by the system

2018-09-17 Thread Peter Uhnak
My uni is starting a Pharo course soon and we were thinking about making a
custom Pharo 6 image with name: blocked, just to avoid trouble, but I was
just checking here whether it can breaking something unexpected.

Thanks,
Peter

On Mon, Sep 17, 2018 at 10:18 AM teso...@gmail.com 
wrote:

> Hi Peter,
>there is no more #name: in Class (or ClassDescription or Behavior). It
> is named #setName:
> It is only used by the class builder, some class methods and some tests.
> It could be hidden better if it is still a problem.
>
> Cheers.
>
>
> On Mon, Sep 17, 2018 at 9:57 AM Peter Uhnak  wrote:
>
>> Hi,
>>
>> is the class-side "name:" setter used by the system itself?
>> Because I remember many times overriding it for my own needs and it never
>> broke anything as far as I know... which makes it strange why it even
>> exists (because it is a trap).
>>
>> Thanks,
>> Peter
>>
>
>
> --
> Pablo Tesone.
> teso...@gmail.com
>


[Pharo-users] is class-side name setter used by the system

2018-09-17 Thread Peter Uhnak
Hi,

is the class-side "name:" setter used by the system itself?
Because I remember many times overriding it for my own needs and it never
broke anything as far as I know... which makes it strange why it even
exists (because it is a trap).

Thanks,
Peter


Re: [Pharo-users] To get started with Gtoolkit and bloc

2018-09-13 Thread Peter Uhnak
Hi,

you can start with the Bloc booklet
http://files.pharo.org/books-pdfs/booklet-Bloc/BLOCDRAFT.pdf ... it is
probably a bit outdated, but I think the API hasn't changed that much.
and then in the image itself there is a "Bloc-Examples" package that
contains hundreds (thousands?) of examples.

Peter

On Thu, Sep 13, 2018 at 2:58 PM Hilaire  wrote:

> Hi,
>
> Is there any document to get start with bloc and gtoolkit?
>
> Thanks
>
> Hilaire
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>
>


Re: [Pharo-users] Ready to use Roassal?

2018-09-09 Thread Peter Uhnak
Not sure if this is already fixed in P7, but in P6 sometimes the catalog
would not load properly... so one has to close pharo and open it again...
probably not the best experience for non-pharo user.

Also, if your user is using linux, they also need to have libcairo(i386)
installed, otherwise Roassal will not work.

Peter

On Sun, Sep 9, 2018 at 2:16 PM Hilaire  wrote:

> Hello Alexandre,
>
> Afterward, I have indicated that to this non-pharo user.
>
>
> Le 09/09/2018 à 11:36, Alexandre Bergel via Pharo-users a écrit :
> > The agilevisualization.com website says:
> >
> > "Installing Roassal is easy. You need to install Pharo. Open the Catalog
> browser, and select Roassal. A video illustrating these steps is online.”
> >
> > How can I improve the installation instruction?
> >
> > Also, the Quickstart chapter details the steps:
> >
> http://agilevisualization.com/AgileVisualization/QuickStart/0101-QuickStart.html
> I was confused as I did not find this zip file ready to download, as
> described in this quick start page.
>
> Hilaire
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>
>


Re: [Pharo-users] memorizing data between tests

2018-09-09 Thread Peter Uhnak
Hi Ben,

take a look at TestResource (its comment and subclasses). It should do what
you are looking for.

Peter

On Sun, Sep 9, 2018 at 8:08 AM Ben Coman  wrote:

> Say I want to write ten tests for different aspects of a web service point.
> Apart from the risk of relying on an external service,
> I'd like to poll the web service once rather than ten times.
> I wondering about the feasibility of memorizing data between test methods.
> Taking for example...
>  TestCase subclass: #MyTest ...
>
> My understanding is that MyTest >> setUp is run once per test method.
> What I guess is missing is a #groupSetup that would be called at the start
> of a running a group of tests.
>
> MyTest >> groupSetup
> memorized := Dictionary new.
>
> MyTest >> getLiveDataOncePerRun
> ^ memorized at: 'data' ifAbsentPut: [ZnClient new get: '
> http://someservice.com/liveData1'.
>
> MyTest >> test1
> |data|
> data  := self  getLiveDataOncePerRun  .
> self assert: data result1 equals: 'expected result 1'
>
> MyTest >> test2
> |data|
> data  := self  getLiveDataOncePerRun.
> self assert: data result2 equals: 'expected result 2'
>
> cheers -ben
>
>


Re: [Pharo-users] Configuring iceberg on Windows

2018-09-06 Thread Peter Uhnak
>  I need to get past that error since I get it even when I install Moose
via Metacello.

Note that Moose depends on projects that are on github, so if it is
misconfigured, then it will fail.
Maybe you can provide both the ssh key and regular key/password? I use both
and so far I had no problems on neither Windows nor Linux.

Peter

On Thu, Sep 6, 2018 at 6:28 PM Ben Coman  wrote:

> On Thu, 6 Sep 2018 at 21:58, Andrei Stebakov  wrote:
>
>> I followed the tutorial
>>
>
> Hi Andrei,  Could you be specific about which tutorial that was.  I'm not
> sure if I'm just getting by on old knowledge
> or the much improved Iceberg UI and its good to refresh myself with such
> tutorials.
>
>
>
>> and provided IceCredentialProvider with ssh settings, also put the same
>> settings in Settings-Tools-Software Configuration Management.
>> It seems not to have any effect since when I try to create a repo using
>> SSH it gives the error "Failed to connect to github.com".
>> I need to get past that error since I get it even when I install Moose
>> via Metacello.
>> Do I need to add ssh-agent as well? If yes, why do we need to provide
>> public/private key paths with IceCredentialProvider?
>>
>
> In the past I had github+ssh working on Windows with "Use custom SSH keys"
> enabled"
> but then a while ago it stopped for "no apparent reason"(TM).
> Co-incidentally a few hours ago I solved my problem.
>
> I went back to basics checking from command line per...
> https://help.github.com/articles/testing-your-ssh-connection/
> and found  ```ssh -T g...@github.com``` erroring with...
> "@@@
> @ WARNING: UNPROTECTED PRIVATE KEY FILE!  @
> @@@
> Permissions for 'C:\\Users\\Ben/.ssh/id_rsa' are too open.
> It is required that your private key files are NOT accessible by others.
> This private key will be ignored.
> Load key "C:\\Users\\Ben/.ssh/id_rsa": bad permissions
> g...@github.com: Permission denied (publickey).
>
> I right-clicked on my folder C:\Users\ben\.ssh
> then Properties > Security > Advanced > Disable Inheritance
> then removed SYSTEM, Administrator & Administrators leaving only BEN.
>
> Then this worked...
> C:>ssh -T g...@github.com
> Hi bencoman! You've successfully authenticated, but GitHub does not
> provide shell access.
>
> And now also worked from within Pharo (with "Use custom SSH keys" enabled")
>
> HTH, cheers -ben
>


[Pharo-users] MetaLink after on a message with argument

2018-09-04 Thread Peter Uhnak
Hi,

I'm trying to install an #after metalink to a MessageNode that has an
argument, however it fails because the bytecode is missing the argument (I
think).
Note that #before control worked fine, so I am not sure whether this is a
bug, not yet supported, or am I doing something wrong.

code (tested in P6.1):

~
Something compile: 'add: aNumber
^ 1 + aNumber'.

after := MetaLink new
metaObject: [ self logCr: 'after' ];
selector: #value;
control: #after.
"
after uninstall.
"

ast := (Something>>#add:) ast.
node := ast sendNodes first.
node link: after.

Something new add: 3.
~~~

error:

[image: image.png]

Thanks!

Peter


Re: [Pharo-users] separate native window of same Pharo image

2018-08-16 Thread Peter Uhnak
>  I believe this is a known Windows issue.

Well this is more of a show-stopper than just an issue.

Is the project maintained? Is Windows support something that is planned?

Thanks,
Peter

On Thu, Jul 19, 2018 at 7:35 PM kmo  wrote:

> I believe this is a known Windows issue. I have certainly seen it on my
> Windows machine at work. Doesn't happen on Linux.
>
>
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] XML Writer not pretty printing

2018-08-16 Thread Peter Uhnak
Thanks! #removeAllFormattingNodes did the trick.

Perhaps #prettyPrinted / #enablePrettyPrinting should call it by default?

WIth regards,
Peter

On Tue, Aug 14, 2018 at 10:27 PM Carlo  wrote:

> Hi Peter
>
> It seems that #preservesIgnorableWhitespace: is only adhered to "...When
> validation is enabled and a DTD with element declarations is present..."
> (See comment in SAX2ContentHandler>>ignorableWhitespace:) The actual
> parsing code is in SAXParserDriver>>handleWhitespace:
>
> What you could do is use #removeAllFormattingNodes but
> your-mileage-may-vary...
>
> parser := XMLDOMParser
> on:'
> 
>   
> 
> '.
>
> (parser parseDocument)
> removeAllFormattingNodes;
>     prettyPrinted.
>
> Regards
> Carlo
>
> On 14 Aug 2018, at 13:08, Peter Uhnak  wrote:
>
> Hi,
>
> I am trying to output a pretty printed document, but it seems that the
> configuration is being ignored
>
> doc := '
> 
>   
> 
> ' parseXML.
>
> String << [ :stream |
> doc
> printOn: stream
> beforeWritingDo: [ :writer |
> writer
> enablePrettyPrinting;
> enablePlatformSpecificLineBreak.
> writer formatter indentString: '  '. ] ]
>
>
> produces
>
>  "'
> 
>   
> 
> '"
>
> I thought that maybe #preservesIgnorableWhitespace: has something to do
> with it, but whether it is true or false, the output is not pretty printed
> (not to mention, that pretty printing should ignore any preserved
> whitespaces anyway).
>
> Is this a bug? Should I print it in a different way?
>
> Thanks,
> Peter
>
>
>


[Pharo-users] XML Writer not pretty printing

2018-08-14 Thread Peter Uhnak
Hi,

I am trying to output a pretty printed document, but it seems that the
configuration is being ignored

doc := '

  

' parseXML.

String << [ :stream |
doc
printOn: stream
beforeWritingDo: [ :writer |
writer
enablePrettyPrinting;
enablePlatformSpecificLineBreak.
writer formatter indentString: '  '. ] ]


produces

 "'

  

'"

I thought that maybe #preservesIgnorableWhitespace: has something to do
with it, but whether it is true or false, the output is not pretty printed
(not to mention, that pretty printing should ignore any preserved
whitespaces anyway).

Is this a bug? Should I print it in a different way?

Thanks,
Peter


Re: [Pharo-users] Spec "bindings"

2017-09-09 Thread Peter Uhnak
Hi Rob,

I'm making a note to look at your proposals and I will discuss it with Stef 
later.

> 
> he has more and younger braincells than me

But not enough connections between them. The cells just sit there alone and are 
not talking to anyone. :(

Peter



Re: [Pharo-users] YAML parser (2017)

2017-08-19 Thread Peter Uhnak
On Sat, Aug 19, 2017 at 02:45:28PM +0200, H. Hirzel wrote:
> Peter, thanks for the confirmation that in your installation of the
> PetitYAML grammar all tests are green.
> 
> I wonder how you did it.

As I've said, you need to update PetitParser; if there's no appropriate catalog 
entry, then ConfigurationOfPetitParser loadBleeding edge, or manually via 
Monticello Browser (the same way you loaded PetitYAML).

Peter

> 
> This is what I did:
> 
> 1. I put Pillar on the back burner for the moment and
> 
> 2. I went for a pristine Pharo 6.0 Latest update: #60510 image (a.k.a. 6.1).
> 
> 3. Then I installed PetitParser only through the catalog --
> the entry is still tagged for Pharo 5.0
> 
> 4. Then I added PetitYAML
> 
> Name: PetitYAML-PhilippeBack.11
> Author: PhilippeBack
> Time: 29 May 2017, 12:53:55.994195 pm
> UUID: d7658233-112c-754c-81a7-d60139bb9549
> 
> taken from
> 
> MCSmalltalkhubRepository
>   owner: 'Moose'
>   project: 'PetitParser'
>   user: ''
>   password: ''
> 
> 
> 5. Running the tests gave me
> 
> 76 run -- 76 errors
> 
> 
> What am I missing here?
> 
> Is there an easy workaround to get PetitParser with PetitYAML into
> 6.0-#60510 (a.k.a. 6.1) ?
> 
> --Hannes



Re: [Pharo-users] YAML parser (2017)

2017-08-19 Thread Peter Uhnak
All my tests are green, so maybe you need to update PetitParser too to the 
latest (PetitParser-JanKurs.290)

It is probable that Pillar loaded older version of PetitParser.

Peter


On Fri, Aug 18, 2017 at 10:56:30PM +0200, H. Hirzel wrote:
> Hello again
> 
> On 8/18/17, Peter Uhnak <i.uh...@gmail.com> wrote:
> [...]
> >> I assume that can directly load the PetitYAML from the repository
> >> instead.
> >> Where do I find it?
> >
> > Open Monticello Browser, find PetitParser repository and open it, select
> > PetitYAML package, select the latest version, right click and load.
> >
> > Peter
> >
> Thank you for the instructions.
> Loading PetitYAML-PhilippeBack.11.mcz went fine.
> 
> But out of 76 tests I get 57 errors. This are so many error that that
> it is quite possible that they have a single cause. I did not start
> debugging.
> 
> Something similar happens if I go back to
> PetitYAML-JanKurs.8
> Author: JanKurs
> Time: 15 June 2016
> 
> What I aiming at is
> 
> - to have Pillar loaded (was successful, see other thread)
> - get a working PetitYAML version
> 
> --Hannes
> 
> P.S. Note that the screen shot shows a Pharo 6.0 version. But it
> actually is 6.1 (see other thread).





Re: [Pharo-users] Installation done last week: Do I have Pharo 6.0 or Pharo 6.1?

2017-08-18 Thread Peter Uhnak
On Fri, Aug 18, 2017 at 07:16:30PM +0200, H. Hirzel wrote:
> Thank you, Bernhard and Markus for confirming that Pharo is not
> reporting the correct version number.
> 
> But do you think I probably got 6.1 when I installed it  on the 9th August 
> with
> 
>  curl get.pharo.org | bash

Yes, you will get the latest version which is 60510, which is 6.1.

You can download previous versions here http://files.pharo.org/image/60/

Peter



Re: [Pharo-users] YAML parser (2017)

2017-08-18 Thread Peter Uhnak
On Fri, Aug 18, 2017 at 09:50:35PM +0200, H. Hirzel wrote:
> Hello Peter
> 
> Thank you for the answer. Good news that Phil Back has an done
> upgraded version of the PetitYAML parser recently.
> 
> I think what you describe as "mostly complete" will be very fine for
> my purposes.
> 
> On 8/18/17, Peter Uhnak <i.uh...@gmail.com> wrote:
> > Hi,
> >
> > Phil Back has kindly fixed the PetitYAML so it mostly works now.
> > The only problem I've encountered was some weird misparsing of strings
> > containing slashes, e.g. "5/".
> >
> > In any case:
> >
> > Install PetitParser (from Catalog or somewhere), load PetitYAML package
> > (this is already loaded when loading PP from catalog).
> 
> I just installed Pillar and that pulled in PetitParser. Not sure if it
> is a good idea now to re-install PetitParser again.
> 
> In particular there is only PetitParser catalog entry for Pharo 5.0,
> not 6.0 or 6.1

I don't know about this, you'd have to ask the Moose team (or whoever is 
responsible for PetitParser now)

> 
> I assume that can directly load the PetitYAML from the repository instead.
> Where do I find it?

Open Monticello Browser, find PetitParser repository and open it, select 
PetitYAML package, select the latest version, right click and load.

Peter



Re: [Pharo-users] Installation done last week: Do I have Pharo 6.0 or Pharo 6.1?

2017-08-18 Thread Peter Uhnak
I don't know what was the exact reasoning why it was chosen to stay this way...
60505 is still 6.0, so somewhere between 60506 and 60510 is the split. :-)

Peter


On Fri, Aug 18, 2017 at 04:21:24PM +0200, H. Hirzel wrote:
> Hello
> 
> Pharo 6.1 was released on the 24th July 2017.
> Thread [Pharo-dev] [ANN] Pharo 6.1 (summer) released! (35 messages so far).
> My question short: Which version do I get when installing?
> 
> Last week I on the the 9th August I did
> 
>curl get.pharo.org | bash
> 
> on Ubuntu 14.04-32bit. Installation was done fully automated. Very
> smooth! Excellent!
> 
> Just needed to do in a terminal window
> ./pharo-ui
> to start Pharo 6.x
> 
> Now my question:
> 
> 'Word menu'  -> 'System' -> 'About'
> 
> gives me
> 
> Pharo 6.0
> Latest update: #60510
> 
> 
> Is the indication 'Pharo 6.0' just an omission in the release process
> and it should say 'Pharo 6.1'?
> Or did I still get 'Pharo 6.0' for some reason?
> 
> Thank you for the answer in advance
> 
> Hannes
> 



Re: [Pharo-users] YAML parser (2017)

2017-08-18 Thread Peter Uhnak
Hi,

Phil Back has kindly fixed the PetitYAML so it mostly works now.
The only problem I've encountered was some weird misparsing of strings 
containing slashes, e.g. "5/".

In any case:

Install PetitParser (from Catalog or somewhere), load PetitYAML package (this 
is already loaded when loading PP from catalog).

And then parse your string

```
PPYAMLGrammar parse: '
language: c
sudo: false
cache:
  directories:
- opensmalltalk-vm/.thirdparty-cache
git:
  depth: "5"'.
```


"Dictionary(
'cache'->a Dictionary(
'directories'->#('opensmalltalk-vm/.thirdparty-cache')
)
'git'->a Dictionary(
'depth'->'5'
)
'language'->'c'
'sudo'->'false'
)"


Take a look at PPYAMLGrammarTest>>testTravisYml too.

Peter



On Fri, Aug 18, 2017 at 09:45:00AM +0200, H. Hirzel wrote:
> I am not looking for a complete implementation which is quite an effort
> 
> but rather for a subset which does simple things such as parsing
> - a list of hashes (dictionaries),
> - a dictionary of dictionaries (nested to arbitrary depths),
> - multi-line comments
> 
> 
> --Hannes
> 
> On 8/16/17, H. Hirzel <hannes.hir...@gmail.com> wrote:
> > Are there any news about a YAML parser for Pharo 5 / 6.1?
> >
> > --Hannes
> >
> > On 5/29/17, Peter Uhnak <i.uh...@gmail.com> wrote:
> >> Hi,
> >>
> >> do we have a working parser for YAML?
> >>
> >> There's PPYAMLGrammar (in PetitParser), however it doesn't seem to work
> >> in
> >> Pharo 6 at all (not even tests pass).
> >> In Pharo 5 the tests are green, but using it on YAML content still
> >> fails...
> >> with small fix I managed it to "pass", however the output seems to be a
> >> very
> >> fine-grained AST decomposition and not the expected output
> >> (dictionaries/arrays).
> >>
> >> So do we have some else/working?
> >>
> >> YAML specs have BNF descriptions, so maybe SmaCC can generate it? (I
> >> don't
> >> know SmaCC, so maybe this is not how it works.)
> >>
> >> Thanks,
> >> Peter
> >>
> >>
> >
> 



Re: [Pharo-users] Preference to for not showing hidden files in the FileBrowser?

2017-08-17 Thread Peter Uhnak
There's no such option.

I've created File Dialog ( https://github.com/peteruhnak/file-dialog ) which 
will be in P7 when I find the time to go through the incorporation process... 
which practically means September...

Peter


On Thu, Aug 17, 2017 at 01:05:25PM +0200, Guillermo Polito wrote:
> On Wed, Aug 16, 2017 at 1:26 PM, H. Hirzel  wrote:
> 
> > Hello
> >
> > Is there a preference for not showing hidden files in the FileBrowser?
> >
> 
> I don't think such preference exists, sorry... Maybe implementing it would
> not be so hard?
> 
> 
> > I checked menu 'System' -> 'Settings' searching for 'hidden'.
> > This is on Ubuntu, i.e. hidden files start with a dot.
> >
> > Thank you for the answer in advance
> >
> > Hannes
> >
> >
> 
> 
> -- 
> 
> 
> 
> Guille Polito
> 
> 
> Research Engineer
> 
> French National Center for Scientific Research - *http://www.cnrs.fr*
> 
> 
> 
> 
> *Web:* *http://guillep.github.io* 
> 
> *Phone: *+33 06 52 70 66 13



Re: [Pharo-users] including Pillar in Pharo image by default

2017-08-11 Thread Peter Uhnak
A long time issue with Markdown was that there was no standardization (and when 
I used Pillar's MD export ~2 years ago it didn't work well).

However CommonMark ( http://spec.commonmark.org/0.28/ ) has become the de-facto 
standard, so it would make sense to support it bidirectionally with Pillar.

> The readme.md that Peter is talking about is gfm markdown

Well, technically it is just a CommonMark, as I am not using any github 
extensions.
(Github uses CommonMarks and adds just couple small extensions.)

Peter



Re: [Pharo-users] including Pillar in Pharo image by default

2017-08-11 Thread Peter Uhnak
On Fri, Aug 11, 2017 at 09:14:01PM +0200, Esteban Lorenzano wrote:
> 
> > On 11 Aug 2017, at 21:10, Esteban Lorenzano  wrote:
> > 
> > hi, 
> > 
> >> On 11 Aug 2017, at 18:57, Cyril Ferlicot D.  >> > wrote:
> >> 
> >> Another step would be to get a minimal parser not relying on
> >> PetitParser. 
> > 
> > Let’s think differently: why not to include a tiny PetitParser? 
> > Then we can think on:
> > 
> > - pillar sintax (better than just a restricted version)
> *syntax*… sorry for spanish intromission ;)
> 
> btw… not just outside the image (as readme).

Yes, one of the points I want is to have the readme available in Pharo's Help 
Browser with rich content.

Peter



Re: [Pharo-users] including Pillar in Pharo image by default

2017-08-11 Thread Peter Uhnak
What I meant is that I have a readme, e.g. https://github.com/OpenPonk/xmi , 
which contains

* Pharo code examples
* images
* References to Pharo code (class names, etc.)

But if the code changes (renames, API changes, different UI), I have to 
manually update the README.
There is also no way for me to validate the examples, etc and see if anything 
is broken.

Peter

On Fri, Aug 11, 2017 at 06:58:50PM +0200, Stephane Ducasse wrote:
> Let us rephrase it:
> 
> - I would like to have a mini pillar with a simplified model and visitor
> to display class comments.
> 
> - then think about Pharo 70 as the core and birth of a new generation of 
> imageS
> 
> I will restart to revisit Pillar once I'm done with the Lecture at Prague.
> 
> Stef
> 
> On Fri, Aug 11, 2017 at 6:52 PM, Peter Uhnak <i.uh...@gmail.com> wrote:
> > Hi,
> >
> > I would like to propose including Pillar in the Pharo image by default.
> >
> > My reasoning:
> >
> > Since we are moving to git, and most people will use github, gitlab, and 
> > the likes, it is expected to include a README.md file (or possibly more 
> > extensive documentation) alongside the code.
> >
> > Which means that people will (and are) writing the README mostly by hand, 
> > which of course is problematic, as e.g. code snippets can get deprecated, 
> > screenshots become outdated, etc.
> >
> > As Pillar tries to address these problems, it would make sense to me to 
> > include Pillar in the image by default, as anyone using git (which 
> > eventually should be everyone) will most likely benefit from writing their 
> > documentation in Pillar.
> > Similarly using Pillar would open an avenue to provide the documentation 
> > in-image, e.g. one exporter for html/markdown, and another one for Pharo's 
> > Help system.
> >
> > I could, of course, install Pillar every time, but considering thats extra 
> > effort and in the extra time I can fix the issues by hand, I don't have 
> > such an incentive to use Pillar for this.
> >
> > Questions & Problems:
> >
> > I don't know by how much would pillar increase the image size. Perhaps 
> > there could be (a) "lightweight Pillar" (that would include just pillar & 
> > markdown exporter), or (b) we would have different images for different 
> > uses.
> >
> > By different images I mean something along the lines of
> > a) developer image - meant to be directly used by developers to create 
> > their software
> > b) production image - as a foundation for running systems / users
> >
> > Does this make sense?
> >
> > Peter
> >
> 



[Pharo-users] including Pillar in Pharo image by default

2017-08-11 Thread Peter Uhnak
Hi,

I would like to propose including Pillar in the Pharo image by default.

My reasoning:

Since we are moving to git, and most people will use github, gitlab, and the 
likes, it is expected to include a README.md file (or possibly more extensive 
documentation) alongside the code.

Which means that people will (and are) writing the README mostly by hand, which 
of course is problematic, as e.g. code snippets can get deprecated, screenshots 
become outdated, etc.

As Pillar tries to address these problems, it would make sense to me to include 
Pillar in the image by default, as anyone using git (which eventually should be 
everyone) will most likely benefit from writing their documentation in Pillar.
Similarly using Pillar would open an avenue to provide the documentation 
in-image, e.g. one exporter for html/markdown, and another one for Pharo's Help 
system.

I could, of course, install Pillar every time, but considering thats extra 
effort and in the extra time I can fix the issues by hand, I don't have such an 
incentive to use Pillar for this.

Questions & Problems:

I don't know by how much would pillar increase the image size. Perhaps there 
could be (a) "lightweight Pillar" (that would include just pillar & markdown 
exporter), or (b) we would have different images for different uses.

By different images I mean something along the lines of
a) developer image - meant to be directly used by developers to create their 
software
b) production image - as a foundation for running systems / users

Does this make sense?

Peter



[Pharo-users] Playground doesn't respect LF endings

2017-08-07 Thread Peter Uhnak
Hi,

when I paste a text into the playground with line endings containing just LF 
(unix-style), then navigation to beginning/end of a line instead jumps to the 
beginning/end of the text. (I guess it is hardcoded to CR only).

Right now I have to execute `Clipboard clipboardText withSqueakLineEndings 
asString` and then copy the result.

Peter



[Pharo-users] sharing context/variables between multiple playgrounds

2017-08-07 Thread Peter Uhnak
Hi,

is there a way to share context/variables between multiple playgrounds?

E.g. in Playground window 1 I declare

```
factor := 70.
```

and in Playground window 2 I do (without declaring `factor`)

```
5 * factor. "-> 350"
```


Thanks,
Peter



Re: [Pharo-users] Lazy-initialization patterns

2017-08-05 Thread Peter Uhnak
Personally I prever to avoid long lazy initializations, so I have it nice and 
tidy in a single method.

MyClass>>#property
^ property ifNil: [ property := self bar collect: #food ]

If I want to initialize the value in a separate method (typically for testing 
or reuse), then I prefer to avoid state mutation there and instead I return the 
result.

MyClass>>#property
^ property ifNil: [ property := self createNewProperty ]

MyClass>>createNewProperty
"I won't touch property instance variable here, just create a new value 
and return it"
^ self bar collect: [ :e | e drink ]


> an initializationMethod returning the value instead of the receiver is a code 
> smell to me.

For this reason I tend to name such methods createNewX, initializeX says to me 
"only mutate state and return self"

Peter



Re: [Pharo-users] Compiling lots of method source without debugger

2017-08-04 Thread Peter Uhnak
Hi,

> This is my first time here so I hope this is the right place to ask
> questions.

It is. :)

> I want to be able to compile these methods programatically without
> interruptions (using method source strings only) and gather all compiler
> errors that occur. What would be the best way to go about this?

It is certainly a way.

Compilation errors will raise SyntaxErrorNotifications that you can capture, 
e.g.

sthClass := Object subclass: #Something.
[ sthClass compile: '^^' classified: 'protocol-name' ]
on: SyntaxErrorNotification
do: [ :err | err inspect ]

> Also: How do I control in which package a compiled method ends up if the
> target class is in a different package (Method extension)?

Methods are stored in protocols (accessing, initialization, as yet 
unclassified).
If you however start the name with an asterisk *, then the method will become 
an extension method and will be stored in the package name following the 
asterisk.


e.g.

sthClass := Object subclass: #Something.
sthClass compile: 'methodName self lives somewhere else' classified: 
'*SomewhereElse'.

> 
> Any help would be greatly appreciated!

I would (shameless self-promotion) also recommend looking at this 
https://github.com/peteruhnak/pharo-changes-builder , so you could review the 
changes before actually compiling them.

Peter



Re: [Pharo-users] step-by-step trace of object creation and messaging?

2017-08-01 Thread Peter Uhnak
Hi David,

> I am new to Pharo

As in you've never seen Pharo before, or that you have only limited knowledge?

All the examples are just methods in the system. E.g. the simple example is 
defined in class-side of BormExampleDiagrams in method #exampleDataFlows.

So you could run it from playground as "BormExampleDiagrams exampleDataFlows."

To open a debugger on any code, you can select it and press ctrl+shift+d, or 
right-click and select "Debug it".

I haven't really looked at BORM in quite a while as I am busy with different 
projects, so there are some issue related to the latest Pharo (#name 
deprecation, which you can disable with `Deprecation raiseWarning: false`) and 
Roassal (dark theme messed up the colors).

If you have questions regarding OpenPonk, you can also contact me privately.


Peter

On Tue, Aug 01, 2017 at 01:39:18PM +, David Epstein wrote:
> Hello,
> 
> 
> I am new to Pharo and would like to better understand how 
> openponk.github.io works by stepping through the 
> creation of objects and seeing the messages they send. I don't see a way to 
> call the debugger without highlighting some problematic code. No code is 
> problematic (that I know of). Ideally, I'd like to see what is happening when 
> I start one of OpenPonk's examples, such as "BORM Simple Diagram". What tool 
> or browser can I use to do this?
> 
> 
> -david



Re: [Pharo-users] How to export critics from Critic Browser?

2017-07-31 Thread Peter Uhnak
Hi,

I did a small experiment on Travis short while ago that collects the QAs and 
prints them to output log.

Script (you would be interested only in the Smalltalk part of the code): 
https://github.com/peteruhnak/ugly-pharo-code/blob/master/qa-testing.sh

Travis output (expand line 400): 
https://travis-ci.org/peteruhnak/ugly-pharo-code#L400

Peter

On Mon, Jul 31, 2017 at 01:38:31AM -0300, Hernán Morales Durand wrote:
> Hi,
> 
> I'm using Pharo 6.1 and I want to export a report of Critics Browser results.
> Is there a way to save the results?
> 
> It would be nice to have a CSV, to record historical analysis of my
> progress, then plot using Roassal, etc.
> 
> Cheers,
> 
> Hernán
> 



Re: [Pharo-users] Iceberg and removing packages

2017-07-30 Thread Peter Uhnak
This was supposedly fixed in April 
https://github.com/pharo-vcs/iceberg/issues/317

however I had the same issue ~two months ago, so I had to delete the packages 
by hand.

P


On Sun, Jul 30, 2017 at 11:04:20AM -0300, Esteban A. Maringolo wrote:
> Hi,
> 
> I'm playing around with Iceberg in Pharo 6, and even when I find the
> workflow streamlined, but since it doesn't map 1:1 with git workflow
> from other IDEs or command line, I find myself not knowing how to do
> certain tasks.
> 
> One thing that happened is that I published a few packages to one of
> my repos in Github, then I decided to remove one of the packages from
> the repo, then I synchronized it but in the repo there is still is the
> package folder for the package I removed.
> 
> What should I do to definitely remove those files from the commit?
> 
> Regards!
> 
> Esteban A. Maringolo
> 



Re: [Pharo-users] NeoCSV change proposal

2017-07-23 Thread Peter Uhnak
Thank you Sven!

Peter

On Sun, Jul 23, 2017 at 01:59:41PM +0200, Sven Van Caekenberghe wrote:
> 
> > On 23 Jul 2017, at 09:55, Peter Uhnak <i.uh...@gmail.com> wrote:
> > 
> > Ah, ByteArrayMap, I was trying ByteArray.
> 
> ByteArrayMap is not a class, it is still a ByteArray, but of size 256 used as 
> an inclusion map for characters that fit a byte.
> 
> BTW, using CharacterSet as an abstraction makes the trick easier.
> 
> I committed:
> 
> ===
> Name: Neo-CSV-Core-SvenVanCaekenberghe.26
> Author: SvenVanCaekenberghe
> Time: 23 July 2017, 1:54:22.095185 pm
> UUID: e429f87e-5c11-0d00-a72d-ae5d00db2a8c
> Ancestors: Neo-CSV-Core-PeterUhnak.25
> 
> make the core test in #writeOptionalQuotedField faster by using a primitive 
> when possible
> 
> add #testWideOptionalQuoted
> ===
> Name: Neo-CSV-Tests-SvenVanCaekenberghe.22
> Author: SvenVanCaekenberghe
> Time: 23 July 2017, 1:54:52.133003 pm
> UUID: 5f81c280-5c11-0d00-a72e-7cd500db2a8c
> Ancestors: Neo-CSV-Tests-PeterUhnak.21
> 
> make the core test in #writeOptionalQuotedField faster by using a primitive 
> when possible
> 
> add #testWideOptionalQuoted
> ===
> 
> Extra caution was needed for WideStrings.
> 
> Sven
> 
> > Not sure what the next step is here: should I add it and send you mczs, or 
> > will you do it yourself? (it is a simple change).
> > 
> > Peter
> > 
> > On Sat, Jul 22, 2017 at 10:51:42PM +0200, Sven Van Caekenberghe wrote:
> >> Peter,
> >> 
> >>> On 22 Jul 2017, at 22:27, Peter Uhnak <i.uh...@gmail.com> wrote:
> >>> 
> >>> Hi Sven,
> >>> 
> >>> my use case was hand-edited CSVs (therefore the quotes are extra 
> >>> clutter), which imples that I would be hand-viewing/editing only small 
> >>> CSVs (no performance issues).
> >>> 
> >>> I agree that we should err on the safe side with CR & LF (e.g. tools may 
> >>> sometimes autoconvert line endings).
> >>> 
> >>> Regarding performance:
> >>> 
> >>> #findFirstInString:inSet:startingAt: didn't work for me (not sure if bug, 
> >>> or I don't know how to use), so I've trried with inCharacterSet:
> >> 
> >> Yes, it is a bitch to use, the the version you used does not use the 
> >> primitive.
> >> 
> >> Try playing with this:
> >> 
> >> s10 := 'a' repeat: 10.
> >> s100 := 'a' repeat: 100.
> >> 
> >> searchSet := ByteArray new: 256 withAll: 0.
> >> ',"', String crlf do: [ :each | searchSet at: each asInteger + 1 put: 1 ].
> >> 
> >> searchSet := (CharacterSet newFrom: ',"', String crlf) byteArrayMap.
> >> 
> >> [ ByteString findFirstInString: s10 inSet: searchSet startingAt: 1 ] bench.
> >> "15,160,161 per second"
> >> [ ByteString findFirstInString: s100 inSet: searchSet startingAt: 1 ] 
> >> bench.
> >> "8,219,081 per second"
> >> 
> >> ByteString findFirstInString: ',"', String crlf inSet: searchSet 
> >> startingAt: 1.
> >> 
> >> Sven
> >> 
> >>> Tested on worst-case scenario - strings don't contain tested symbols.
> >>> 
> >>> s10 := 'a' repeat: 10.
> >>> s100 := 'a' repeat: 100.
> >>> 
> >>> [ {'"'. ','. String cr. String lf } anySatisfy: [ :each | s10 
> >>> includesSubstring: each ] ] bench. "'1,200,046 per second'"
> >>> [ {'"'. ','. String cr. String lf } anySatisfy: [ :each | s100 
> >>> includesSubstring: each ] ] bench. "'495,482 per second'"
> >>> 
> >>> [ s10 includesAny: { $,. $". Character cr. Character lf } ] bench. 
> >>> "'2,819,416 per second'"
> >>> [ s100 includesAny: { $,. $". Character cr. Character lf } ] bench. 
> >>> "'2,200,668 per second'"
> >>> 
> >>> [ ByteString findFirstInString: s10 inCharacterSet: ',"', String crlf 
> >>> startingAt: 1 ] bench. "'1,187,324 per second'"
> >>> [ ByteString findFirstInString: s100 inCharacterSet: ',"', String crlf 
> >>> startingAt: 1 ] bench. "'165,526 per second'"
> >>> 
> >>> 
> >>> #includesAny: seems to be the best by far.
> >>> 
> >>> Storing the tested characters didn't improve it by much.
> >>> 
> >>> Peter
> >>> 
> >>> On Sat, Jul 22, 2017 at 06:51:31PM +0200, Sven Van 

Re: [Pharo-users] NeoCSV change proposal

2017-07-23 Thread Peter Uhnak
Ah, ByteArrayMap, I was trying ByteArray.

Not sure what the next step is here: should I add it and send you mczs, or will 
you do it yourself? (it is a simple change).

Peter

On Sat, Jul 22, 2017 at 10:51:42PM +0200, Sven Van Caekenberghe wrote:
> Peter,
> 
> > On 22 Jul 2017, at 22:27, Peter Uhnak <i.uh...@gmail.com> wrote:
> > 
> > Hi Sven,
> > 
> > my use case was hand-edited CSVs (therefore the quotes are extra clutter), 
> > which imples that I would be hand-viewing/editing only small CSVs (no 
> > performance issues).
> > 
> > I agree that we should err on the safe side with CR & LF (e.g. tools may 
> > sometimes autoconvert line endings).
> > 
> > Regarding performance:
> > 
> > #findFirstInString:inSet:startingAt: didn't work for me (not sure if bug, 
> > or I don't know how to use), so I've trried with inCharacterSet:
> 
> Yes, it is a bitch to use, the the version you used does not use the 
> primitive.
> 
> Try playing with this:
> 
> s10 := 'a' repeat: 10.
> s100 := 'a' repeat: 100.
> 
> searchSet := ByteArray new: 256 withAll: 0.
> ',"', String crlf do: [ :each | searchSet at: each asInteger + 1 put: 1 ].
> 
> searchSet := (CharacterSet newFrom: ',"', String crlf) byteArrayMap.
> 
> [ ByteString findFirstInString: s10 inSet: searchSet startingAt: 1 ] bench.
>  "15,160,161 per second"
> [ ByteString findFirstInString: s100 inSet: searchSet startingAt: 1 ] bench.
>  "8,219,081 per second"
> 
> ByteString findFirstInString: ',"', String crlf inSet: searchSet startingAt: 
> 1.
> 
> Sven
> 
> > Tested on worst-case scenario - strings don't contain tested symbols.
> > 
> > s10 := 'a' repeat: 10.
> > s100 := 'a' repeat: 100.
> > 
> > [ {'"'. ','. String cr. String lf } anySatisfy: [ :each | s10 
> > includesSubstring: each ] ] bench. "'1,200,046 per second'"
> > [ {'"'. ','. String cr. String lf } anySatisfy: [ :each | s100 
> > includesSubstring: each ] ] bench. "'495,482 per second'"
> > 
> > [ s10 includesAny: { $,. $". Character cr. Character lf } ] bench. 
> > "'2,819,416 per second'"
> > [ s100 includesAny: { $,. $". Character cr. Character lf } ] bench. 
> > "'2,200,668 per second'"
> > 
> > [ ByteString findFirstInString: s10 inCharacterSet: ',"', String crlf 
> > startingAt: 1 ] bench. "'1,187,324 per second'"
> > [ ByteString findFirstInString: s100 inCharacterSet: ',"', String crlf 
> > startingAt: 1 ] bench. "'165,526 per second'"
> > 
> > 
> > #includesAny: seems to be the best by far.
> > 
> > Storing the tested characters didn't improve it by much.
> > 
> > Peter
> > 
> > On Sat, Jul 22, 2017 at 06:51:31PM +0200, Sven Van Caekenberghe wrote:
> >> Hi Peter,
> >> 
> >>> On 22 Jul 2017, at 14:12, Peter Uhnak <i.uh...@gmail.com> wrote:
> >>> 
> >>> Hi,
> >>> 
> >>> this is a continuation of an older thread about quoting fields only when 
> >>> necessary. ( 
> >>> http://forum.world.st/NeoCSVWriter-automatic-quotes-td4924781.html )
> >>> 
> >>> I've attached fileouts of NeoCSV packages with the addition (I don't know 
> >>> if Metacello can file-out only changesets).
> >>> 
> >>> The change doesn't affect the default behavior, only when explicitly 
> >>> requested.
> >>> 
> >>> Peter
> >> 
> >> I accepted your changes as such, the .mcz's were copied over to the main 
> >> repositories. This is a pure & clean extension, so that is good. Thank you.
> >> 
> >> This option is always going to be slower, but the current implementation 
> >> might be improved, I think.
> >> 
> >> The key test in #writeOptionalQuotedField:
> >> 
> >> {
> >>  lineEnd asString.
> >>  separator asString.
> >>  '"' } anySatisfy: [ :each | string includesSubstring: each ]
> >> 
> >> will be quite slow. 
> >> 
> >> If we accept a little bit of (over safe) error on EOL and use any 
> >> occurrence of CR or LF as needing a quote, we could switch to characters 
> >> to test for. There exists a fast (primitive) test, 
> >> #findFirstInString:inSet:startingAt: that can do all the testing in one 
> >> go. If your version turns out to be slow, we could try that, if 
> >> measurements show a difference.
> >> 
> >> Regards,
> >> 
> >> Sven 
> >> 
> >> 
> > 
> 
> 



Re: [Pharo-users] NeoCSV change proposal

2017-07-22 Thread Peter Uhnak
Hi Sven,

my use case was hand-edited CSVs (therefore the quotes are extra clutter), 
which imples that I would be hand-viewing/editing only small CSVs (no 
performance issues).

I agree that we should err on the safe side with CR & LF (e.g. tools may 
sometimes autoconvert line endings).

Regarding performance:

#findFirstInString:inSet:startingAt: didn't work for me (not sure if bug, or I 
don't know how to use), so I've trried with inCharacterSet:

Tested on worst-case scenario - strings don't contain tested symbols.

s10 := 'a' repeat: 10.
s100 := 'a' repeat: 100.

[ {'"'. ','. String cr. String lf } anySatisfy: [ :each | s10 
includesSubstring: each ] ] bench. "'1,200,046 per second'"
[ {'"'. ','. String cr. String lf } anySatisfy: [ :each | s100 
includesSubstring: each ] ] bench. "'495,482 per second'"

[ s10 includesAny: { $,. $". Character cr. Character lf } ] bench. "'2,819,416 
per second'"
[ s100 includesAny: { $,. $". Character cr. Character lf } ] bench. "'2,200,668 
per second'"

[ ByteString findFirstInString: s10 inCharacterSet: ',"', String crlf 
startingAt: 1 ] bench. "'1,187,324 per second'"
[ ByteString findFirstInString: s100 inCharacterSet: ',"', String crlf 
startingAt: 1 ] bench. "'165,526 per second'"


#includesAny: seems to be the best by far.

Storing the tested characters didn't improve it by much.

Peter

On Sat, Jul 22, 2017 at 06:51:31PM +0200, Sven Van Caekenberghe wrote:
> Hi Peter,
> 
> > On 22 Jul 2017, at 14:12, Peter Uhnak <i.uh...@gmail.com> wrote:
> > 
> > Hi,
> > 
> > this is a continuation of an older thread about quoting fields only when 
> > necessary. ( 
> > http://forum.world.st/NeoCSVWriter-automatic-quotes-td4924781.html )
> > 
> > I've attached fileouts of NeoCSV packages with the addition (I don't know 
> > if Metacello can file-out only changesets).
> > 
> > The change doesn't affect the default behavior, only when explicitly 
> > requested.
> > 
> > Peter
> 
> I accepted your changes as such, the .mcz's were copied over to the main 
> repositories. This is a pure & clean extension, so that is good. Thank you.
> 
> This option is always going to be slower, but the current implementation 
> might be improved, I think.
> 
> The key test in #writeOptionalQuotedField:
> 
> {
>   lineEnd asString.
>   separator asString.
>   '"' } anySatisfy: [ :each | string includesSubstring: each ]
> 
> will be quite slow. 
> 
> If we accept a little bit of (over safe) error on EOL and use any occurrence 
> of CR or LF as needing a quote, we could switch to characters to test for. 
> There exists a fast (primitive) test, #findFirstInString:inSet:startingAt: 
> that can do all the testing in one go. If your version turns out to be slow, 
> we could try that, if measurements show a difference.
> 
> Regards,
> 
> Sven 
> 
> 



[Pharo-users] is Renraku general purpose rule checker?

2017-07-22 Thread Peter Uhnak
Hi,

I'm looking at Renraku and I wonder, would Renraku be a good start for 
general-purpose checking?

E.g. I have a domain, where Person cannot drink if they are underage.

So I've created a simple ReAbstractRule subclass that does basic check

SomeRule>>basicCheck: anEntity
^ anEntity age < 18

and also custom Critique.

So for everything seems that it works well, however I am not sure if there are 
some potential roadbloacks down the road, because e.g. Renraku is meant only 
for AST/code based rules.

Thanks,
Peter



Re: [Pharo-users] NeoCSV change proposal

2017-07-22 Thread Peter Uhnak
attached

On Sat, Jul 22, 2017 at 02:12:10PM +0200, Peter Uhnak wrote:
> Hi,
> 
> this is a continuation of an older thread about quoting fields only when 
> necessary. ( 
> http://forum.world.st/NeoCSVWriter-automatic-quotes-td4924781.html )
> 
> I've attached fileouts of NeoCSV packages with the addition (I don't know if 
> Metacello can file-out only changesets).
> 
> The change doesn't affect the default behavior, only when explicitly 
> requested.
> 
> Peter
Object subclass: #NeoCSVReader
instanceVariableNames: 'readStream charBuffer separator stringStream 
fieldCount recordClass recordClassIsIndexable fieldAccessors emptyFieldValue'
classVariableNames: ''
poolDictionaries: ''
category: 'Neo-CSV-Core'!
!NeoCSVReader commentStamp: '' prior: 0!
I am NeoCSVReader.

I read a format that
- is text based (ASCII, Latin1, Unicode)
- consists of records, 1 per line (any line ending convention)
- where records consist of fields separated by a delimiter (comma, tab, 
semicolon)
- where every record has the same number of fields
- where fields can be quoted should they contain separators or line endings

Without further configuration, records will become Arrays of Strings.

By specifiying a recordClass and fields with optional converters most objects 
can be read and instanciated correctly.

MIT License.
!


!NeoCSVReader methodsFor: 'accessing' stamp: 'SvenVanCaekenberghe 5/13/2014 
15:34'!
readHeader
"Read a record, presumably a header and return the header field names.
This should normally be called only at the beginning and only once.
This sets the fieldCount (but fieldAccessors overrides fieldCount)."

| names |
names := Array streamContents: [ :out |
 [ self atEnd or: [ self readEndOfLine ] ]
whileFalse: [ 
out nextPut: self readField.
(self readSeparator and: [ self atEnd or: [ 
self peekEndOfLine ] ])
ifTrue: [ out nextPut: emptyFieldValue 
] ] ].
fieldCount := names size.
^ names! !

!NeoCSVReader methodsFor: 'accessing' stamp: 'SvenVanCaekenberghe 10/6/2014 
17:34'!
select: filter
"Read and collect records that satisfy filter into an Array until there 
are none left.
Return the array."

^ Array streamContents: [ :stream | 
self 
select: filter 
thenDo: [ :each | stream nextPut: each ] ]! !

!NeoCSVReader methodsFor: 'accessing' stamp: 'SvenVanCaekenberghe 6/21/2012 
22:30'!
next
"Read the next record.
I will return an instance of recordClass."

^ recordClassIsIndexable
ifTrue: [ self readNextRecordAsArray ] 
ifFalse: [ self readNextRecordAsObject ]! !

!NeoCSVReader methodsFor: 'accessing' stamp: 'SvenVanCaekenberghe 10/6/2014 
17:33'!
select: filter thenDo: block
"Execute block for each record that satisfies filter until I am at end."

[ self atEnd ]
whileFalse: [ 
| record |
record := self next.
(filter value: record)
ifTrue: [ block value: record ] ]! !

!NeoCSVReader methodsFor: 'accessing' stamp: 'SvenVanCaekenberghe 6/25/2012 
14:45'!
upToEnd 
"Read and collect records into an Array until there are none left.
Return the array."

^ Array streamContents: [ :stream |
self do: [ :each | stream nextPut: each ] ]! !

!NeoCSVReader methodsFor: 'accessing' stamp: 'SvenVanCaekenberghe 6/25/2012 
14:45'!
do: block
"Execute block for each record until I am at end."

[ self atEnd ]
whileFalse: [ 
block value: self next ]! !


!NeoCSVReader methodsFor: 'private - reading' stamp: 'SvenVanCaekenberghe 
6/14/2012 17:24'!
readField
^ self peekQuote
ifTrue: [
self readQuotedField ]
ifFalse: [
self readUnquotedField ]! !

!NeoCSVReader methodsFor: 'private - reading' stamp: 'SvenVanCaekenberghe 
1/15/2014 09:55'!
readNextRecord
| record |
record := recordClass new: fieldCount.
fieldAccessors
ifNil: [ self readNextRecordWithoutFieldAccessors: record ]
ifNotNil: [ self readNextRecordWithFieldAccessors: record ].
self readAtEndOrEndOfLine.
^ record! !

!NeoCSVReader methodsFor: 'private - reading' stamp: 'SvenVanCaekenberghe 
5/13/2014 15:35'!
readNextRecordAsObject
| object |
object := recordClass new.
fieldAccessors do: [ :each | | rawValue |
rawValue := self readFieldAndSeparator.

[Pharo-users] NeoCSV change proposal

2017-07-22 Thread Peter Uhnak
Hi,

this is a continuation of an older thread about quoting fields only when 
necessary. ( http://forum.world.st/NeoCSVWriter-automatic-quotes-td4924781.html 
)

I've attached fileouts of NeoCSV packages with the addition (I don't know if 
Metacello can file-out only changesets).

The change doesn't affect the default behavior, only when explicitly requested.

Peter



[Pharo-users] best naming practices for (file) format reading/writing

2017-07-22 Thread Peter Uhnak
Hi,

I've seen (and I use) different naming conventions when reading/writing from 
files/streams...

e.g.

MyReader new readFromStream: aStream. "-> aModel"
MyWriter new writeToStream: aModel. "-> aStream"

or

(MyReader new on: aStream) upToEnd. "-> aModel"
(MyWriter new on: aStream) nextPut: aModel. "-> aStream"

or 

MyReader new fromString: aString. "-> aModel"
MyReader new toString: aModel. "-> aString"


etc. (optionally with class-side methods for convenience).

Do we have some best practices/recommendations/conventions regarding this?

Thanks,
Peter



Re: [Pharo-users] Iceberg + github without github account

2017-07-21 Thread Peter Uhnak
In Iceberg (Version Control) settings, there should be an option "enable 
Metacello (or Monticello?) integration" that should disable this iirc.

On Fri, Jul 21, 2017 at 08:35:23PM +0200, Herby Vojčík wrote:
> Hello!
> 
> I use Iceberg with metacelloIntegration: true to have gitlocal:// protocol
> available to load local git repos.
> 
> Problem I encountered (while trying to load Mocketry) that Iceberg hijacks
> github:// protocol and it seems it needs ssh credentials that actually
> allows access to github. But I don't have (and don't plan to have, because
> reasons) a github account.
> 
> For the moment I work it around this way (the script I use to build my work
> image):
> 
>  BEGIN
> | hereRef |
> hereRef := Smalltalk imageDirectory asFileReference.
> (IceRepositoryCreator new location: hereRef; subdirectory: 'src';
> createRepository) register.
> 
> "BEGIN WORKAROUND"
> IceGithubRepositoryType class compile: 'type ^ ''github+rw'''. "Work around
> github:// needing access"
> "END WORKAROUND"
> 
> Iceberg enableMetacelloIntegration: true.
> Metacello new baseline: 'Towergame'; repository: 'gitlocal:///', (hereRef /
> 'src') fullName; load.
> Towergame configure.
> 
> Smalltalk snapshot: true andQuit: true.
>  END
> 
> Questions: Is there some more canonical way to get there? Will Iceberg
> include something to make it easier to have readonly-github repos /
> integrate only gitlocal://?
> 
> Thanks, Herby
> 



Re: [Pharo-users] Mysterious problem in loading Pharo

2017-07-17 Thread Peter Uhnak
With fast boot I had experiences where the restart wasn't enough and I had to 
restart several times, but since I disabled fast boot restarting once was 
always enough... so usually the first thing I do when windows boots is to check 
if Pharo runs ok.

In some rare unclear circmustances (now I wonder whether it happened after 
sleep) it broke after some time... but that happened only two or three times in 
past ~6 months.

Also dual-booting increases the probability it seems... there were some 
correlated issues regarding time and network card, but nothing conclusive.

Peter


On Mon, Jul 17, 2017 at 12:01:55AM +0100, PBKResearch wrote:
> Peter
> 
> I think the implication of your second para is that your last resort, 
> re-booting the system, is always effective in fixing the problem. If so, 
> while it is obviously a nuisance I think I can live with that. I think I have 
> had this only once before - at least, I have seen the debug console in some 
> context. But yesterday it happened simultaneously on two separate machines. 
> So it all depends on how frequently it happens.
> 
> Peter Kenny
> 
> -Original Message-
> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of 
> Peter Uhnak
> Sent: 16 July 2017 15:40
> To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
> Subject: Re: [Pharo-users] Mysterious problem in loading Pharo
> 
> I had this problem for several months (and still do), and so far I didn't 
> manage to figure out what is the actual cause.
> 
> Sometimes it fixes itself (close Pharo and open again), sometimes opening it 
> with different VM (and then reopen with the original) helps, and sometimes I 
> have to restart system.
> 
> After I disabled Windows Fast Boot it is somewhat more infrequent (or rather 
> it fixes itself without the need to restart).
> 
> But otherwise I might as well wave a magical wand. It is annoying but still 
> better than then spending countless hours digging randomly and aimlessly in 
> the VM ¯\_(ツ)_/¯.
> 
> Peter
> 
> 
> On Sat, Jul 15, 2017 at 10:38:51PM +0800, Ben Coman wrote:
> > Maybe revew recent Windows 10 updates...
> > http://www.sysprobs.com/how-to-view-installed-updates-on-windows-10-8-
> > 1-server-2012
> > 
> > cheers -ben
> > 
> > On Sat, Jul 15, 2017 at 6:26 PM, PBKResearch <pe...@pbkresearch.co.uk>
> > wrote:
> > 
> > > Hello
> > >
> > >
> > >
> > > I have a problem in loading Pharo images which, until yesterday, 
> > > loaded without difficulty. All the images showing the problem are 
> > > Pharo 6 with the Cog VM; older images do not seem to be affected.
> > >
> > >
> > >
> > > The first sign of a problem is that, as soon as I start the image, 
> > > the debug console appears, with several repeats of the message:
> > >
> > > LoadLibrary(FT2Plugin.dll) (998: Invalid access to memory location.)
> > >
> > > The other strange thing is that the appearance of some opened 
> > > windows has changed. Most obviously, the three icons at the top left 
> > > (close, minimise,
> > > expand) are very close together. Also, I think the print size has 
> > > got a bit smaller, though this is not obvious.
> > >
> > >
> > >
> > > I have recently reinstalled some components of Pharo and Moose, 
> > > trying to solve my problems with PunQLite, so I wondered if I had 
> > > fouled something up. To check, I made a completely new install of 
> > > Pharo 6 (#60508) from the Pharo download page in a separate folder. 
> > > When I start the image, both the strange things above are present, 
> > > plus a debug window with the message;
> > > ‘FT2 Error: Freetype2 primitive failed’.
> > >
> > >
> > >
> > > So it looks as though something has happened to my system which 
> > > means that any Pharo 6 image will show these oddities. The images I 
> > > have tried seem able to run some of my functions correctly, so it’s 
> > > all to do with appearance.
> > >
> > >
> > >
> > > I am running on Windows 10 with all recent updates. There was a 
> > > major update of Windows late yesterday, so it may be that the 
> > > problems appeared then. Does anyone have any suggestions?
> > >
> > >
> > >
> > > Many thanks
> > >
> > >
> > >
> > > Peter Kenny
> > >
> 
> 



Re: [Pharo-users] Mysterious problem in loading Pharo

2017-07-16 Thread Peter Uhnak
I had this problem for several months (and still do), and so far I didn't 
manage to figure out what is the actual cause.

Sometimes it fixes itself (close Pharo and open again), sometimes opening it 
with different VM (and then reopen with the original) helps, and sometimes I 
have to restart system.

After I disabled Windows Fast Boot it is somewhat more infrequent (or rather it 
fixes itself without the need to restart).

But otherwise I might as well wave a magical wand. It is annoying but still 
better than then spending countless hours digging randomly and aimlessly in the 
VM ¯\_(ツ)_/¯.

Peter


On Sat, Jul 15, 2017 at 10:38:51PM +0800, Ben Coman wrote:
> Maybe revew recent Windows 10 updates...
> http://www.sysprobs.com/how-to-view-installed-updates-on-windows-10-8-1-server-2012
> 
> cheers -ben
> 
> On Sat, Jul 15, 2017 at 6:26 PM, PBKResearch 
> wrote:
> 
> > Hello
> >
> >
> >
> > I have a problem in loading Pharo images which, until yesterday, loaded
> > without difficulty. All the images showing the problem are Pharo 6 with the
> > Cog VM; older images do not seem to be affected.
> >
> >
> >
> > The first sign of a problem is that, as soon as I start the image, the
> > debug console appears, with several repeats of the message:
> >
> > LoadLibrary(FT2Plugin.dll) (998: Invalid access to memory location.)
> >
> > The other strange thing is that the appearance of some opened windows has
> > changed. Most obviously, the three icons at the top left (close, minimise,
> > expand) are very close together. Also, I think the print size has got a bit
> > smaller, though this is not obvious.
> >
> >
> >
> > I have recently reinstalled some components of Pharo and Moose, trying to
> > solve my problems with PunQLite, so I wondered if I had fouled something
> > up. To check, I made a completely new install of Pharo 6 (#60508) from the
> > Pharo download page in a separate folder. When I start the image, both the
> > strange things above are present, plus a debug window with the message;
> > ‘FT2 Error: Freetype2 primitive failed’.
> >
> >
> >
> > So it looks as though something has happened to my system which means that
> > any Pharo 6 image will show these oddities. The images I have tried seem
> > able to run some of my functions correctly, so it’s all to do with
> > appearance.
> >
> >
> >
> > I am running on Windows 10 with all recent updates. There was a major
> > update of Windows late yesterday, so it may be that the problems appeared
> > then. Does anyone have any suggestions?
> >
> >
> >
> > Many thanks
> >
> >
> >
> > Peter Kenny
> >



Re: [Pharo-users] [Pharo-dev] integrating FileDialog into Pharo 7

2017-07-10 Thread Peter Uhnak
Done. What next?

Peter


On Mon, Jul 10, 2017 at 12:46:50PM +0200, Pavel Krivanek wrote:
> We should work on integration of it. Firstly please move tests to a
> separate package.
> 
> Cheers,
> -- Pavel
> 
> 2017-07-10 12:34 GMT+02:00 Peter Uhnak <i.uh...@gmail.com>:
> 
> > Hi,
> >
> > some people expressed interest in integrating File Dialog
> > https://github.com/peteruhnak/file-dialog into Pharo as the default file
> > dialog.
> >
> > Is it something people are interested in, or is the current solution
> > sufficient for them?
> >
> > Peter
> >
> >



[Pharo-users] integrating FileDialog into Pharo 7

2017-07-10 Thread Peter Uhnak
Hi,

some people expressed interest in integrating File Dialog 
https://github.com/peteruhnak/file-dialog into Pharo as the default file dialog.

Is it something people are interested in, or is the current solution sufficient 
for them?

Peter



Re: [Pharo-users] 2 questions around gitlab, gitfiletree, BaselineOf

2017-07-07 Thread Peter Uhnak
Hi,

I had similar issues when using gitfiletree... and in the end I've ended up 
with this 
https://github.com/peteruhnak/pharo-scripts/blob/master/config/5.0/openponk-autoload.st

it is not the prettiest thing, however it is automated so I didn't bother 
improving it.


* automatically loads GitFileTree (I also load my own shell, because OSProcess 
was failing on me hard)
* "pre-loads" some dependencies so they point to my local git repositories 
instead of being pulled from github
* if BaselineOf is available in the image, then MC loader will use that 
(instead of grabbing code from bitbucket/gitlab/github)
* #onWarningLog is there to suppress warning about loading from 
different source (local instead of github), but avialble in transcript iirc
* startup script, so I could name the image certain way and it will prepare it 
for me
* (obviously one can use it separately)
* used on windows and linux (that's why the platform checking)

Peter


On Fri, Jul 07, 2017 at 06:48:50AM -0700, Sabine Manaa wrote:
> Hi,
> 
> we have our own gitlab running now and I succeeded to move our code from
> sthub to it.
> I can push my new code into it from Pharo. All fine.
> I also created a Baseline (based on my former configurationOf).
> Loading the code from others (e.g. seaside) with this baseline is also fine.
> 
> There are 2 Points where I am sure it could be better (it is worse)
> 1) For loading my own code, I currently have a bad solution 
> It is in the postLoadBaseline and does this:
> 
>   | gitRepository |
>   gitRepository := MCFileTreeRepository new
>   directory:
> '/Applications/Pharo5.0-7.app/Contents/Resources/spf-gitlab/repository'
> asFileReference.
>   {'RKA24-Model' . 'RKA24-System' . 'RKA24-Translator' . 'RKA24-View' .
> 'RKA24-Test' . 'RKA24-Report' . 'RKA24-Overwrites'}
>   do: [ :each | 
>   Gofer it
>   repository: gitRepository;
>   package: each;
>   load ].
>   
> I would like to load it within my baseline like this below but I dont know
> what to write in the fileTreeRepository method...
>   
> baseline: spec
>   
>   spec
>   for: #common
>   do: [ spec blessing: #baseline.
>   spec repository: ##self fileTreeRepository##.
>   "here I load all the the oher stuff"
>   spec
>   package: 'RKA24-Model';
>   package: 'RKA24-System';
>   package: 'RKA24-Translator';
>   package: 'RKA24-View';
>   package: 'RKA24-Test';
>   package: 'RKA24-Report';
>   package: 'RKA24-Overwrites' ] 
> 
> 2) Also, when I take a new Image, I have to do several steps 
> 
> load gitfiletree from catalog
> add/open my gitfiletree repository from Monticello
> load BaselineOfRKA24 manually with 
> (BaselineOfRKA24   project map at: 'baseline') load
> 
> I think this is not the best way, I would like to make it right.
> 
> Can anyone give me some hints how to improve this two steps?
> I use Pharo 5 and I don't want to go to Pharo 6 right now.
> I develop on mac and production server is on windows.
> 
> Regards
> Sabine
>  
> 
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/2-questions-around-gitlab-gitfiletree-BaselineOf-tp4953877.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 



Re: [Pharo-users] Saving to local git and "Loading all file names from http://...pharo5/inbox"

2017-06-19 Thread Peter Uhnak
Hi,

there was an issue with presumably gitfiletree, that when checking a code 
against its repo (to commit or show changes), every single repository would be 
refreshed, which took quite a while (on the order of seconds to tens of 
seconds, but it was quite annoying as it happened frequently).. so as I don't 
need the repos unless I am fixing the bug, I removed them...

I don't use it in Pharo 6 as I haven't experienced the issue there, but I am 
using Iceberg now, so maybe that is the reason.

Peter


On Sat, Jun 17, 2017 at 03:19:41AM -0700, webwarrior wrote:
> Well, that is the question to the author of original script - Peter Uhnak.
> 
> The goal is to avoid contacting server (takes alot of time and blocks the
> image) every time you save a package to a filetree repo. As I understand
> repositories in question are kind of special and are always checked, so
> removing them solves the problem.
> 
> I just modified it to work on Pharo6. 
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/Saving-to-local-git-and-Loading-all-file-names-from-http-pharo5-inbox-tp4897962p4951723.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 



Re: [Pharo-users] Wiring objects, IoC and Service Locator

2017-06-08 Thread Peter Uhnak
On Thu, Jun 08, 2017 at 08:02:04AM -0700, Attila Magyar wrote:
> Vitor Medina Cruz wrote
> > This is exactly my concern! Sure, for small stuff that is not a problem,
> > but what if you have a big app?
> 
> I don't think it makes any difference.

Scale can make all the difference. Imagine the complexity of connecting N 
elements. If you have just tree objects/classes/systems... you need just two 
connections, but you if double the number of elements, you need more than seven 
times more connections (to form a complete graph). Of course in practice that 
number will be smaller, but certainly more than linear to the number of 
elements. So what works in small scale doesn't necessarily translate to bigger 
scale, not to mention that brand new concerns are probably going to arise... 
just like when you are constructing a taller building, you cannot just slap it 
twice on each other, because the foundations will collapse, and when you want 
to build a space elevator, you need technology that hasn't been invented yet.




Re: [Pharo-users] Wiring objects, IoC and Service Locator

2017-06-08 Thread Peter Uhnak
On Thu, Jun 08, 2017 at 08:46:15AM -0300, Vitor Medina Cruz wrote:

> This is true for IoC DI containers, but I don't think it applies for
> service locator, which, I think, could not be considered a framework
> approach. Actually, I think being a framework is the big problem of the of
> the former, since when I start to use an IoC container to create objects I
> got tied to it in a very basic and pervasive operation of an OO system:
> object creation.

Well that is the objective of DI to handle the object creation on your behalf. 
Of course no class is prohibited from creating instances directly, provided it 
had the necessary dependencies to give to the instance.

> Suddenly everything must be created through the DI container, but that is not 
> true for Service Locator.

As I've noted above, DI doesn't restrict you from creating instances. Service 
Locator gives you a more flexible approach, however it follows that it can be 
also harder to manage, as the services registered in the locator can (and 
typically do) change at runtime, which inhibits static reasoning about the 
dependencies, compared to a pre-fixed configuration.

> 
> However I wouldn't be surprised if the liveness of Smalltalk/Pharo
> > environment eliminated some of the problems that DI is trying to solve.
> 
> 
> That is precisely what I wanted to know. It seems there are no DI
> counterpart in the Pharo/Smalltalk environment, ok, so what people do to to
> deal with the above mentioned problem? Hand wiring is suffice? Is there
> anything in the liveness of Smalltalk/Pharo that eliminates the need for
> it? People use simple Service Locator, or variations of it?

In my previous mail I've mentioned Spec doing something of the sorts, but I 
don't think I've seen it anywhere else. The hand-wiring mostly suffices; 
sometimes you can see having a method containing the name of the class it will 
instantiate (and which can be altered in a subclass). My best guess would be 
that the capabilities of Pharo, such as pluggable closures, and being a live 
already-running system are more likely to push the programmer towards a 
different architecture, where incidentally DI's are not such a concern, but I 
would certainly love to see some deep analysis on this.


Peter

> 
> 
> cheers!
> Vitor
> 
> On Wed, Jun 7, 2017 at 9:32 PM, Ben Coman  wrote:
> 
> >
> >
> > On Tue, Jun 6, 2017 at 11:48 PM, Attila Magyar 
> > wrote:
> >
> >> I don't think using a DI container worth the effort. They add lots of
> >> complexities and solve very little. For some reason DI containers became
> >> very popular in the Java world, but if you take a look at other
> >> programming
> >> communities you'll realize that many people are perfectly happy without
> >> using these containers. Using DI and using a DI container is orthogonal.
> >> As
> >> you also said you can just pass dependencies to objects to achieve loose
> >> coupling. Yes, you have to do this manually but what's the big deal? We're
> >> talking about code with cyclomatic complexity of 1. Calling a constructor
> >> is
> >> not a problem that need to be solved. Using an external XML configuration
> >> to
> >> describe object wiring is the worst idea ever.
> >>
> >> Here is an article about using plain old object composition to do DI
> >>
> >> http://blog.davidpeterson.co.uk/2011/01/object-oriented-example.html
> >>
> >> Some more thoughts about the problems associated with DI containers:
> >>
> >> http://www.natpryce.com/articles/000783.html
> >
> >
> > I liked this...  "the [Dependency Injection] pattern also used to be
> > called "third-party binding" or "third-party connect": some third party is
> > responsible for connecting an object satisfying the service requirements of
> > a component"
> > This makes the subject seem less esoteric.  It reminds me of hearing that
> > the first (secret) task when doing a PhD is to invent new terms for common
> > ones, and base your writings on that. Perhaps its the same for consultants
> > and framework developers. ;P   Or maybe everything seems esoteric until you
> > have experience with it and I've not done much with Java, certainly not big
> > applications.
> >
> > Thx Peter for your example and how you prior experience compares to Pharo.
> >
> > cheers -ben
> >
> >
> >> http://higherorderlogic.com/2011/07/is-dependency-injection-like-facebook
> >>
> >>
> >>
> >> --
> >> View this message in context: http://forum.world.st/Wiring-o
> >> bjects-IoC-and-Service-Locator-tp4949280p4949720.html
> >> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> >>
> >>
> >



Re: [Pharo-users] Wiring objects, IoC and Service Locator

2017-06-07 Thread Peter Uhnak
> I don't see what is special about this.  You can easily arrange instance
> creation order with methods on the class-side of your domain classes.

I will not use the term "class", but rather a "service" (service can be just a 
single class, but that is not always the case). The point of inversion of 
control is provide the class with what is needed instead of the class creating 
it on it's own.
Sure, you can create class-side helper, however that is very limited, such as 
the examples/samples as you've demonstrated.

To give you an example, imagine that you have a class PeopleService that 
manages database of people, so it needs a connection to the database. 
Implemented in a naive way the class would have hard-coded credentials to a 
MySQL database and it would execute raw SQL queries. This works for a single 
class, but it creates a mess and mingles concerns; so instead you inverse the 
control and you provide PeopleService with e.g. a Persistence instance, which 
is already connected to the database; note however that you cannot just create 
the Persistence on the class-side, because you wouldn't even know what to 
instantiate (as you could e.g. use DbPersistence, FilePersistence, ...). And 
this is just a basic example. Imagine that the PeopleService also needs other 
services for it's use, and those services need more services, and you want to 
keep everything separated as much as possible... instantiation by hand will 
simply not cut it So the service locator/DI configuration (whether as 
annotations or in a XML file) keeps the actual classes separated from concrete 
instances; the service depends on abstract interfaces, not specific classes; 
only the conf determines the specific ones, and more often than not there will 
be several different configurations _at the same time_. To continue with the 
example you could have one config production using e.g. OraclePersistence, 
another for development using MySQLPersistance, another for test server using 
MemoryPersistence, etc. (also with different credentials, and whatnot).

Keep in mind however that relates primarily to using application frameworks, 
where the framework mandates the control, and the framework is the one calling 
you, and therefore it will also provide you with necessary parts. After all you 
are not even creating PeopleService class, the framework instantiates it for 
you and gives it to another services/classes that needed it.

Now I don't feel like there are many application frameworks in Pharo, maybe 
Seaside has something of this sorts? I guess Spec can be a bit framework-y, as 
the basic spec widgets do not actually know what Morphic counterparts will be 
created for them, and Spec looks up the actual class in a hard-coded data table 
(which might as well be a XML file), but that comes closer to ServiceLocator 
than DI (as Spec widgets should not actually communicate down to morphic).

I've used dependency injection for five years at my previous work and frankly I 
cannot imagine living without it there, but I've never felt the need for it in 
Pharo. This is probably more related to working in Pharo on completely 
different things and writing small libraries. However I wouldn't be surprised 
if the liveness of Smalltalk/Pharo environment eliminated some of the problems 
that DI is trying to solve. But then again, there are many ways to build 
systems, and not all need or benefit DI/IoC.

Peter

> Indeed, the GTTools are set up to work with in-Image sample data.  Look at
> implementors of #sample and #example.
> There was quite some bike-shedding over the naming convention (and I forget
> the final result), but hopefully it provide the general idea...
> 
> http://forum.world.st/a-request-to-change-the-meaning-of-lt-example-gt-pragma-td4927360.html
> http://forum.world.st/lt-example-gt-lt-examplar-gt-td4911728i20.html
> http://forum.world.st/Existing-lt-script-gt-lt-example-gt-pragmas-and-new-GT-needs-td4814903i20.html
> 
> 
> 
> >
> > I started, however, to question DI as a valid mechanisms because of it's
> > complexities and other problems. The article from Fowler provides the
> > service locator as an alternative which seems to me much simpler and
> > completely fine solution for the problem.
> >
> 
> If it seems suitable, then to quote Nike, just do it ;)
> 
> 
> 
> > So, to answer you question "Is it any more complicated than that?": In
> > the DI approach, yes it can be, but I don't think so in the service locator
> > approach.
> >
> > I am asking here because I wanted to know how people from Smalltalk deal
> > with this problem. As it seems there is no standard approach, nor this is
> > perceived as a problem...
> >
> 
> 
> DI or Service Locator are both "implementations" of your need.  Can we take
> step backward to see what is your need?  To kick off, I hazard a guess at
> some possible needs...
> 
> 1.  To switch between configurations to use production data and test data ?
> 2.  To make this switch during CI testing 

Re: [Pharo-users] is it related to Freetype or Athens?

2017-06-07 Thread Peter Uhnak
On Tue, Jun 06, 2017 at 07:33:04PM +0200, Hilaire wrote:
> Hi there,
> 
> A Dr. Geo user on Ubuntu 64bits 16.04 got that buggy rendering of the
> canvas, then on some situation the rendering completely stop on a red
> screen, with a stack showing may be a zero divide error. I did not get
> access to the PharoDebog yet.
> 
> Fonts on the screenshot is not right too. Could it be a mixed problem
> between FreeType and Cairo? Any first though on the issue welcome.

There were couple GC/memory related issues in the VM's plugin, that were fixed 
or worked around in the Pharo 6 VM that apparently were present for a long 
time... so maybe that's also part of what you've experienced...



Re: [Pharo-users] Bloc/Brick/Spec

2017-06-06 Thread Peter Uhnak
* Bloc - low level library (think basic shapes, rectangles, ...)
* Brick - widget library on top of Bloc akin to the widget part of Morphic 
(buttons, checkboxes, ...)
* Spec - UI framework with adaptable backend; currently using Morphic as a 
backend, however once Bloc/Brick matures, Bloc/Brick will be added as another 
backend (without affecting Spec users)

(and below Bloc is Sparta, which is a vector canvas)

Peter

On Mon, Jun 05, 2017 at 06:20:47PM -0700, Brad Selfridge wrote:
> I'm confused. I see the latest news and documentation about Bloc. Is Brick
> now dead and Bloc the default? I thought Brick was a layer on top of Bloc
> and Spec was layer on top on Brick? What is the direction now? 
> 
> Brad Selfridge
> 
> 
> 
> -
> Brad Selfridge
> --
> View this message in context: 
> http://forum.world.st/Bloc-Brick-Spec-tp4949591.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 



Re: [Pharo-users] Saving selected changes in Monticello

2017-06-05 Thread Peter Uhnak
Komitter could indeed help you, see 
https://www.peteruhnak.com/blog/2016/08/12/fine-grained-committing-and-extending-nautilus/

Peter

On Mon, Jun 05, 2017 at 08:27:23AM +0200, serge.stinckw...@gmail.com wrote:
> Kommiter available in default image allows you do cherry pick quite easily.
> 
> Envoyé de mon iPhone
> 
> > Le 5 juin 2017 à 07:14, Ben Coman  a écrit :
> > 
> > 
> > 
> >> On Mon, Jun 5, 2017 at 10:12 AM, Andreas Sunardi  
> >> wrote:
> >> I have a half done changes in my image, but I need to distribute the other 
> >> changes that are done. I thought I was going to do this all at once, but 
> >> now I realize I should split this into 2 commit versions.
> >> 
> >> Is there a way in Monticello to say save my changes, but not this and that 
> >> changes? I can't seem to find it nor in books. How do people deal with 
> >> this situation?
> > 
> > AFAIK, Monticello cannot cherry pick.  One work around is probably 
> > something like... 
> > 1. Save the mcz locally
> > 2. Merge back into a fresh image selecting only the bits you want.  
> > 3. Save as a second mcz.
> > One issue is that the second mcz will have the first mcz as an ancestor, so 
> > before 2 you might create a new changeset to file out after 2, and load 
> > that into a second new image. yuck!
> > 
> > Another alternative might be to use Tools > ChangeSorter to move the code 
> > you want to exclude from the mcz to a changeset, file that out and then 
> > revert that code in the image. After save the package to a mcz, reload the 
> > changeset. 
> > 
> > cheers -ben



[Pharo-users] snap morphs/windows to each other when dragging

2017-06-04 Thread Peter Uhnak
Hi,

is it possible to tell windows to "snap" to other windows when dragging?

So e.g. when I am dragging Playground window, it will try to snap side by side 
with a close-by another window, so they don't overlap (unless I e.g. press 
shift or something).

Thanks,
Peter



Re: [Pharo-users] Porting Transducers to Pharo

2017-05-31 Thread Peter Uhnak
You can also give a try to use SIF (Smalltalk Interchange Format)

https://github.com/peteruhnak/sif

There is parcel file in VW subfolder, and docs here: 
https://github.com/peteruhnak/sif/blob/master/docs.md

I've used it about year ago for some small code exchanges; but of course you 
will have some issues with regards to namespaces, but it is doable.

If you decide to try it please let me know if it work/didn't work for you (so I 
can update the github page).

Peter


On Wed, May 31, 2017 at 04:32:53PM +0200, Steffen Märcker wrote:
> Thanks for the encouraging response! First question: Which is the
> recommended (friction free) way to exchange code between VW and Pharo?
> 
> Cheers!
> Steffen
> 
> Am .05.2017, 16:22 Uhr, schrieb Alexandre Bergel :
> 
> >I second Sven. This is very exciting!
> >
> >Let us know when you have something ready to be tested.
> >
> >Alexandre
> 
> 
> 



[Pharo-users] YAML parser (2017)

2017-05-29 Thread Peter Uhnak
Hi,

do we have a working parser for YAML?

There's PPYAMLGrammar (in PetitParser), however it doesn't seem to work in 
Pharo 6 at all (not even tests pass).
In Pharo 5 the tests are green, but using it on YAML content still fails... 
with small fix I managed it to "pass", however the output seems to be a very 
fine-grained AST decomposition and not the expected output 
(dictionaries/arrays).

So do we have some else/working?

YAML specs have BNF descriptions, so maybe SmaCC can generate it? (I don't know 
SmaCC, so maybe this is not how it works.)

Thanks,
Peter



Re: [Pharo-users] Ston feature idea?

2017-05-17 Thread Peter Uhnak
Just curious... why don't you use MSE?

Peter


On Wed, May 17, 2017 at 12:44:58PM +0200, Sven Van Caekenberghe wrote:
> Hi Cyril,
> 
> This can be done quite easily in STON, I will make you a small example and 
> add it to the unit tests.
> 
> Sven
> 
> > On 17 May 2017, at 12:19, Cyril Ferlicot D.  
> > wrote:
> > 
> > Hi!
> > 
> > At Synectique sometimes we use Ston to export models that contains some
> > MooseEntities.
> > 
> > Moose entities been complex, we usually export only the moose name of
> > the entity then we retrieve the entity during the import. But we did not
> > find any "easy" way to do this in Ston.
> > 
> > I used voyage and it has a system like this. Example:
> > 
> > Amount class>>mongoCurrency
> >   
> > 
> >   ^ VOMongoToOneDescription new
> >  attributeName: 'currency';
> >  accessor: (MAPluggableAccessor
> > read: [ :amount | amount currency abbreviation ]
> > write: [ :amount :value | amount currency: (Currency
> > fromAbbreviation: value) ]);
> >  yourself
> > 
> > With this Voyage know how to read/write the instance variable "currency".
> > 
> > I think it would be cool to be able to easily customize import/export
> > variables with Ston. Maybe it is already possible but I missed the way
> > to do it?
> > 
> > I would like your thoughts about that. :)
> > 
> > -- 
> > Cyril Ferlicot
> > https://ferlicot.fr
> > 
> > http://www.synectique.eu
> > 2 rue Jacques Prévert 01,
> > 59650 Villeneuve d'ascq France
> > 
> 
> 



Re: [Pharo-users] Intro to git-only Pharo

2017-05-10 Thread Peter Uhnak
Hi,

this is my (=not canonical) perspective

On Wed, May 10, 2017 at 07:56:19AM +0200, Joachim Tuchel wrote:
> Hi guys,
> 
> please forgive me if this mail is a sign of ignorance. I am not a
> regular Pharo user and one of the reasons for this is that I didn't
> like most of the source management tools around Monticello. Coming
> from an envy background, it feels like not being ready for prime
> time. Of course you guys have been proving you can work with these
> tools quite well, but still I'd be interested in using Pharo in a
> pure git-based environment, as it most closely resembles some of the
> most-beloved features of envy.
> 
> Over the years there was a lot of work and discussion on filetree,
> gitfiletree, iceberg, cypress and maybe quite a few other projects
> that sounded promising and interesting. But I must admit I lost
> track of what was really done and how far things went in the last
> years.
> 
> So are there any pointers to info material that I could look at to
> see what the current status of source control in Pharo 5 and Pharo 6
> is and/or will be soon?
> 
> I am mostly interested in these topics:
> 
>  * git only - no monticello meta info any more - possible?

first of all -- filetree is an export format which stores Pharo code in an 
organized fashion on disk... a folder for every package, folder for every 
class, file for every method... e.g. 
https://github.com/peteruhnak/pharo-changes-builder/tree/master/repository/ChangesBuilder.package/CBClass.class/instance
this format makes it easier for git to manage the code.

There however two variants of filetree... one containing metacello metadata, 
e.g. the red here 
https://github.com/peteruhnak/IconFactory/commit/729da03653d527bd6ca34e0a512b1c1c634fd32e
 - which caused a lot of pains during merging (because you are almost 
guaranteed a merge conflict)... so a new variant emerged which doesn't use this 
metadata and instead determines it directly from git versioning.

neither GitFileTree (which is a filetree that performs git commits on the 
background) nor Iceberg use monticello metadata.

GFT is still managed via Monticello tools, but the metadata is derived from git 
commits. This is what I've been using for ~two years until recently (now I've 
switched to Iceberg).
I wrote a guide about GFT some time ago 
https://www.peteruhnak.com/blog/2016/07/25/how-to-use-git-and-github-with-pharo/

Iceberg uses the same filetree format as GFT (so they are compatible), but the 
tooling inside Pharo has changed. Now there is dedicated iceberg interface for 
managing git repositories and projects. Although Iceberg is not in stable yet, 
so it breaks from time to time, but when it works I am really happy with it. 
(Thanks Esteban & Nico!).


>  * tools like merge/diff, committing from within the image

Committing from within the image is handled with both GFT and Iceberg; merging 
is not yet. (And of course you see diff when committing/comparing versions)

>  * dependencies within my own project as well as dependencies on
>external code in - possibly multiple - external repositories

With git came also the switch from ConfigurationOf to BaselineOf, which 
somewhat simplified version and dependency management. The Baseline is no 
longer filled with methods for each version, as this is handled by git.


>  * what is the current "most official" source repository for open
>source code?

for Monticello naturally SmalltalkHub/ss3; for git GitHub, however you are not 
restricted from other git sites (gitlab, bitbucket, your own server, ...)

>  * best practices for managing complex projects and keeping old
>versions reproducible at any time

well, this is quite general question... I'd say semver.org is a good start, 
however most people depend on #stable and #development, which are not actually 
versions, so reproducibility is not possible... but there is work being done 
iirc regarding better dependency management (Cargo iirc)


>  * tutorial for git newbies in a Pharo context? (Like, how do I start
>with a new packege - create folder first and do git init, or start
>in the image and push into repo later? as I said: beginners' stuff)

Chapter 8 of Pharo by example, 
https://www.peteruhnak.com/blog/2016/07/25/how-to-use-git-and-github-with-pharo/
 and possibly other resources.

Peter



Re: [Pharo-users] [ANN] git migration tool

2017-05-06 Thread Peter Uhnak
Hi,

the code generated from the migration tool can be used by both Iceberg and 
GitFileTree (because they both use FileTree format to store the code).

So you can just migrate your code, install Iceberg and you're good to go.
I can write a blog post about this I guess...

(maybe I could add the migration to icerberg, but I need to check if libgit2 
can do the importing part)


Peter



On Sat, May 06, 2017 at 08:56:51AM +0200, Stephane Ducasse wrote:
> Peter
> 
> what is the path to migrate MCZ project from SmalltalkHub to github and
> that we can use them with
> Iceberg.
> 
> Stef
> 
> On Sat, May 6, 2017 at 8:44 AM, Stephane Ducasse 
> wrote:
> 
> > this is super cool
> > Tx a lot peter for that.
> >
> > On Thu, May 4, 2017 at 2:32 PM, Peter Uhnák  wrote:
> >
> >> With Iceberg knocking on the door, migration from SmalltalkHub to
> >> Git(Hub/Lab/...) has become relevant once more.
> >>
> >> And that's why I wrote git-migration tool https://github.com/peteru
> >> hnak/git-migration to help you move on to greener pastures.
> >>
> >> Among other things described in the too-long-didn't read README:
> >>
> >> the tool will generate git-fast-import (a special format for fast git
> >> imports) file that can be easily and quickly applied on your git 
> >> repository.
> >> All commits are preserved in their proper order, and merges (commits with
> >> multiple parents) are also converted to git merges.
> >>
> >> So far I've tested it on my custom intentionally broken repository, and
> >> PolyMath.
> >>
> >> PolyMath has 784 commits in 74 packages; it took Pharo about 3 minutes to
> >> process all SmalltalkHub commits and generate 87MB file; git then imported
> >> the file in less than a second.
> >>
> >>
> >> (Git history of PolyMath in GitKraken)
> >>
> >> the tool also provides you with a bunch of visualizations that can help
> >> you analyze your SmalltakHub history and investigate problems.
> >>
> >>
> >> (trees of all packages in the PolyMath repository)
> >>
> >> More things could be desired (e.g. even better performance), so feel free
> >> to open issues, ideally with pull requests. ;)
> >>
> >> Peter
> >>
> >
> >






Re: [Pharo-users] Epicea vs RB refactorings

2017-05-03 Thread Peter Uhnak
anyone?

On Wed, Apr 26, 2017 at 11:19:07AM +0200, Peter Uhnak wrote:
> Hi,
> 
> I'm under the impression that Epicea is supposed to replace RB refactorings 
> at some point.
> 
> If that is true, is it currently possible to build refactorings by hand?
> 
> For example in RB I often do:
> 
> ```
> model := RBNamespace new.
> 
> model defineClass: ('<1s> subclass: #<2s>instanceVariableNames: 
> <3p>classVariableNames: poolDictionaries: category: 
> <4p>' expandMacrosWith: 'Object' with: 'MySomething' with: 'var1 var2' with: 
> 'MyPackage').
> cls := model classNamed: #MySomething.
> cls compile: 'var1
>   ^ var1' classified: 'accessing'.
> 
> (ChangesBrowser changes: model changes changes) open
> ```
> 
> or
> 
> (removing a method from a class)
> ```
> model := RBNamespace new.
> model removeMethod: #testTrimRight from: StringTest.
> (ChangesBrowser changes: model changes changes) open
> ```
> 
> Thanks,
> Peter



Re: [Pharo-users] Put FTTableMorph layout into ComposableModel lyout

2017-05-02 Thread Peter Uhnak
Hi,

you can look at chapter 9.1 in the Spec Booklet 
http://files.pharo.org/books-pdfs/spec/2017-01-23-SpecBooklet.pdf it shows how 
to integrate any morph inside a Spec Model.

But did you look at FastTabelModel? It uses FTTableMorph underneath, so maybe 
it can already do what you need.

Peter


On Tue, May 02, 2017 at 07:30:00AM -0700, chrismihaylyk wrote:
> Hi!
> 
> I need to display my FTTableMorph window content inside of ComposableModel
> window.
> Please tell me, is it possible? 
> 
> Thanks,
> Khrystyna.
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/Put-FTTableMorph-layout-into-ComposableModel-lyout-tp4945202.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 



Re: [Pharo-users] Spec Adapter Advice

2017-04-29 Thread Peter Uhnak
On Sat, Apr 29, 2017 at 09:24:28PM +0200, Denis Kudriashov wrote:
> 2017-04-29 20:36 GMT+02:00 Peter Uhnak <i.uh...@gmail.com>:
> 
> > >
> > > You can set the bindings on the class side, but I currently don't see a
> > way
> > > to say "open this spec using these bindings."  In other words, something
> > > like:
> > >
> > > MyApplication new openWithSpecAndBindings: MorphicAdapterBindings.
> >
> > #openWithSpecLayout:
> > #buildWithSpecLayout:
> > and in layout #add:withSpec:
> 
> 
> How it will allow open MessageBrowser (based on Spec) on cocoa backend?

You would need to add cocoa-based layout for every model in the chain and then 
cross-reference them via #add:withSpec:, annoying, but should be possible.

Peter



Re: [Pharo-users] Spec Adapter Advice

2017-04-29 Thread Peter Uhnak
On Sat, Apr 29, 2017 at 09:22:46PM +0200, Denis Kudriashov wrote:
> Hi
> 
> 2017-04-29 20:36 GMT+02:00 Peter Uhnak <i.uh...@gmail.com>:
> 
> > No, it is not. It has hard wired bindings from certain names to morphic
> > adapters, but only if you don't actually specify the target calss.
> > In other words, if in your #specLayout you specify a name that has a
> > binding, then the binding will be used; if there is no such binding, then
> > the class will be instantiated directly.
> >
> > So for example if you specify:
> > * LabelAdapter -> there is binding from LabelAdapter to
> > MorphicLabelAdapter, so MorphicLabelAdapter will be instantiated
> > * MorphicLabelAdapter -> there are no bindings for this name, so it will
> > be instantiated directly
> > * CocoaLabelAdapter -> there are no bindings for this name, so it will be
> > instantiated directly
> >
> 
> But we should not reference directly platform specific widgets when we
> define spec layout. Otherwise we will be forced to copy every layout method
> (like #defaultSpec) for each platform.
> And it breaks goal of Spec to be able open application with different
> backends without code modification.
> 
> I am sure you know what I wrote. So probably I not understand what you mean.

I was describing how it is possible to do it _now_, not how it ideally should 
be done (because there's no other way right now)... we will change this, 
because we will also need a better way for Bloc.

So Pharo7 again :)

Peter



Re: [Pharo-users] Spec Adapter Advice

2017-04-29 Thread Peter Uhnak
On Fri, Apr 28, 2017 at 04:20:57PM -0400, Rob Rothwell wrote:
> Hi Peter,
> 
> However, I have discovered by creating new ComposableModel, WindowModel,
> and MorphicWindowAdapter classes that even the SpecInterpreter itself is
> hard-wired to use Morphic.

No, it is not. It has hard wired bindings from certain names to morphic 
adapters, but only if you don't actually specify the target calss.
In other words, if in your #specLayout you specify a name that has a binding, 
then the binding will be used; if there is no such binding, then the class will 
be instantiated directly.

So for example if you specify:
* LabelAdapter -> there is binding from LabelAdapter to MorphicLabelAdapter, so 
MorphicLabelAdapter will be instantiated
* MorphicLabelAdapter -> there are no bindings for this name, so it will be 
instantiated directly
* CocoaLabelAdapter -> there are no bindings for this name, so it will be 
instantiated directly

> 
> If you take a look at
> 
> WindowModel>>privateAdapterFromModel: aModel withSpec: aSpec
> "apparently when looking at the implementation, it does not return a widget
> but an adapter so it should be called adapter :)"
> self halt.
> ^ SpecInterpreter private_buildWidgetFor: self withSpec: aSpec.
> 
> You see from the correct comment that an adapter is created during this
> operation, which I think (I'm not that far yet) comes from

This comment just adds more confusion to people that don't understand what is 
going on. From Spec perspective widget is the same as adapter (so the name is 
just fine), and during SpecInterpreter execution both adapter and the final 
widgets are created. The naming is not wrong, but the same word (widget) means 
different things in different contexts, so it is confusing.

> 
> SpecInterpreter class>>defaultBindings
> ^ MorphicAdapterBindings new
> 
> In other words, I think that regardless of WindowModel class>>adapterName
> (and presumably all other "Model" classes, the actual adapter used is at
> present determined by the SpecInterpreter via
> MorphicAdapterBindings>>initializeBindings.

You should go re-read my original answer where I explained how you can do 
exactly that...

> 
> You can set the bindings on the class side, but I currently don't see a way
> to say "open this spec using these bindings."  In other words, something
> like:
> 
> MyApplication new openWithSpecAndBindings: MorphicAdapterBindings.

#openWithSpecLayout:
#buildWithSpecLayout:
and in layout #add:withSpec:

See the spec booklet section 4.3. where you can see how #add:withSpec: can be 
used (I've also mentioned this in one of the previous comments)

Peter



Re: [Pharo-users] Spec Adapter Advice

2017-04-28 Thread Peter Uhnak
On Fri, Apr 28, 2017 at 11:50:48AM +0200, Denis Kudriashov wrote:

> In fact they are not adapters. They are factories which creates backend
> views (morphs). And now there are completely no logic behind them: every
> adapter just passes state received from model to view instance.

This depends heavily on what the respective APIs provide.

In TabAdapter I connect SpecTab and MorphicTab directly, so it no longer lives 
during runtime.

In LabelAdapter the emphasis is being transcoded from symbol to random numbers 
(so this is not simple delegation)
In MenuItemAdapter you can see much more behavior.

So the naming is appropriate, but it is overall poorly connected.

> Now Spec allows very restricted relationship between model and view. We can
> only have single kind of view per model (MorphicAdapterBindings defines
> this relation). There is no way to use different kind of views for same
> model in single application.

As I've shown in my previous answer this is not the case. The connection is 
done via the class-side spec method where you can specify any class at all; 
MorphicAdapterBindings is just a convenience, you can put there whatever you 
want.

Likewise when you are composing widgets, you can specify what layout to use, 
something like (don't remember the precise naming out of my head)

^ SpecRowLayout composed add: #textModel withSpec: #cocoaSpec

> But it not works.

I've used it several times so it does work, if you had troubles then maybe it 
doesn't work with all models.

> Now you can imaging that if we always use same view class for same model
> class then we can directly ask model to instantiate view. Message can be
> backend specific like createMorphicView: and we need hierarchy of backends
> here which will choose appropriate message.

Which is exactly what we do not want, to directly bind model to the view; but I 
feel I am missing your point, can you rephrase it please?

> 
> P.S. Every time I read word model in Spec I feel something bad. It should
> be named to presenter. But it is quite difficult due to compatibility. And
> I am not sure that others agree with this.

When you go the the internals, then depending on the context spec can mean: 
spec layout, adapter, spec model; and in some parts all contexts overlap, so 
it's fun to read. :)


Now Pharo 7 will have new SpecInterpreter (it took me two weeks and I've 
created two extra tools to understand the old one and there are still some 
special exceptions), so then we can rethink the way it is done.

Peter

> 
> 2017-04-28 0:04 GMT+02:00 Peter Uhnak <i.uh...@gmail.com>:
> 
> > Hi Rob,
> >
> > I guess the best resource at the moment is to just look at existing
> > adapters.
> >
> > But here are some thoughts to get you started:
> >
> > (Spec) ComposableModel has as its widget (Spec) Adapter
> > Adapter has as its widget the actual visual component, which currently
> > means Morphic.
> >
> >
> > The simplest example: LabelModel
> >
> > 1. model to adapter
> >
> > LabelModel is adapted by MorphicLabelAdapter:
> >
> > you can see on the class side in method `defaultSpec`.
> > There is only `LabelAdapter` there because there is some extra mapping for
> > some classes, but you can specify directly the class of the Adapter, so the
> > following would work just as well:
> >
> > LabelModel class>>defaultSpec
> > 
> >
> > ^ #(MorphicLabelAdapter
> > adapt: #(model))
> >
> >
> > LabelModel -> LabelAdapter direct event propagation (pushing changes)
> >
> > in Model world you can call changed:with: to execute code on the Adapter,
> > e.g.
> >
> > self changed: #emphasis: with: {emphasis}
> >
> > which in turn will call the #emphasis: method on the LabelAdapter.
> >
> > LabelModel -> LabelAdapter events (pulling changes)
> >
> > preferred alternative is to do the opposite; properties of models are
> > often held in ValueHolders, which can be observed on ValueChange, so the
> > Adapter can register to event change and react on itself;
> >
> > you can see this best in MorphicTabAdapter (but you will see that
> > TabAdapter looks a bit different from the rest, because I was experimenting
> > with cleaning up Adapters...)
> >
> > 2. adapter to morphic
> >
> > Every adapter implements #buildWidget method that returns a Morphic Object.
> > Typically the adapter registers itself as the model of the adapter (so
> > adapter's model is Spec, and Morphic's model is the adapter). This depends
> > a lot on the API of morphic. (in TabAdapter I'm overriding adapt: so
> > there's no buildWidget, and it is in #buildWi

Re: [Pharo-users] Spec Adapter Advice

2017-04-28 Thread Peter Uhnak
Hi Rob,

> I need to find a good starting point because you can't poke at the existing
> code too much since even the debugger is built with Spec!

I don't know what Pharo you are on, but this is not the case. Debugger itself 
is based on Glamour (there used to be SpecDebugger, but it is no longer used).

What is blowing up on you is the predebugger window, which is in Spec. You can 
disable this in your settings or by calling

GTGenericStackDebugger alwaysOpenFullDebugger: true

this will skip the debugger.

But keep in mind that other tools might be using spec too (like the Browser 
window that opens when you are listing senders/implementors.

overriding the #windowClass (or whatever the name was) is a good start.

(also FML because apparently I've deleted my image with my spec changes by 
accident -_-)

Peter

> 
> It's pretty exciting, though, because it feels like all the right pieces
> are there and a lot of this could mostly be "just work" once I get going.
> 
> Thanks again,
> 
> Rob
> 
> On Thu, Apr 27, 2017 at 6:04 PM, Peter Uhnak <i.uh...@gmail.com> wrote:
> 
> > Hi Rob,
> >
> > I guess the best resource at the moment is to just look at existing
> > adapters.
> >
> > But here are some thoughts to get you started:
> >
> > (Spec) ComposableModel has as its widget (Spec) Adapter
> > Adapter has as its widget the actual visual component, which currently
> > means Morphic.
> >
> >
> > The simplest example: LabelModel
> >
> > 1. model to adapter
> >
> > LabelModel is adapted by MorphicLabelAdapter:
> >
> > you can see on the class side in method `defaultSpec`.
> > There is only `LabelAdapter` there because there is some extra mapping for
> > some classes, but you can specify directly the class of the Adapter, so the
> > following would work just as well:
> >
> > LabelModel class>>defaultSpec
> > 
> >
> > ^ #(MorphicLabelAdapter
> > adapt: #(model))
> >
> >
> > LabelModel -> LabelAdapter direct event propagation (pushing changes)
> >
> > in Model world you can call changed:with: to execute code on the Adapter,
> > e.g.
> >
> > self changed: #emphasis: with: {emphasis}
> >
> > which in turn will call the #emphasis: method on the LabelAdapter.
> >
> > LabelModel -> LabelAdapter events (pulling changes)
> >
> > preferred alternative is to do the opposite; properties of models are
> > often held in ValueHolders, which can be observed on ValueChange, so the
> > Adapter can register to event change and react on itself;
> >
> > you can see this best in MorphicTabAdapter (but you will see that
> > TabAdapter looks a bit different from the rest, because I was experimenting
> > with cleaning up Adapters...)
> >
> > 2. adapter to morphic
> >
> > Every adapter implements #buildWidget method that returns a Morphic Object.
> > Typically the adapter registers itself as the model of the adapter (so
> > adapter's model is Spec, and Morphic's model is the adapter). This depends
> > a lot on the API of morphic. (in TabAdapter I'm overriding adapt: so
> > there's no buildWidget, and it is in #buildWidgetWith:).
> >
> > It is all kinds of messy, but if you have other widgets then it will be a
> > good test how well Spec can handle it... or rather we'll see how it can be
> > improved...
> >
> > Peter
> >
> >
> >
> > On Thu, Apr 27, 2017 at 05:10:39PM -0400, Rob Rothwell wrote:
> > > Hello,
> > >
> > > I have recently been lucky enough to get the Cocoa portion of Mars
> > working
> > > on Pharo 5.0.  While there are some issues, it has a wonderful set of
> > > examples that allowed me create new Cocoa classes and delegate methods
> > and
> > > see a straightforward path to learning how to use Coco widgets from
> > Pharo.
> > >
> > > I'd like to do that by creating appropriate Spec adapters, but
> > > unfortunately the new Spec booklet wasn't designed for that!
> > >
> > > Can anyone give me any insight into creating (and using) a new Spec
> > > adapter?  Maybe just some high level steps to help me orient my
> > > investigation into how Spec works?
> > >
> > > Thank you,
> > >
> > > Rob
> >
> >



Re: [Pharo-users] Spec Adapter Advice

2017-04-27 Thread Peter Uhnak
Hi Rob,

I guess the best resource at the moment is to just look at existing adapters.

But here are some thoughts to get you started:

(Spec) ComposableModel has as its widget (Spec) Adapter
Adapter has as its widget the actual visual component, which currently means 
Morphic.


The simplest example: LabelModel

1. model to adapter

LabelModel is adapted by MorphicLabelAdapter:

you can see on the class side in method `defaultSpec`.
There is only `LabelAdapter` there because there is some extra mapping for some 
classes, but you can specify directly the class of the Adapter, so the 
following would work just as well:

LabelModel class>>defaultSpec


^ #(MorphicLabelAdapter
adapt: #(model))


LabelModel -> LabelAdapter direct event propagation (pushing changes)

in Model world you can call changed:with: to execute code on the Adapter, e.g.

self changed: #emphasis: with: {emphasis}

which in turn will call the #emphasis: method on the LabelAdapter.

LabelModel -> LabelAdapter events (pulling changes)

preferred alternative is to do the opposite; properties of models are often 
held in ValueHolders, which can be observed on ValueChange, so the Adapter can 
register to event change and react on itself;

you can see this best in MorphicTabAdapter (but you will see that TabAdapter 
looks a bit different from the rest, because I was experimenting with cleaning 
up Adapters...)

2. adapter to morphic

Every adapter implements #buildWidget method that returns a Morphic Object.
Typically the adapter registers itself as the model of the adapter (so 
adapter's model is Spec, and Morphic's model is the adapter). This depends a 
lot on the API of morphic. (in TabAdapter I'm overriding adapt: so there's no 
buildWidget, and it is in #buildWidgetWith:).

It is all kinds of messy, but if you have other widgets then it will be a good 
test how well Spec can handle it... or rather we'll see how it can be 
improved...

Peter



On Thu, Apr 27, 2017 at 05:10:39PM -0400, Rob Rothwell wrote:
> Hello,
> 
> I have recently been lucky enough to get the Cocoa portion of Mars working
> on Pharo 5.0.  While there are some issues, it has a wonderful set of
> examples that allowed me create new Cocoa classes and delegate methods and
> see a straightforward path to learning how to use Coco widgets from Pharo.
> 
> I'd like to do that by creating appropriate Spec adapters, but
> unfortunately the new Spec booklet wasn't designed for that!
> 
> Can anyone give me any insight into creating (and using) a new Spec
> adapter?  Maybe just some high level steps to help me orient my
> investigation into how Spec works?
> 
> Thank you,
> 
> Rob



Re: [Pharo-users] MOOC offline download

2017-04-27 Thread Peter Uhnak
Everything is also on github so you can clone it locally 
https://github.com/SquareBracketAssociates/PharoMooc

On Thu, Apr 27, 2017 at 11:50:22PM +0800, Ben Coman wrote:
> I was just chatting with someone with limited Internet who was looking to
> odownload the mooc files [1] for use offline.  Does such exist?
> 
> [1]  http://files.pharo.org/mooc
> 
> cheers -ben



Re: [Pharo-users] Sending byte array in a JSON format

2017-04-26 Thread Peter Uhnak
It is also possible that ZnEasy is doing some encoding transformations that 
breaks it; after all, you are retrieving binary data as text data, so encoding 
should be applied on it.

Peter

On Wed, Apr 26, 2017 at 04:50:04PM +0200, Sven Van Caekenberghe wrote:
> I am puzzled by how they actually encoded the PNG as a String, I tried a 
> couple of alternatives but I could not get binary data out of it so that it 
> parsed successfully as PNG.
> 
> If I would have to encode binary data in JSON I would use Base64 encoding 
> (but alternatives exist).
> 
> > On 24 Apr 2017, at 20:36, Juraj Kubelka  wrote:
> > 
> > Hi,
> > 
> > I was playing with GitHub Gist API and I have queried the following Gist: 
> > https://gist.github.com/mbostock/5503544
> > I was interested how the PNG image is returned: 
> > https://gist.github.com/mbostock/5503544#file-thumbnail-png 
> > 
> > I can obtain the whole Gist executing:
> > 
> > STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get).
> > 
> > I can get PNG contents executing:
> > 
> > pngData := (ZnEasy get:
> > STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get)) at: 'files') at: 'thumbnail.png') at: 'raw_url')) 
> > contents.
> > PNGReadWriter formFromStream: rawPng readStream.
> > 
> > But the PNG image is part of the Gist query and can be retrieved by:
> > 
> > pngContent := STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get)) at: 'files') at: 'thumbnail.png') at: 'content').
> > 
> > "As pngContent is a WideString, I cannot use:"
> > PNGReadWriter formFromStream: pngContent readStream.
> > 
> > How can I read the PNG image from the pngContent? Any idea? 
> > And the reverse question: How can I send the PNG bytes using JSON format? 
> > 
> > Thanks!
> > Juraj
> > 
> 
> 



Re: [Pharo-users] Sending byte array in a JSON format

2017-04-26 Thread Peter Uhnak
Maybe the content is not properly stored in the JSON on github' side? But you 
can use base64 in `accept:` to make it work.

json := STONJSON fromString: (ZnClient new
  url: 'https://api.github.com/gists/5503544';
  accept: 'application/vnd.github.v3.base64+json';
  get).
b64 := ((json at: 'files') at: 'thumbnail.png') at: 'content'.
PNGReadWriter formFromStream: (Base64MimeConverter mimeDecodeToBytes: content 
readStream).

Peter


On Wed, Apr 26, 2017 at 04:50:04PM +0200, Sven Van Caekenberghe wrote:
> I am puzzled by how they actually encoded the PNG as a String, I tried a 
> couple of alternatives but I could not get binary data out of it so that it 
> parsed successfully as PNG.
> 
> If I would have to encode binary data in JSON I would use Base64 encoding 
> (but alternatives exist).
> 
> > On 24 Apr 2017, at 20:36, Juraj Kubelka  wrote:
> > 
> > Hi,
> > 
> > I was playing with GitHub Gist API and I have queried the following Gist: 
> > https://gist.github.com/mbostock/5503544
> > I was interested how the PNG image is returned: 
> > https://gist.github.com/mbostock/5503544#file-thumbnail-png 
> > 
> > I can obtain the whole Gist executing:
> > 
> > STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get).
> > 
> > I can get PNG contents executing:
> > 
> > pngData := (ZnEasy get:
> > STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get)) at: 'files') at: 'thumbnail.png') at: 'raw_url')) 
> > contents.
> > PNGReadWriter formFromStream: rawPng readStream.
> > 
> > But the PNG image is part of the Gist query and can be retrieved by:
> > 
> > pngContent := STONJSON fromString: 
> > (ZnClient new
> > url: 'https://api.github.com/gists/5503544';
> > accept: 'application/vnd.github.v3+json';
> > get)) at: 'files') at: 'thumbnail.png') at: 'content').
> > 
> > "As pngContent is a WideString, I cannot use:"
> > PNGReadWriter formFromStream: pngContent readStream.
> > 
> > How can I read the PNG image from the pngContent? Any idea? 
> > And the reverse question: How can I send the PNG bytes using JSON format? 
> > 
> > Thanks!
> > Juraj
> > 
> 
> 



[Pharo-users] Epicea vs RB refactorings

2017-04-26 Thread Peter Uhnak
Hi,

I'm under the impression that Epicea is supposed to replace RB refactorings at 
some point.

If that is true, is it currently possible to build refactorings by hand?

For example in RB I often do:

```
model := RBNamespace new.

model defineClass: ('<1s> subclass: #<2s>instanceVariableNames: 
<3p>classVariableNames: poolDictionaries: category: 
<4p>' expandMacrosWith: 'Object' with: 'MySomething' with: 'var1 var2' with: 
'MyPackage').
cls := model classNamed: #MySomething.
cls compile: 'var1
^ var1' classified: 'accessing'.

(ChangesBrowser changes: model changes changes) open
```

or

(removing a method from a class)
```
model := RBNamespace new.
model removeMethod: #testTrimRight from: StringTest.
(ChangesBrowser changes: model changes changes) open
```

Thanks,
Peter



[Pharo-users] improving audio/video quality of pharo days recordings

2017-04-25 Thread Peter Uhnak
Hi,

we had a small discussion on discord about improving the audio/video quality of 
recordings of past pharo days, where many recordings are really hard to see (or 
completely unreadable), or the presenter is really hard to understand 
(especially if they speak quietly or have a strong accent).

Obviously making really good recordings requires several people to focus on it 
(which is hard on a small meetup), however two things could be imho introduced 
that could help a lot, with little demand on attendees.

1) clip-on microphone
* camera's mic will not capture good sound from 10 meters away over a 
crowd of people making noises
2) VGA recorder (which goes between the presenter's computer and projector)
* then we would have crisp video and not relying on the quality of the 
camera

in fact this is very common format where in the final video you see primarily 
the VGA output, and not camera capture from a distance (only on the presenter), 
e.g. https://www.youtube.com/watch?v=XA2WjJbmmoM

Unfortunately I am not attending Pharo Days this year (scheduling conflict), so 
I can't help on-site, but I could help with post-processing where possible, 
e.g. converting the raw audio/video/VGA streams into one (as in the linked 
video) or something.

Peter



Re: [Pharo-users] Hot to retrieve values from Nested Dictionaries

2017-04-24 Thread Peter Uhnak
Maybe we could introduce `@` message, so one can chain them and then even 
execute keyword without parenthesis

Dictionary>>@ aKey
^ at: aKey


dict @ 'key1' @ 'key2' @ 'key3'
dict @ 'key1' @ 'key2' @ 'key3' select: [ :each | ... ]

I'm always adding this when hacking around, maybe we could have it in Pharo.

Peter

On Mon, Apr 24, 2017 at 02:48:48PM -0300, Juraj Kubelka wrote:
> 
> > On Apr 24, 2017, at 14:42, Markus Böhm  wrote:
> > 
> > May I ask:
> > What's the idiomatic way to retrieve values from nested dictionaries?
> > 
> > (((dict1 at: 'key1') at: 'key2') at: 'key3')
> > 
> > Are all the brackets really necessary?
> 
> I think so, without the parenthesis, it is interpreted as one message 
> at:at:at:
> 
> If you use it a lot, you may want to convert the dictionary structure into 
> domain objects.
> 
> Juraj
> 
> > 
> > BR Mike
> 
> 



Re: [Pharo-users] Octal multiplication

2017-04-23 Thread Peter Uhnak
On Sun, Apr 23, 2017 at 06:13:42AM -0700, nacho wrote:
> Hello,
> This could sound like a dumb question, it may be.
> If I print:
> 8r3 * 8r3 I get 9.
> It seems that Pharo converts first to decimal and then performs the
> multiplication. How do I get the result in octal which should be 8r11?


#printStringRadix: base

(8r3 * 8r3) printStringRadix: 8 "-> 8r11"

for hex there's also

#hex

12 hex "-> 16rC"

Peter


> Thanks!
> 
> 
> 
> 
> -
> Nacho
> Smalltalker apprentice.
> Buenos Aires, Argentina.
> --
> View this message in context: 
> http://forum.world.st/Octal-multiplication-tp4943364.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 



Re: [Pharo-users] best practices for using external files for testing

2017-04-18 Thread Peter Uhnak
I think the best way would be to profile it I guess, or try all options...

my idea was that I will keep with the repo (because I don't want to pull 
off-site resources every time the test suite runs (e.g. on travis), and at the 
same time I didn't want to make the source code big... but I guess I could also 
download the file from the repo itself (if it won't be accessible locally...) 
which I guess would make most sense.

Thank you all for ideas. :)

Peter


On Mon, Apr 17, 2017 at 09:09:15AM -0300, Hernán Morales Durand wrote:
> Hi Peter,
> 
> In BioSmalltalk I download and extract all test files in the Configuration
> and then use a method in abstract test class to access test files.
> Cheers,
> 
> Hernán
> 
> 
> 2017-04-15 13:52 GMT-03:00 Peter Uhnak <i.uh...@gmail.com>:
> 
> > Hi,
> >
> > is there a common/best practice for using external files in tests?
> >
> > In my specific case I am interested in git-based projects, where I have a
> > big (~1MB) file stored in repository and I would like to use it in my tests.
> >
> > For GitFileTree project I could presumably use the following to access it:
> >
> > 'OP-XMI' asPackage mcPackage workingCopy repositoryGroup remotes first
> > directory / 'tests' / 'my-test-file.xmi'
> >
> > This will retrieve the MCPackage of the Package and then retireve where it
> > the repo is actually stored on the disk.
> >
> > Are there better ways to do this? Could something similar be done with
> > IceBerg?
> >
> > (p.s. in theory I could compile the entire file (e.g. 1MB) to a method,
> > but that is very ugly to me)
> >
> > Thanks,
> > Peter
> >
> >



Re: [Pharo-users] Exporting Packages to Cincom Smalltalk (VisualWorks)

2017-04-18 Thread Peter Uhnak
Ah, I forgot about that one. (I've seen it before I wrote mine, but I didn't 
like some things iirc... like using string cocats instead of XMLWriter etc)

Peter

On Mon, Apr 17, 2017 at 04:42:52PM -0300, Esteban A. Maringolo wrote:
> Thank you Peter.
> 
> Alexandre Bergel pointed me to Roassal export classes, which does
> something similar to the code you pointed me to (yours seems more
> tidy).
> 
> Thanks again,
> 
> Esteban A. Maringolo
> 
> 
> 2017-04-17 12:57 GMT-03:00 Peter Uhnak <i.uh...@gmail.com>:
> > Some time ago I hacked together a very simple thing that generates VW XML 
> > from code represented in Moose/UML... I guess you could use it as a 
> > starting point: 
> > https://github.com/OpenPonk/class-editor/tree/master/repository/UML-CodeGenerator.package/UCMVWXmlExporter.class
> >
> > Also take a look at SIF (which is quite easy to use on both Pharo and VW 
> > side):
> >
> > * https://github.com/peteruhnak/sif
> > * https://github.com/peteruhnak/sif/blob/master/docs.md
> > * http://www.samadhiweb.com/blog/2016.01.06.sif.html
> > * http://www.pocketsmalltalk.com/sif/
> >
> > Peter
> >
> > On Mon, Apr 17, 2017 at 10:37:52AM -0300, Esteban A. Maringolo wrote:
> >> Is there any exporter than can convert an RPackage into a VW Parcel
> >> (.pst), in XML or Chunk format?
> >>
> >> I need to migrate a few libraries of my own and couldn't find
> >> anything, so I'm asking before start writing something :)
> >>
> >> Regards!
> >>
> >> Esteban A. Maringolo
> >>
> >
> 



Re: [Pharo-users] How childrenBlock: in TreeModel works

2017-04-17 Thread Peter Uhnak
I guess something like this could work...

```
d := { 
Dictionary
with: #n -> 'whatever'
with: #d -> {
Dictionary with: #a -> #AA with: #b -> #BB.
Dictionary with: #c -> #CC with: #d -> #DD
}.

Dictionary
with: #n -> 'wherever'
with: #d -> {
Dictionary
with: #a -> #AA
with: #b -> #BB.
Dictionary with: #c -> #CC with: #d -> #DD
}.
}.

TreeModel new 
roots: d;
childrenBlock: [ :item |
item isDictionary
ifTrue: [
item associations flatCollect: [ :pair |
pair value isArray
ifTrue: [ pair value ]
ifFalse: [ {pair} ].
]
]
ifFalse: [ #() ]
];
openWithSpec
```

but forcing this much behavior is a bad practice... because it's hard to read, 
hard to understand, and hard to test.

So I suggest using custom classes as nodes (so each node can simply tell what 
its children are), and then delegate the retrieval... you could also add 
extension methods to the respective classes' protocols to acheive the same...

TreeModel new
childrenBlock: [ :item |
item children
];
displayBlock: [ :item |
item name
]

Peter


On Mon, Apr 17, 2017 at 09:12:47AM -0700, chrismihaylyk wrote:
> Hello!
> 
> Could anyone help me, please?
> 
> I have faced with a problem of TreeModel childrenBlock: for more complex
> build in structure.
> 
> For example, I have anOrderedCollection of Dictionary, and in each
> dictionary, there are exist associations, which values are 
> anArray(aDictionary, aDictionary ...).
> 
> I need to make drop downs for all of these entire levels of arrays and
> dictionaries.
> For first level I made it:
> 
> collectionsList
>   ifNil: [ ^ nil ]
>   ifNotNil: [ collectionsList hasChildrenBlock: [ :item | item
> isMyDictionary. ].
>   collectionsList
>   childrenBlock: [ :item | item associations
>   collect: [ 
> :assoc | 
>   assoc 
> key asString , '  ->  ' , assoc value asString. ] ] ]
> 
> MyDictionaly is the class, inherited from Dictionary, just to override
> method printOn:
> 
> At the first picture, it's how it looks like, how I made it. 
> At the second - how I expect it to be (taken from Inspector window).
> 
> Thanks a lot!
>  
>  
> 
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/How-childrenBlock-in-TreeModel-works-tp4940884p4942409.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 



Re: [Pharo-users] best practices for using external files for testing

2017-04-17 Thread Peter Uhnak
On Mon, Apr 17, 2017 at 12:56:42PM +, Dimitris Chloupis wrote:
> 1 mb is not big for git , 1 gb is. It's small.

I meant big for Pharo/to be compiled as a method source code, i.e. 
Something>>xmlFile ^ ' ... 1MB of string...'

> 
> I version control blender files of 100-500mbs with ease . Git is always
> very fast.
> 
> I have used image files (PNG) for my project ChronosManager ,it fetches
> them together with the repo, they sit in their own image folder inside the
> repo folder that contains the code . I then open them with a path I get
> using filesystem currentdirectory method and then I navigate inside the
> folder searching using the name of folderminside the github-cache
> subfolder. You can find the code in that project.
> 
> Don't know if that is the best way to do this , it works for me. I also
> check to make sure that images are not already loaded in the image because
> git may be fast but Pharo is very slow when loading PNG files. I load them
> once and save the image in them and I reload only if I change one of the
> PNGs.
> 
> I have also created a mechanism to detect whether there is an update in the
> github repo and only then pull the git repo. It's a cheap hack where I put
> version info in the README which I access online and parse. I have created
> this way an auto update API. I could fine tune it to provide precise meta
> data of which png is updated and fetch only that but I have not felt the
> need so far to do this.
> On Sat, 15 Apr 2017 at 19:52, Peter Uhnak <i.uh...@gmail.com> wrote:
> 
> > Hi,
> >
> > is there a common/best practice for using external files in tests?
> >
> > In my specific case I am interested in git-based projects, where I have a
> > big (~1MB) file stored in repository and I would like to use it in my tests.
> >
> > For GitFileTree project I could presumably use the following to access it:
> >
> > 'OP-XMI' asPackage mcPackage workingCopy repositoryGroup remotes first
> > directory / 'tests' / 'my-test-file.xmi'
> >
> > This will retrieve the MCPackage of the Package and then retireve where it
> > the repo is actually stored on the disk.
> >
> > Are there better ways to do this? Could something similar be done with
> > IceBerg?
> >
> > (p.s. in theory I could compile the entire file (e.g. 1MB) to a method,
> > but that is very ugly to me)
> >
> > Thanks,
> > Peter
> >
> >



Re: [Pharo-users] Exporting Packages to Cincom Smalltalk (VisualWorks)

2017-04-17 Thread Peter Uhnak
Some time ago I hacked together a very simple thing that generates VW XML from 
code represented in Moose/UML... I guess you could use it as a starting point: 
https://github.com/OpenPonk/class-editor/tree/master/repository/UML-CodeGenerator.package/UCMVWXmlExporter.class

Also take a look at SIF (which is quite easy to use on both Pharo and VW side):

* https://github.com/peteruhnak/sif
* https://github.com/peteruhnak/sif/blob/master/docs.md
* http://www.samadhiweb.com/blog/2016.01.06.sif.html
* http://www.pocketsmalltalk.com/sif/

Peter

On Mon, Apr 17, 2017 at 10:37:52AM -0300, Esteban A. Maringolo wrote:
> Is there any exporter than can convert an RPackage into a VW Parcel
> (.pst), in XML or Chunk format?
> 
> I need to migrate a few libraries of my own and couldn't find
> anything, so I'm asking before start writing something :)
> 
> Regards!
> 
> Esteban A. Maringolo
> 



[Pharo-users] best practices for using external files for testing

2017-04-15 Thread Peter Uhnak
Hi,

is there a common/best practice for using external files in tests?

In my specific case I am interested in git-based projects, where I have a big 
(~1MB) file stored in repository and I would like to use it in my tests.

For GitFileTree project I could presumably use the following to access it:

'OP-XMI' asPackage mcPackage workingCopy repositoryGroup remotes first 
directory / 'tests' / 'my-test-file.xmi'

This will retrieve the MCPackage of the Package and then retireve where it the 
repo is actually stored on the disk.

Are there better ways to do this? Could something similar be done with IceBerg?

(p.s. in theory I could compile the entire file (e.g. 1MB) to a method, but 
that is very ugly to me)

Thanks,
Peter



Re: [Pharo-users] Methods & Classes using the command line.

2017-04-13 Thread Peter Uhnak
This should be similar to having the code in playground and executing it at 
once. I guess it's more forgiving.

What I sometimes do to work around it is to store the created class into 
variable, or use symbol and asClass cast

e.g.

cls := Object subclass: #TestClass.
cls compile:'meth'.

or

Object subclass: #TestClass.
#TestClass asClass compile:'meth'.

Peter


On Thu, Apr 13, 2017 at 07:39:24PM +0200, Guillermo Polito wrote:
> Hi,
> 
> On Thu, Apr 13, 2017 at 6:57 PM, nacho <0800na...@gmail.com> wrote:
> 
> > Hi pharoers,
> >
> > If I do the following in a minimal Pharo image, using the command line:
> >
> > ./Pharo --headless Pharo.image eval "Object subclass: #TestClass
> > instanceVariableNames: 'one' classVariableNames: '' package: 'IS-Test'."
> >
> > I get the class created. However, if I try to pass the following argument
> > to
> > eval:
> >
> > "Object subclass: #TestClass instanceVariableNames: 'one'
> > classVariableNames: '' package: 'IS-Test'. TestClass compile:'one ^one'
> > classified: 'accessor'."
> 
> 
> > I get an UndefinedObject>>DoIt (TestClass is Undeclared).
> >
> 
> The problem is that the entire code is compiled at the same time. So, when
> the expression is compiled, the class TestClass does not exist yet. And
> what you see is a compiler warning.
> 
> However, as soon as the class is created, the class is available to the
> already compiled code and should work.
> 
> Moreover: if the TestClass was not created, you would have got an exception
> "nil does not understand compile:classified:" ;)
> 
> 
> >
> > At first I thought it could be that it takes sometime to compile the class,
> > so added some delay:
> >
> > "Object subclass: #TestClass instanceVariableNames: 'one'
> > classVariableNames: '' package: 'IS-Test'. (Delay forSeconds: 5) wait.
> > TestClass compile:'one ^one' classified: 'accessor'."
> >
> > But again: UndefinedObject>>DoIt (TestClass is Undeclared).
> >
> > I even tried to do:
> >
> > "Object subclass: #TestClass instanceVariableNames: 'one'
> > classVariableNames: '' package: 'IS-Test'. Smalltalk saveAndQuit."
> >
> > and after that add only a method by passing:
> >
> > "TestClass compile:'one ^one' classified: 'accessor'. Smalltalk
> > saveAndQuit."
> >
> 
> This is strange because, the class is created and you're saving the
> image... If I try:
> 
> ./pharo Pharo.image eval "Object subclass: #TestClass
> instanceVariableNames: 'one'
> classVariableNames: '' package: 'IS-Test'. TestClass compile:'one ^one'
> classified: 'accessor'. TestClass"
> 
> (note that I just aded *TestClass * at the end) I get the following output:
> 
> =>
> UndefinedObject>>DoIt (TestClass is Undeclared)
> 
> UndefinedObject>>DoIt (TestClass is Undeclared)
> TestClass
> 
> That is: two compiler warnings. + the class that is printed at the end.
> 
> So it's working well on my end, delta the confusing warnings.
> 
> 
> > But again: UndefinedObject>>DoIt (TestClass is Undeclared)
> >
> > How do I add a method to a class using the command line?
> > Thanks in advance
> > Nacho
> >
> >
> >
> > -
> > Nacho
> > Smalltalker apprentice.
> > Buenos Aires, Argentina.
> > --
> > View this message in context: http://forum.world.st/Methods-
> > Classes-using-the-command-line-tp4941977.html
> > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> >
> >



[Pharo-users] why is adding instance variables so slow?

2017-04-12 Thread Peter Uhnak
Hi,

does anyone know why adding instance variables is so slow?

I did some quick benchmarks (see below), resulting in more than order of 
magnitude speed difference between having it in the class definition and adding 
it later.

In fact it is still much faster to delete the class and then recreate it with 
the instance variables in the d efinition. For four arguments it is till 8x 
faster to delete the class four times and recreate it then just add the 
variable. Unfortunately I cannot just trash the classes (they have methods and 
inheritance).

So the question is: why is it so slow? can I somehow improve the performance?

Thanks,
Peter


Benchmarks:


[
cls := Object subclass: #Some1.
cls removeFromSystem.
] bench. "'91 per second'"

[
cls := Object subclass: #Some2 instanceVariableNames: 'variable'.
cls removeFromSystem
] bench. "'90 per second'"

[
cls := Object subclass: #Some3.
cls addInstVarNamed: 'variable'.
cls removeFromSystem.
] bench. "'7 per second'"

[
cls := Object subclass: #Some4.
cls removeFromSystem.
cls := Object subclass: #Some4 instanceVariableNames: 'variable'.
cls removeFromSystem.
] bench. "'43 per second'"




[
cls := Object subclass: #Some3.
cls addInstVarNamed: 'variable1'.
cls addInstVarNamed: 'variable2'.
cls addInstVarNamed: 'variable3'.
cls addInstVarNamed: 'variable4'.
cls removeFromSystem.
] bench. "'2 per second'"

[
cls := Object subclass: #Some4.
cls removeFromSystem.
cls := Object subclass: #Some4 instanceVariableNames: 'variable1 
variable2 variable3 variable4'.
cls removeFromSystem.
] bench. "'44 per second'"

[
cls := Object subclass: #Some5.
cls removeFromSystem.
cls := Object subclass: #Some5 instanceVariableNames: 'variable1'.
cls removeFromSystem.
cls := Object subclass: #Some5 instanceVariableNames: 'variable1 
variable2'.
cls removeFromSystem.
cls := Object subclass: #Some5 instanceVariableNames: 'variable1 
variable2 variable3'.
cls removeFromSystem.
cls := Object subclass: #Some5 instanceVariableNames: 'variable1 
variable2 variable3 variable4'.
cls removeFromSystem.
] bench. "'17.269 per second'"



Re: [Pharo-users] How childrenBlock: in TreeModel works

2017-04-01 Thread Peter Uhnak
Hi,

I wanted to point you to the new Spec book ( 
http://files.pharo.org/books-pdfs/spec/2017-01-23-SpecBooklet.pdf ), but 
apprently it's not there.

Many Spec widgets have examples accompanying them, so always check class side 
(not for all though). For TreeModel you can see couple there - good for playing 
around; e.g.

exampleWithNoSpecifiedNodes
"self exampleWithNoSpecifiedNodes"
TreeModel new
roots: (1 to: 5);
childrenBlock: [ :item | 1+item to: 5+item ];
openWithSpec

You specify the initial data (root nodes) via the `roots:` message.
The `childrenBlock:` then specifies how one would retrieve data given a 
particular node; note that this  applies to _any node_, not just the root ones; 
so you can have potentially infinitely deep trees.

A more complex example could be this (this is awful code for demonstration only 
;):

TreeModel new
roots: {#parent. #childless. 20. #root -> #(a b c)};
childrenBlock: [ :item |
item isSymbol ifTrue: [
item = #parent
ifTrue: [ #(child1 child2) ]
ifFalse: [ #() ]
] ifFalse: [
item isNumber
ifTrue: [ {item + 2. item ** 2} ]
ifFalse: [ "association" item value ]
]
];
openWithSpec


Peter

On Sat, Apr 01, 2017 at 06:49:41AM -0700, chrismihaylyk wrote:
> Hi!
> 
> Could anyone explain me how works childrenBlock: method from TreeModel?
> step-by-step.
> What data it operates? How makes a result?
> 
> Thanks a lot? Khrystyna.
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/How-childrenBlock-in-TreeModel-works-tp4940884.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 



Re: [Pharo-users] Morphic component to display images/pictures

2017-04-01 Thread Peter Uhnak
The mooc challenge (no #4) doesn't really address any of the things I am 
interested in (the result is the same as what inspector can currently do).

Spec has ImageModel, but that doesn't even have scrollbars...

anyway... I am currently refactoring Spec interpreter and after that I would 
like to improve some things... so maybe I could improve the ImageModel, since 
we don't have what I want...

Peter


On Sat, Apr 01, 2017 at 09:58:26AM +0200, Hilaire wrote:
> Just by curiosity: can it be done with Spec ?
> 
> Hilaire
> 
> Le 31/03/2017 à 08:16, Stephane Ducasse a écrit :
> > have a look at the solution of the challenge 2 or 3 in the mooc :)
> > 
> 
> -- 
> Dr. Geo
> http://drgeo.eu
> 
> 



[Pharo-users] Morphic component to display images/pictures

2017-03-30 Thread Peter Uhnak
Hi,

do we have a Morphic/Brick/whatever component for displaying pictures/images in 
Pharo?

The "best" I found was GTInspector extension on PNG files, which provides 
scrollbars, however I would like to also have:

1) zooming with mousewheel (now it scrolls vertically)
2) dragging the image around to scroll both vertically and horizontally (now I 
have to use manually the scrollbars)
3) ideally also buttons like "show 1:1 size", "show fit to window"

Do we have something like that?

Thanks,
Peter



Re: [Pharo-users] using UFFI in non-crashing way

2017-03-26 Thread Peter Uhnak
On Sun, Mar 26, 2017 at 05:45:04PM +0200, Esteban Lorenzano wrote:
> 
> > On 26 Mar 2017, at 15:40, Peter Uhnak <i.uh...@gmail.com> wrote:
> > 
> > Hi,
> > 
> > is it possible to use UFFI and avoid crashing the image when the called 
> > code segfaults?
> > 
> > In other words, can I somehow wrap the call and throw in-image 
> > Exception/Error on failure instead of the whole thing crashing?
> 
> that’s not possible, once you segfault, you segfault.

Ah, ok.

> 
> > Or is the only way to do that have the called thing running as a separate 
> > app (e.g. via OSSubProcess) and communicate via pipes or sockets?
> 
> that’s not done. 
> no idea how much effort is required to implement, but I imagine is not 
> trivial. 

Nono, I didn't mean making UFFI calls via socket (although that would be 
interesting), but rather making a C app that would make the calls, and that 
would provide a socket interface. (Which is what I typically do with other 
langs).

Thanks,
Peter



  1   2   3   >