[Pharo-users] Re: Easiest light weight cloud/web persistence for Pharo?

2020-10-06 Thread Esteban A. Maringolo
Hi Tim, 

I think that the persistence you choose will depend heavily on a few things:
- The complexity of the objects graphs in your domain models
- This architecture of your system
- How these objects/data is acceded (Atomically/In clusters)

In any case, for a lightweight solution you go the Fuel path, or something
using SQLite.

I have a GLORP based application (small, ~40 persisted classes), SQLite is
so lightweight that I run my SUnit tests creating the whole database _on
disk_ from scratch on setUp and destroying it on tearDown), and only run it
against the production backend (PostgreSQL) before deploying, but even this
is happening less frequently since I'm confident that things will work the
same on both.

OTOH I'm finding that ORMs are burden, and unless you need to work with an
existing schema or you really want to use an RDBMS, you might be better off
avoiding them. I've been using ORMs for almost two decades, so that's still
my default choice, but I feel winds of change here :-)

Regards!




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


Re: [Pharo-users] PharoLauncher "version determination error"

2018-10-02 Thread Esteban A. Maringolo
Thanks Sean,

Weird, I think I'm already running 1.4, because the downloaded setup
file was named pharo-launcher-1.4 (I'm downloading again just in case).

The about of my current version shows:
- PharoLauncher-Core-VincentBlondeau.184
- PharoLauncher-Spec-ChristopheDemarey.66
- PharoLauncher-Tests-Core-VincentBlondeau.24

Regards,

On 10/2/2018 9:09 PM, Sean P. DeNigris wrote:
> Esteban A. Maringolo wrote
>> Am I doing something wrong?
> 
> No. It was a bug that has been fixed. From Christophe in another thread:
>> The problem is probably fixed in the latest PharoLauncher version (1.4) 
>> available from http://pharo.org/download.
>> If not, as specified in the dialog text, please run the given command from 
>> the command line to give us more information on what is the problem.
> 
> 
> 
> -
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 

-- 
Esteban A. Maringolo



Re: [Pharo-users] Smalltalk Security Landscape - survey for ESUG 2018

2018-09-04 Thread Esteban A. Maringolo
Will the raw results be published?

Thanks!

On 30/08/2018 00:41, Jerry Kott wrote:
> Hello, just a reminder that the survey closes on August 31st. If you
> missed the announcement and would like to participate, you have a lasst
> chance.
> 
> Thank you all who gave their time to it.
> 
> *Jerry Kott*
> This message has been digitally signed. 
> PGP Fingerprint:
> A9181736DD2F1B6CC7CF9E51AC8514F48C0979A5
> 
> 
> 
>> On 13-08-2018, at 10:50 AM, Jerry Kott > <mailto:jk...@image-ware.com>> wrote:
>>
>> Dear Smalltalkers and friends,
>>
>> I am planning to have a presentation titled ‘Smalltalk Security
>> Landscape’ at this year’s ESUG conference. In my presentation I hope
>> to increase cybersecurity awareness within the Smalltalk community and
>> help shape the evolution of the language and its ecosystem.
>>
>> I have put together a survey to help me research the topic. I ask for
>> your kind help to get a picture of where Smalltalk stands in the area
>> of cybersecurity. The survey is completely anonymous, and should take
>> less than 15 minutes to complete. I appreciate your time and
>> participation.
>>
>> If you are in a management role, I would like your help by forwarding
>> this to your team members to help reach the broad Smalltalk community.
>>
>> Here is a link: https://www.surveymonkey.com/r/esug2018
>>
>> Thank you for your help, and hope to see you in Cagliari!
>>
>> *Jerry Kott*
>> This message has been digitally signed. 
>> PGP Fingerprint:
>> A9181736DD2F1B6CC7CF9E51AC8514F48C0979A5
>>
>>
>>
> 

-- 
Esteban A. Maringolo



signature.asc
Description: OpenPGP digital signature


Re: [Pharo-users] BS Web and Pharo

2018-08-06 Thread Esteban A. Maringolo
Ditto here, and I'm already subscribed to the newsletter!

So it's not only nagging, but also superfluous.

On 03/08/2018 21:42, Tim Mackinnon wrote:
> Yeah - that baby… I hate seeing it over and over… presumably its some js
> that a third part coughed up (badly).
> 
> Tim
> 
>> On 4 Aug 2018, at 00:05, Cédrick Béler > <mailto:cdric...@gmail.com>> wrote:
>>
>> I guess that one ...
>> As the general warning in cookies (grrr), or the gpdr or 
>> 
>>
>> Envoyé de mon iPhone
>>
>> Le 3 août 2018 à 22:17, Damien Pollet > <mailto:damien.pollet+ph...@gmail.com>> a écrit :
>>
>>> On Thu, 2 Aug 2018 at 18:15, Tim Mackinnon >> <mailto:tim@testit.works>> wrote:
>>>
>>>      the constant pestering to sign up for the Pharo newsletter.
>>>
>>>
>>> which pestering, where ? :confused: 
> 

-- 
Esteban A. Maringolo


Re: [Pharo-users] transactions on pharo objects

2018-08-02 Thread Esteban A. Maringolo
El mié., 1 de ago. de 2018 20:52, Richard Sargent <
richard.sarg...@gemtalksystems.com> escribió:

> Esteban A. Maringolo wrote
> > As a general purpose solution if you can do that, you end up
> > implementing a mini gemstone in Pharo :)
> >
> > But what's sure is that you should have a mini object-table of the
> > "touched" objects or do "explicit" registration of these objects like
> > GLORP allows you to do.
>
>
> It seems to me that the fundamental problem with the idea of registering
> each object with the transaction (or anything else) is that it requires
> white-box knowledge of what every invoked behaviour will do and touch. The
> above example is so minimal, it looks easy.
>

I agree with that. Deciding when to what to copy and what to preserve is
always tricky unless yo decide to copy the whole object graph which would
be terrible. Very much like what to proxy and what to forward in GemBuilder.

I think if you really want transactional Smalltalk, you need to use one
> designed expressly for that purpose.
> (And fortunately, there is one.)
>

That's why I say this is tricky and you'll probably end up implementing a
mini-GemStone.

I don't know what it means in terms of programming, but having a
transactional object memory would be a useful thing to work with.

Regards,

Esteban.


Re: [Pharo-users] transactions on pharo objects

2018-07-30 Thread Esteban A. Maringolo
El lun., 30 jul. 2018 a las 11:03, Sean P. DeNigris
() escribió:
>
> Peter Uhnák wrote
> > is there some library or approach how to do transactions… directly in
> > memory on Pharo
> > objects
>
> Magritte? It uses the Memento pattern to verify all changes before
> committing to real object.

But you need Magritte, and define descriptions, and references, and
access the objects via Magritte Accessors, etc.
I think that works for an UI of a somehow limited form, but not as a
general purpose (as I guess Peter is looking for).

Also for forms, but without metadata, Dolphin used a "BufferedModel"
object, which means that if you have an MVP/MVC, instead of using your
original model, you work on this "buffer", which internally has the
original and a copy, and all messages are sent to the copy and once
you "apply" the changes they are applied back to the original model,
and if you don't apply, the copy is discarded and the original model
left unmodified.

But again, I guess Peter is looking for something else.

Regards!



Re: [Pharo-users] transactions on pharo objects

2018-07-30 Thread Esteban A. Maringolo
I think it is a tricky thing to do "in memory transactions", even
without thinking about databases.
You have to define what to keep and where to place the "original"
values (inst. vars.) of the object.

As a general purpose solution if you can do that, you end up
implementing a mini gemstone in Pharo :)

But what's sure is that you should have a mini object-table of the
"touched" objects or do "explicit" registration of these objects like
GLORP allows you to do.

e.g.

| p |
p := Person new.
System transaction: [:tx |
  tx register: p.
  p name: 'Nobody'.
  p age: 70.
].

self assert: p name equals: 'Nobody'.
self assert: p age equals: 70.

I'm using System here, to make it compatible with GemStone.
#transaction: could be implemented in terms of #beginTransaction,
#commitTransaction and internally use #abortTransaction if an
unhandled Error is signalled.

Regards!

Esteban A. Maringolo
El lun., 30 jul. 2018 a las 10:17, Peter Uhnák () escribió:
>
> Hi,
>
> is there some library or approach how to do transactions in pharo?
> And I don't mean database transactions, but directly in memory on Pharo 
> objects... e.g.
>
> p := Person new.
>
> transaction do: [
> p name: 'Nobody'.
> p age: 70.
> ] on: Error do: [
> transaction rollback.
> ].
>
> self assert: p name equals: 'Nobody'.
> self assert: p age equals: 70.
>
> transaction do: [
> p name: 'Somebody'.
> p age: 1 / 0.
> ] on: Error do: [
> transaction rollback.
> ].
>
> self assert: p name equals: 'Nobody'.
> self assert: p age equals: 70.
>
> Any pointers appreciated.
>
> Thanks,
> Peter



Re: [Pharo-users] [ANN] Cryptography package on github

2018-07-23 Thread Esteban A. Maringolo
Good work Norbert. Thanks!



Esteban A. Maringolo

El lun., 23 jul. 2018 a las 8:59, Norbert Hartl () escribió:
>
> After several attempts to solve the Cryptography package problems over the 
> years I decided to move it on my own to github.
>
> What I did:
>
> - researched all authors and used the git migration tool to get the package 
> from smalltalkhub to github
> - released a version 0.1 that should be exactly the same as the code on 
> smalltalkhub for people that want to change
> - fixed an occurrence of IfNotNilDo: in the Cryptography package to make it 
> load in pharo7
> - added a metacello baseline
> - added a group „all" that loads everything like it is now with one package
> - added travis files and enable travis checks for pull requests
> - released a version 0.2 that contains the original code plus travis and 
> metacello
> - Started to cut off the ASN1, PKCS12 and X509 classes in separate packages
> - Added to each new package a -Tests package containing tests
> - constructed all dependencies in the baseline
> - added a core group that loads the now slimmed down package solely
>
> I must say this was really great with the help of promote-demote package tag 
> functionality and the dependency browser. The only thing missing is kind of a 
> tool to construct the metacello baseline. I miss Versionner here.
>
> What I didn’t do:
>
> - checking all the other packages in the repo. There are packages with old 
> style ffi calls and things that seem to be squeak dependent.
>
> I hope with the time and people’s complaints we can figure out what is 
> obsolete and what needs to be adjusted.
>
> The repository is now at
>
> https://github.com/zweidenker/Cryptography
>
> but I’m happy to move it to a better place if someone has an idea.
>
> Pull requests and tickets are welcome.
>
> Hope you like it,
>
> Norbert
>



Re: [Pharo-users] Request for Windows test

2018-07-13 Thread Esteban A. Maringolo
I tested it in Windows 7 Pro (English) with ES-Ar locale, and the app
launched perfectly in my local language.

I couldn't quickly figure out the app, but I played with the examples
and the app looks impressive. The performance is great on a pretty old
laptop.

Congratulations.

Regards,



On 11/07/2018 07:19, Hilaire wrote:
> Hi,
> 
> A Windows user reported to me difficulty to start Dr. Geo.
> 
> Although I had success to run it in a Windows system, I will be glad if
> some of you would mind testing it on their windows system, and report to
> me success or failure along the used Windows system.
> 
> -> http://www.drgeo.eu/download
> 
> Thanks a lot
> 
> Hilaire
> 

-- 
Esteban A. Maringolo



Re: [Pharo-users] Naming parameters - conventions?

2018-07-12 Thread Esteban A. Maringolo



On 11/07/2018 21:21, Sean P. DeNigris wrote:
> Paul DeBruicker wrote
>> It also seems like a "how much milk do you like in your coffee?" choice
>> where the tradeoffs between one vs the other isn't high and the code in
>> action will let you know whether you've got it right.   
> 
> +1. I also use both. My heuristic is for shorter methods, and methods with
> one argument, I tend to lean toward fullNameString and when I need to
> differentiate multiple arguments or reference the arg way down in a method
> (probably a good sign to refactor) I lean the other way. But I think Paul
> said it best that it's probably more a personal style/aesthetic choice than
> anything worth spending a lot of energy on.

+1 to both.

Although a in method like: #setFirstName:lastName: I usually use
firstNameString and lastNameString respectively, mostly to not clash
with instance variables firstName and lastName.

Another criteria is to never name a parameter as aSomething if Something
isn't a class (and of course the class of the passed argument). The same
applies to #asSomething.

And _never_ use anObject as name, unless it really can hold any class of
object.


-- 
Esteban A. Maringolo



Re: [Pharo-users] Smalltalk Programming Competition

2018-06-21 Thread Esteban A. Maringolo
On 21/06/2018 07:23, horrido wrote:
> I'm disappointed in the response. Only two contributors of $100 each. This is
> extremely tepid.
> 
> There must be thousands of Smalltalkers around the world. How to reach out
> to them? It can't be that hard to fund this contest. I mean, there are many
> stupid causes on GoFundMe that have raised tens of thousands of dollars!
> This Smalltalk programming competition is anything but stupid.
> 
> If only 1500 Smalltalkers each contributed a paltry $20, the contest would
> be fully funded. It would only take 300 contributors of $100 each.
I think that money is the wrong incentive to get people involved.

You can't pay students to get them converted. Massive propagation of
ideas these days are horizontal rather than vertical. It is, breadth
first, word of mouth, instead of authoritative articles, this kind of
competition, etc. Your articles did a good job of rising awareness, but
there is a lot missing.

If you want to get MORE (quantity) people involved, you need to make
Pharo more "pop cultured" as many mainstream tools are seen, and that
itself means becoming more mainstream or follow certain practices, which
also means having success stories people would like to imitate, etc.

Even if we get people like Kent Beck, Martin Fowler, any other
"influencer" aware of the benefits of Smalltalk to recommend it, the
downloads would spike, but I bet one leg the users will bounce as fast
as they download it.

IMO if we don't understand that as a community, Pharo will still have
it's niche user base. Not that I dislike it, but I would be more
comfortable as a niche but with a bigger user base.

Regards,

-- 
Esteban A. Maringolo



Re: [Pharo-users] Why doesn't Iceberg checkin other assets (scripts) but does check them out?

2018-06-18 Thread Esteban A. Maringolo
On 15/06/2018 20:00, Tim Mackinnon wrote:
> Phew - I can confirm that (unsurprisingly I guess) - just committing in
> Iceberg (without ticking - push changes to origin/master) does then let
> you easily overlay the same checked out project (typically
> ./iceberg/ProjectName) in a tool like VSCode or IntelliJ where you can
> then also commit further changes to files that Iceberg is ignoring
> (essentially everything not in the src directory - typically candidates
> would be your Readme.md file and possibly a ./scripts or ./assets
> directory).

That could work as a *workaround* to a design decision that made the
image the "staging" of a git commit.

> In that other tool you can then issue a push which will then atomically
> push all commits to a pipeline. It can be a little more tricky to
> understand what the pipeline is building - in Gitlab it will show you
> the comment of the most recent commit in the pipeline, however if you
> then click on the branch the pipeline is running on, you will get a list
> of commits and can see all the commits that are between the running
> pipeline and the previously run pipeline.
> 
> For many of you - this might be pleadingly obvious - but when you have a
> different workflow mindset in your head, it might be trickier to spot
> this subtlety.

But it's not what I'd expect when using git, in particular if you use
commit commands and/or CI, because if you add a comment like like "Fixes
Issue #2345" in your Iceberg commit, then your secondary commit (the one
done "externally" will look detached, you should replicate the commit
comment, so your CI will show the comment of the commit on which it's
building, etc.

Git favors small commits, but other tools expect atomic commits. They're
not exclusive.

> p.s. Thanks for all the useful debate in this thread. I should add that
> when I wrote “I’ll shut up” - a meant more that I felt the conversation
> was going in a cycle and repeating itself, not that I was offended or
> frustrated. I can probably live with the above nuance for my desire for
> atomic commits.

We're grown ups trying to improve Pharo, so unless stated otherwise or
clear agressions are visible (ad-hominems, passive agressiveness, etc.),
it's healthier to assume all comments are honest, constructive and with
good intentions.

Let's avoid the meta-disussion. :)


Regards,

-- 
Esteban A. Maringolo



Re: [Pharo-users] Why doesn't Iceberg checkin other assets (scripts) but does check them out?

2018-06-13 Thread Esteban A. Maringolo
On 13/06/2018 11:50, Tim Mackinnon wrote:
> Hi - my second attempt at using Pharo with Git has proven very satisfying (I 
> saw the potential in phase 1, but it was often difficult to understand what 
> was happening and the workflow to use).
> 
> One thing that has come up a few times for me however - and its something 
> that using git nicely highlights, there are many non-smalltalk assets in my 
> project that don’t need to live in the image (like Seaside FileLibraries were 
> trying to do) but do need to be versioned and be part of my project. Common 
> examples are server config files, images and even the playground history 
> files that are useful to pull up when on another computer.

> [SNIP]

> It strikes me that this is the kind of thing that git integration should 
> bring to us?

Of the mentioned benefits of using Git (or any other file based SCM) was
exactly that of versioning "external" assets.

You could do that with filetree/gitfiletree.

But I guess that given then tight integration of Iceberg with git and
the Pharo workflow, to "sync" ("commit") external files, these should be
visible to Iceberg as well, and should be added for staging on each
commit, which means that Iceberg should have a "file explorer" of some
sort integrated into its GUI.


Regards,

-- 
Esteban A. Maringolo



Re: [Pharo-users] Pharo 6, bad debugger behaviour

2018-06-08 Thread Esteban A. Maringolo
On 08/06/2018 08:30, Tim Mackinnon wrote:
> Hi, I’ve noticed lately when using a reasonably recent Pharo 6.1 setup that 
> if I restart a method in the debugger - particularly from a breakpoint or 
> correcting a dnu issue the environment frequently locks up. Fearing the worst 
> (after a few seconds), if I repeatedly press cmd . (Say 5 times) after 10 
> seconds more it comes back with 30 debugger Windows typically with something 
> like Instance of Xxxx dnu: #someMethod (which is legit as I might have a now 
> corrupt inst bar). 
> 
> I understand the error, but why does it lockup and require the cmd . Dance?
> 
> I dont recall earlier Pharos doing this (and not other smalltalks).
> 
> Should I report this?


It was reported years ago [1], there was a bug and an issue, and it was
supposedly fixed, apparently it wasn't.

In some cases that recursion caused a "detachment" of the image from the
changes, it is, the image starts complaining that it can't find the
changes file, so all methods lose the source and you better discard that
image without saving, because if you do, you'll never be able to
"reattach" it.

I don't know if it is still around in Pharo 7.


Regards,

[1] https://twitter.com/emaringolo/status/603939752098816000


-- 
Esteban A. Maringolo



Re: [Pharo-users] Understanding ZnJSONReader mapping?

2018-06-07 Thread Esteban A. Maringolo
On 07/06/2018 17:21, Tim Mackinnon wrote:
> Hi - is there something I can read/study to get a bit more familiar with Json 
> mapping? I have read the Pharo enterprise book (chapter 8).
> 
> I’ve been using NeoJSONObject but then it occurred to me that maybe I could 
> map better domain objects directly and simplify things. However it seems that 
> the intent of mapping is just for simple things like an array of points - 
> whereas if I have 15 different domain objects (albeit with a type key), then 
> I’m wondering if I should just wrap json nodes on usage? 
> 
> In fact I’m wondering what the point of mapping is if it’s so simple - or 
> maybe I’m missing an important concept?
If your objects just hold data, then you can get very far with
NeoJSONObject, but if you want to do more, you can get pretty extensible
mappings with the use of the valueSchema: option in the mapper.

For instance, to write a TsOrder (a model of an purchase order) I
configured the mapper this way:

mapper for: TsOrder do: [ :mapping |
  mapping mapAccessors: #(id).
 (mapping mapAccessor: #date) valueSchema: Date.
 (mapping mapAccessor: #edd) valueSchema: #NamedModel.
 (mapping mapAccessor: #provider) valueSchema: #NamedModel.
 (mapping mapAccessor: #status) valueSchema: #NamedModel.
 (mapping mapAccessor: #customerCode).
 (mapping mapAccessor: #totalOriginalPrice to: 'total') valueSchema:
#monetary.
].

mapper for: Date customDo: [ :mapping |
mapping encoder: [ :date | date ddmm  ] ].

mapper for: #monetary customDo: [ :mapping |
mapping encoder: [ :price | price printShowingDecimalPlaces: 2 ] ].

mapper for: DateAndTime customDo: [ :mapping |
mapping decoder: [ :string | DateAndTime fromString: string ].
 ].

mapper for: #NamedModel customDo: [ :mapping |
mapping encoder: [ :persona | persona displayString ] ].


For decoding it might be trickier, because you might need more objects
other than just deserializing from JSON, e.g. to avoid instantiating
twice the same domain object, or if you need to lookup an entity in the
database by ID, and then you need access to the database, etc.

Throughout my journey of developing a few JSON-REST APIs I started using
the NeoJSON approach, then JsonObject and then WAJsonCanvas.

I found myself more confortable writing JSON with the latter (I like the
canvas approach of Seaside) and instantiating NeoJSONObject/JsonObject
and building my business objects from these cherry picking what I needed.

What NeoJSON offers as a "differentiator" is that it is stream based, so
there is no need to have intermediate "structures" (it is,
dictionaries), and the mappers are orthogonal to the objects (unless you
use the default class side #neoJsonMapping:)

WAJsonCanvas offers stream based writing, but there are no mappings, but
if you always serialize a proper hierarchy of renderJsonOn: implementors
could prove to be effective, in particular if you have to build your
objects manually from a JSON stream.

Regards,


-- 
Esteban A. Maringolo



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

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

Nothing that syntax sugar mapping some convenient property accessor to
#at: couldn't fix. :)



-- 
Esteban A. Maringolo



Re: [Pharo-users] Why doesn't Pharo 7 Iceberg write changes to the git filesystem as you go?

2018-05-22 Thread Esteban A. Maringolo
I agree with you that it is weird, but as I understand it it is
because the process of "Saving" a package and "Committing" it is
merged into a single action, so there is no way to "save" the package
other than committing its changes to the repo.

This has the drawback you mentioned, but I guess this enables you to
simultaneously save the same package to more than one repository.

Maybe a diagram could make the whole picture more clear.

Regards,

Esteban A. Maringolo


2018-05-22 12:23 GMT-03:00 Tim Mackinnon <tim@testit.works>:
> Hi - when trying out the new Iceberg with a bunch of developers and 
> explaining the challenges of integrating git and files into a smalltalk realm 
> of the image - there was a lot of interest in how this works.
>
> When you clone - you obviously see a series of files (in Tonel - nice) that 
> are then brought into your image. If you edit a file like Readme.md (using a 
> markdown editor) you will notice that git status will show you that this file 
> has changed. However if you then edit some methods - and then look in the 
> file system - git status doesn’t show these? This in retrospect possibly 
> feels weird - or does it? I’m not sure anymore - and was wondering if there 
> was a specific reason behind not mirroring code changes back to the file 
> system as they happen?
>
> When you branch in Pharo, a command line git status does show that change - 
> so some things clearly are being mirrored, just not code (Which I’m guess 
> happens briefly when you click commit?).
>
> I’m curious now to understand the tradeoffs.
>
> Tim
>
> p.s. it is very nice for small private projects, to use a git client on your 
> phone - edit a method or two on the train, commit your changes and then see 
> your CI build the results and deploy a new website by the time you get off… 
> yes its not the rich smalltalk environment for bigger changes - but tiny 
> stuff, its quite nice to fallback on the traditional way.
>
>



Re: [Pharo-users] #ast vs. #parseTree

2018-05-04 Thread Esteban A. Maringolo

On 04/05/2018 13:54, Richard Sargent wrote:

>> On Fri, May 4, 2018 at 9:45 AM, Sean P. DeNigris <s...@clipperadams.com
>> <mailto:s...@clipperadams.com>> wrote:
>> 
>> Ramon Leon-5 wrote
>> > And my point made; I don't even know what that means.
>> 
>> Ha ha, I googled it and even after seeing the definition still didn't
>> understand - we must be getting old ;-)

> Also, if one Googles an acronym, such as the recently cited TMA, one
> gets results like https://en.wikipedia.org/wiki/TMA (a disambiguation
> page with a lengthy list). [I still don't know which TMA was meant, by
> the way, so I can't use it for the following example.] If one Googles
> Abstract Syntax Tree, one will find exactly what it means. But
> additionally, one could make a reasonable guess at an approximation of
> its meaning even without searching.


I think that the "we have a TMA situation" is a nice joke if the right
guess is that TMA means "Too Many Acronyms" :)

Regards!



-- 
Esteban A. Maringolo



Re: [Pharo-users] #ast vs. #parseTree

2018-05-03 Thread Esteban A. Maringolo
+1 to avoid acronyms.

Esteban A. Maringolo

2018-05-03 12:47 GMT-03:00 Francisco Garau <francisco.ga...@gmail.com>:

> I'd rather be also explicit in the name and avoid acronyms.
> #newAbstractSyntaxTree and #cachedAbstractSyntaxTree
>
> - Francisco
>
>
>


Re: [Pharo-users] Why no collect:ifNone: ?

2018-04-30 Thread Esteban A. Maringolo
Hi Tim,

What I found confusing there is that with #select:thenCollect: or
#collect:thenXxx: you're always dealing with collections.

In your #collect:ifNone: there is a mix. You can return a collection
(#collect:) or the result of evaluating the emptyBlock, which in your
example is a number, so I it seems like a semantic mismatch smell to me.

Following your example:

myVar := result ifEmpty: [ 0 ] ifNotEmpty:[ :r | r collect: [:I | i
hours ]].

What will be in myVar? a collection? a number? something else?.

Maybe your example is too abstract to give a good feedback.

Regards,



On 30/04/2018 15:37, Tim Mackinnon wrote:
> 
> Hi - I hit a small bug in my lunch experiments with Willow where I wanted to 
> sum up a collection of support hours.
> 
> I was collect: in the hours worked and hadn’t accounted for an empty 
> collection.
> 
> When I went to do it I was surprised there isn’t a concept of 
> #collect:ifNone: that mirrors something like at:ifAbsent: or the nicely 
> readable collect:thenXxx: methods.
> 
> Why is this?
> 
> I’m curious about style - and the elegance of my workaround :
> 
> result ifEmpty: [ 0 ] ifNotEmpty:[ :r | r collect: [:I | i hours ]]
> 
> which is ok, but seems a mouthful?
> 
> Am I missing a trick?
> 
> Tim
> 
> Sent from my iPhone
> 

-- 
Esteban A. Maringolo



Re: [Pharo-users] Literals

2018-04-27 Thread Esteban A. Maringolo
oh, you were talking about how te VM views the object,
I was thinking in terms of how the compiler sees the text.

So I'm talking about literals "syntax".

Thanks anyway for the "trick" :)

On 27/04/2018 16:34, Clément Bera wrote:
> The guy who asked the question said: "...when you want to shorten some
> object initialization"
> 
> Using ClassVariable is an alternative way to shorten object
> initialization, reading a ClassVariable is almost the same performance
> as reading a literal, so that looked like a good alternative to me. Both
> the ClassVariable and the literal have the same issues (same object so
> if you mutate it you have to deal with it).
> 
> But yes, it's not a new literal.
> 
> For new literals, you can extend the compiler or hard patch thing:
> 
> MyClass>>foo
> ^ #bar
> 
> (MyClass>>#foo) literalAt: ((MyClass>>#foo) literals indexOf: #bar) put:
> Set new.
> 
> MyClass new foo 
> 
>>>> a Set ()
> 
> Obviously it depends what you mean by literal, the latter code uses the
> literal bytecode instruction, which does not make the pushed object a
> literal object...


-- 
Esteban A. Maringolo



Re: [Pharo-users] Literals

2018-04-27 Thread Esteban A. Maringolo
On 27/04/2018 15:35, Richard Sargent wrote:
> On Fri, Apr 27, 2018 at 2:08 PM, Esteban A. Maringolo
> <emaring...@gmail.com <mailto:emaring...@gmail.com>> wrote:

> As far as I knew the only way to have new literals was to modify the
> compiler.
> 
> 
> Yes.
> 
> VA Smalltalk has an interesting syntax extension which allows an
> arbitrary expression to be a compile-time literal.
> Going by memory, something like ##(Dictionary new at: #a put: self
> something; at: #b put: self somethingElse; yourself).

Dolphin Smalltalk provides that ##() literal as well since a decade at
least, so you have the full expression that gave origin to that literal,
but you don't need to compute it every time it is accessed.

Although I don't remember seeing it with Dictionaries, but more with
string concatenations or "magic numbers" like seconds in a day stored as
##(24 * 60 * 60).

Regards,


-- 
Esteban A. Maringolo



Re: [Pharo-users] Literals

2018-04-27 Thread Esteban A. Maringolo
Hi Clément,

On 27/04/2018 10:32, Clément Bera wrote:
> Obviously sets are not as easy to deal with. You cannot mutate empty
> arrays/bytearrays, if you concatenate something it creates a new object.
> You can add things in sets. So you need to be careful... You can make
> the object read-only to avoid issues (MyClassVar beReadOnlyObject).

Sorry, but I can't understand how a class variable could allow you to
use a new literal.

As far as I knew the only way to have new literals was to modify the
compiler.

So if you want #{} to create a new empty set, or #{1 1 2} to create a
Set with 1 and 2 as elements, there is no way to do it.

Or this %{$a -> 1. 'foo' -> false. 'baz' -> #{1 1 2}} to create a
dictionary with such set as literal. :)

Regards,

-- 
Esteban A. Maringolo



Re: [Pharo-users] What next for Pharo vm?

2018-04-22 Thread Esteban A. Maringolo
On 22/04/2018 11:03, henry wrote:
> I was thinking the vm is able to run more than one bytecode set. Why
> couldn’t our vm support both Pharo and Java bytecodes?

Smaltallk/X provides that Smalltalk/Java code duality.

But I think if Pharo ever pursues that path the best thing would be to
make it run in a VM such as Truffle/GraalVM [1]. A longest path maybe,
but you'll be able to piggyback on an existing community of VM
developers, and be able to interact not only with Java but it other
languages as well.

[1] https://www.graalvm.org/

Regards!

-- 
Esteban A. Maringolo



Re: [Pharo-users] Best method for connecting to an Oracle 11g database

2018-04-20 Thread Esteban A. Maringolo
At the time my company tested Pharo to access Oracle databases, the
OpenDBX driver support was lousy and it was hard to make it work in
Windows. Also Garage isn't tested against it.

So our resolution was that Oracle isn't supported by any driver for
Pharo unless you are in Windows and can use ODBC to access it (and I
don't know the current ODBC driver status for recent Pharo versions).

Regards!

On 20/04/2018 03:48, Stephane Ducasse wrote:
> Hi Arron
> 
> Did you try Garage from https://github.com/pharo-rdbms
> 
> Stef
> 
> On Fri, Apr 20, 2018 at 7:22 AM, Aaron Blakeman
> <aaron.blake...@gemtalksystems.com> wrote:
>> Hello,
>>
>> I'm trying to use Pharo 6 to connect to an Oracle 11g database.  I tried
>> using dbxtalk with the opendbx driver, but I can't seem to get that to load
>> cleanly into a Pharo 6 image.
>>
>> Before I spend alot of time trying to debug DBXtalk I wanted to see if
>> anyone else had any recommendations.  Is there currently any better method
>> for connecting from Pharo 6 to an Oracle database?
>>
>> Thanks!
> 

-- 
Esteban A. Maringolo



Re: [Pharo-users] [Pharo-Launcher] call for tests on Windows

2018-04-16 Thread Esteban A. Maringolo
On 16/04/2018 11:13, Christophe Demarey wrote:

> So, please could you install and test this new version: and report any 
> problem with it? http://files.pharo.org/pharo-launcher/win-alpha/

I'm downloading it, but something is wrong with that fileserver, it's
downloading at vry slow speeds.

Can't we use something like AWS S3 to store the files of files.pharo.org?

> We do not have windows users around so it’s hard to know if it works outside 
> our tests boxes.

Once it finishes I'll let you know. I'm one the few out there still
using Windows 7 Pro.

Regards,

-- 
Esteban A. Maringolo



[Pharo-users] [OT] Reminder about quoting/top-posting

2018-04-13 Thread Esteban A. Maringolo
Hi,

Please apologize the digression, but these days there were a lot of
interesting threads with LOTS of replies from different members.

Can I ask for more trimming of the quoted text and/or emails replied to?

The follow up of some replies was hard because they were nested deep
into a chain of previous quotes, or in the case of top-posters, they
keep the replied emails accumulating in the bottom, causing a scroll
down to find nothing else was there.

Thanks!


-- 
Esteban A. Maringolo



signature.asc
Description: OpenPGP digital signature


Re: [Pharo-users] Where do we go now ?

2018-04-13 Thread Esteban A. Maringolo
On 13/04/2018 11:12, Sean P. DeNigris wrote:
> EstebanLM wrote
>> I dream with even more classes: Selector, Protocol (we already have it,
>> but we need to use it), etc., etc., etc.
>> I will always prefer a class that defines a concept than a non-reified
>> usage of generic classes.

"Objects all the way down".

Most problems surge from the lack of proper abstractions.

-- 
Esteban A. Maringolo



Re: [Pharo-users] Where do we go now ?

2018-04-13 Thread Esteban A. Maringolo
On 13/04/2018 10:41, p...@highoctane.be wrote:
> A somewhat unique name makes it easier to google for it (like Roassal
> Pharo, or DeepTraverser Pharo, or Zinc Pharo). 
> These will give us hits that are relevant.
> 
> Try System Browser, Inspector...
> 
> And Apple has worked with NSObject and stuff like that without too much
> trouble (at a much larger scale for whatever XyzKit they released).
> Ah, yes, they used the "Kit" suffix. Maybe can we have something like
> that with Pharo. Like SystemBrowserKit ( nah, too Appleish.


But I prefer these names:
* Calypso System Browser
* Calypso Debugger
* Iceberg Source Control Management
* Zinc HTTP Client
* Zinc HTTP Server
* Fuel Serialization
* Glamorous Spotter [*]
* etc.

[*] I particularly dislike "Glamorous" adjective.

In the case of wrapper for libraries I'm hesitant to decide whether to
indicate pharo name in it or not.
I mean stuff like a NaCl wrapper calling it "NaCl-Pharo" instead of
calling "Salty".


> Let's try SystemBrowserMeccano (longish), or SystemBrowserPack (too
> bland), or SystemBrowserGear (why not), SystemBrowserRig (this one
> sounds cool actually)).

Fortunately in the past the lack of namespaces caused the use of
prefixes instead of suffixes.

With time prefixes become invisible.

A suffix, instead, will get into all your names, bothering with other
existing suffixes like `Component`, `Model`, `Collection`, and so on.







-- 
Esteban A. Maringolo



Re: [Pharo-users] Where do we go now ?

2018-04-13 Thread Esteban A. Maringolo


On 13/04/2018 09:39, Esteban Lorenzano wrote:
> 
> 
>> On 13 Apr 2018, at 14:33, Andrew Glynn > > wrote:
>>
>> I find NPM as obscure as Pharo, honestly, and VA Smalltalk is worse
>> (wth does abt or sst stand for?).  Grunt, Gulp, etc., how do the names
>> relate to what they do?  
> 
> yes… but we actually have a problem there.
> I would like to be able to add “tags" to tools, to be able to say: 
> 
> Calypso -> a class browser -> some more info
> etc.


But isn't that what the Catalog currently does?

Of course the catalog is not for a "package" (as in npm, apt, yum, etc).

Regards,

--
Esteban, the other one. :P



Re: [Pharo-users] Where do we go now ?

2018-04-13 Thread Esteban A. Maringolo
On 13/04/2018 09:18, Peter Uhnák wrote:
> On Fri, Apr 13, 2018 at 2:05 PM, Richard O'Keefe <rao...@gmail.com
> <mailto:rao...@gmail.com>> wrote:
> 
> There are a lot of subsystems in Pharo, and being a bear of
> very little brain, I have a hard time relating Zinc, Calypso,
>   to, well, whatever they are.  I presume there is
> somewhere a list of topic/name/PFX triples for guidance.
> Can some kind soul tell me where it is?


> Until we have mature package manager (similar to Cargo or npm), you have
> to use google.

Yes, there needs to be a package tool that enables discoverability,
Catalog is not enough.

> On the bright side, with the move to git(hub), people are much more
> likely to actually describe what their project does, and maybe even a
> bit of documentation. This was almost non-existent with SmalltalkHub.

True, and it's also giving visibility to Pharo and Smalltalk as active
technologies.

Regards,

-- 
Esteban A. Maringolo



Re: [Pharo-users] Where do we go now ?

2018-04-13 Thread Esteban A. Maringolo
On 13/04/2018 09:05, Richard O'Keefe wrote:
> There are a lot of subsystems in Pharo, and being a bear of
> very little brain, I have a hard time relating Zinc, Calypso,
>   to, well, whatever they are.  I presume there is
> somewhere a list of topic/name/PFX triples for guidance.
> Can some kind soul tell me where it is?

I think it's not a matter of brain, and unless I also have a bear brain
I find it hard to know what each thing means, in particular when there
is a "flagship" framework (like Seaside) and the related
extensions/libraries are called something different instead of, it is
harder when the names are completely unrelated to the domain.

I've been thinking of collecting the package names, what they do, an
which class prefixes they use. But never had the willingness to actually
do it, maybe now is a good moment.


Regards,

--
Esteban.







Re: [Pharo-users] Namespaces and ASN1 types in Cryptography package

2018-03-31 Thread Esteban A. Maringolo
Hi Holger,

Cryptography package lacks a proper modularization, so you could load
only the groups you need, e.g. ASN1 will only be needed if you load
X509 (AFAIR).

If Nortbert's ASN1 package is more complete than Cryptography's, then
we whould either merge it or discard what's there and load Norbert's
ASN1 package as a dependency instead.

Regards,


Esteban A. Maringolo


2018-03-31 12:11 GMT-03:00 Holger Freyther <hol...@freyther.de>:
> Hi,
>
> I was debugging some test failures and it turns out that my code defines an 
> ASN1IntegerType and the Cryptography package (a dependency of MongoTalk which 
> is loaded into my code) has such a class as well.
>
> Thanks to Epicea I could see which package added the method but now I have no 
> idea how to resolve the problem. Mongotalk needs PBKDF2 for modern 
> authentication... Could Cryptography use "ASN1-Model"[1] instead? This is a 
> rather complete[2] ASN1 implementation and used in production for some years. 
> Could the classes be prefixed?
>
> If not how can I instruct Metacello to not load a certain package?
>
> holger
>
>
> [1] http://smalltalkhub.com/#!/~NorbertHartl/ASN1/source
> [2] Rather complete parser for ASN1 files but only encoding/decoding for 
> DER/BER (none of the modern ones like aper/uper



Re: [Pharo-users] Question about GLORP class models

2018-03-29 Thread Esteban A. Maringolo
This is a question best suited to the Glorp mailing list (which I'm
cc'ing in this email).

What you need is an HorizontalTypeResolver, and define a common class
as the ancestor for both of your classes.
You'll have to define a descriptor for it, and you will use it to
reference the "parent" of these (e.g. AbstractQuestion).

So in your Glorp Descriptor you'll end up with something like:

QuestionDescriptorSystem>>#typeResolverForAbstractQuestion
  ^(HorizontalTypeResolver forRootClass: AbstractQuestion)

QuestionDescriptorSystem>>#descriptorForAbstractQuestion: aDescriptor
  "..."
   (self typeResolverFor: AbstractQuestion) register: aDescriptor
abstract: true.

QuestionDescriptorSystem>>#descriptorForQuestion: aDescriptor
  "..."
  (self typeResolverFor: AbstractQuestion) register: aDescriptor.


QuestionDescriptorSystem>>#descriptorForQuestionGroup: aDescriptor
  "..."
  (self typeResolverFor: AbstractQuestion) register: aDescriptor.

Then
classModelForSection: aClassModel
aClassModel newAttributeNamed: #questions collectionOf: AbstractQuestion

I don't know about your model, but if both classes work
polymorphically and have a common semantic root (it is "Question"), it
is hard for me to see why they don't have a common ancestor.

Disclaimer: the above code was written without testing it, based on my
memory only :)

Regards,

Esteban A. Maringolo


2018-03-29 11:43 GMT-03:00 Alejandro Infante <alejandroinfant...@gmail.com>:
> Hi guys!
>
> I’m trying to use GLORP and I’m having problems defining the class model for 
> a class which has an instance variable which is a collection of instances of 
> two different classes:
>
> I have 3 classes named: { Section . Question . QuestionGroup } and I have 
> problems for specifying the glorp class model for Section.
> Object subclass: #Section
> instanceVariableNames: ‘questions ...'
> classVariableNames: ''
>
> The thing is that #questions instance variable is a collection of Question 
> AND QuestionGroup. They have polymorphic behavior, but they have not a common 
> superclass (besides Object).
>
> How does my class model should look like?
>
> classModelForSection: aClassModel
> ...
> aClassModel newAttributeNamed: #questions collectionOf: ?.
>
>
> Thanks for the help!
> Cheers,
> Alejandro



Re: [Pharo-users] Zeroconf for Windows?

2018-03-26 Thread Esteban A. Maringolo
2018-03-26 13:19 GMT-03:00 Esteban Lorenzano <esteba...@gmail.com>:
> hi,
>
> zeroconf works for linux, macOS or an MSYS system (msys or cygwin)
> they will not work with plain Windows and that was never the purpose: it was 
> to easy CI tasks.
>
> of course, I understand a lot of people wants to use them for their day to 
> day work (as I do it myself), but it will not be prepared for all possible 
> uses.
>
> also, almost every programmer needing a command line in windows will need 
> something like msys and cygwin… you want to install it too ;)

Or there could be a PowerShell / cmd alternative if somebody is
willing to put the effort to install it.

The server could return the bash/sh based script or the batch one
based on the request headers.

But I'd put the burden of doing it to somebody with the real need.

Regards,

Esteban A. Maringolo



Re: [Pharo-users] Porting Transducers to Pharo

2018-03-21 Thread Esteban A. Maringolo
Hi Steffen,

2017-06-06 7:44 GMT-03:00 Steffen Märcker <merk...@web.de>:
> I assumed so. I used file-outs only to get something working quickly. =)
> Properly published code will follow as soon as I am more familiar with code
> management in Pharo.

I'm coming back to this. What was the choosen tool? I tried
FileOuterNG but it doesn't work in VW PUL 8.2, and I don't understand
the reasoning behind the "bindings" mappings (it fails when building
the default mappings).

The FileOut30 package doesn't seem to respect encodings at all.

Thanks!

Esteban A. Maringolo



Re: [Pharo-users] inquiring question about ifTrue: implementation

2018-03-19 Thread Esteban A. Maringolo
Why would you do such aberration?

It goes against the "fail noisily" "Rule of Repair": Developers should
design programs that fail in a manner that is easy to localize and
diagnose or in other words “fail noisily”. This rule aims to prevent
incorrect output from a program from becoming an input and corrupting
the output of other code undetected.

It is semantically incorrect, if needed, I don't see why, you sould
implement it in  your own class. But when I needed to do such "if"
handlers, I did it using meaningful selectors like #ifGranted: or
#ifSucceeded:, or the well known #ifEmpty:

Regards,

Esteban A. Maringolo


2018-03-19 9:40 GMT-03:00 Petr Fischer <petr.fisc...@me.com>:
>> Infinite recursion ?
>>
>> You use #ifTrue: in your implementation of Object>>#ifTrue:
>>
>> Plus, non-booleans cannot meaningfully respond.
>>
>> How would you define the semantics of
>>
>> 123 ifTrue: [ ... ]
>
> 123 is not "true", so, ignore the block.
> Do the ifTrue block only if the receiver is instance of True (true). 
> Everything else is not "true" :)
>
> I missed the recursion, yes, but it could be done another way.
>
>>
>> > On 19 Mar 2018, at 10:18, Petr Fischer <petr.fisc...@me.com> wrote:
>> >
>> > Hello, I have some sort of philosophical question about ifTrue:/ifFalse: 
>> > implementation.
>> >
>> > Now, ifTrue: is defined in the Boolean class (subclassResponsibility) + in 
>> > True and False classes, so, we can send this message to the boolean 
>> > expressions (instances) only, otherwise DND occurs.
>> >
>> > But we can also define one universal ifTrue: right in the Object class, in 
>> > this style:
>> >
>> > Object>>ifTrue: 
>> > (self = true) ifTrue: [ ... ].
>> >
>> > then, we can send ifTrue: message to ANY object and it will work correctly 
>> > without DND exception on non-boolean objects.
>> >
>> > Is something bad about this idea?
>> >
>> > Thanks! pf
>> >
>>
>>
>



Re: [Pharo-users] What is Reef? (was: Tide/Amber)

2018-03-15 Thread Esteban A. Maringolo
Oh my goodness.  Willow works ON TOP of Seaside?

I always thought it was a separate project using some of its concepts
(canvas, etc.).

Regards,
Esteban A. Maringolo


2018-03-15 5:53 GMT-03:00 Esteban Lorenzano <esteba...@gmail.com>:
>
>
> On 15 Mar 2018, at 09:47, H. Hirzel <hannes.hir...@gmail.com> wrote:
>
> Hello Esteban
>
> Which problem does Reef solve?
>
>
> it was a layer on top of Seaside to work with ajax components.
> that’s now covered by this other project:
>
> https://github.com/ba-st/Willow
>
> Esteban
>
>
> Regards
> Hannes
>
> On 3/15/18, Esteban Lorenzano <esteba...@gmail.com> wrote:
> 
>
> Other reason why no one is using it (Tide / Amber) is, probably, because
> nobody knows is
> there: things that are not marketed/exposed/explained are ultimately lost
> (it happened also with Reef and a lot other projects I had that IMO could
> have had better luck).
>
> Esteban
>
>
>



Re: [Pharo-users] Something is happening...

2018-03-14 Thread Esteban A. Maringolo
Do we have any metrics on the number of visits we get on the pharo.org
website, which parts are the most visited, etc?

The same regarding web downloads, and so on. I understand that CI can
distort download count if using only access logs, but certainly if we
count a download through the webpage as a "conversion" (and track it
somehow) we would have a better idea how big this is becoming.

But back to your point and as a bystander these days, it is very hard
to be aware of everything that's going on in the Pharo world, and not
because of the associated noise, because there is actually a lot of
things going on. :)

Regards,

Esteban A. Maringolo


2018-03-13 4:27 GMT-03:00 Marcus Denker <marcus.den...@inria.fr>:
> Hi,
>
> There is something odd happening… or better: There is *a lot* happening.
>
> Just one example: for the Newsletter, the original idea was to send out once
> a month a post with 3 things, some of them recycled (e.g. pointers to
> existing projects, re-use “success stories”, things like that.
>
> Now already some months ago I had to add “and here are some other
> interesting announcements, blog posts, videos”.
>
> But this month, the list of things for the newsletter TODO list contains
> over 60 entries. With the exception of maybe 5, these are just things that
> happened between sending the February newsletter and today.
>
> Newsletter March should be ready till this thursday, I hope, subscribe or
> read the oder ones here: http://newsletter.pharo.org
>
> Marcus



[Pharo-users] Base58/Base58Check encoder package

2018-03-09 Thread Esteban A. Maringolo
I created a small utility class `Base58Encoder` that allows you to
encode/decode ByteArrays to/from Base58 and Base58Check.

For more information:
https://github.com/eMaringolo/pharo-base58

Regards,

Esteban A. Maringolo



Re: [Pharo-users] Bitwise operations in ByteArray (slicing, etc.)

2018-03-06 Thread Esteban A. Maringolo
2018-03-06 12:06 GMT-03:00 Henrik Sperre Johansen
<henrik.s.johan...@veloxit.no>:
> Esteban A. Maringolo wrote

> BaseX encode/decode can be simple enough to fit in a small workspace:
>
> base := 58.
> base58Lookup :=
> '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'.
> myNumber := 12345678901234567890.
>
> myString := encode value: myNumber.
> (decode value: myString) = myNumber.

If you're encoding numbers to strings, and viceversa, that's ok.
If you also need to support encoding strings (as bytearrays) that
didn't work for me.

I like your approach, it was more concise and didn't require reversing
the output as the one i used [1]

> The appeal of Base64 is it transforms the // and \\ operations into simple
> shifts / masks.

I guess, every bit and byte operation is simpler when happens in
multiples of 8 :)

Regards!


[1] 
https://github.com/eMaringolo/pharo-base58/blob/master/src/Base58-Core.package/Base58Encoder.class/instance/encode..st


Esteban A. Maringolo



Re: [Pharo-users] Bitwise operations in ByteArray (slicing, etc.)

2018-03-05 Thread Esteban A. Maringolo
Hi Richard,

Certainly a BitStream is beyond what I initially thought.

But it could be of some use to play with it, is it available somewhere
with a friendly open source license?

I might give it a try using it for my generator (tests are already
passing). Your example is almost complete, but if I understand it
you're adding the size of the checksum instead of the checksum itself.
Nonetheless I think its readability is superior, and I guess that it
is better perfomance and memorywise.

Also it could be useful for Base58Encoder I'm expermenting with.
Encoding is "simple" but requires the use of a really large integer,
I'm stuck at the decoding part now.
After that there is a Base32 encoder (to implement a Bech32 encoder as well).

So I might use it in my road of experimentation with these matters.
Unless I diverge from this and abandon it as it normally happens. :/

Regarding this part:
> This reminds me of a lesson I learned many years
> ago: STRINGS ARE WRONG.  (Thank you, designers of
> Burroughs Extended Algol!)  When trees aren't the
> answer, streams often are.

Can you provide more context to this? I wouldn't mind if it is in a
separate thread or a blog post of your own.

Thanks in advance.

Esteban A. Maringolo

2018-03-05 21:55 GMT-03:00 Richard O'Keefe <rao...@gmail.com>:
> I note that the specification in question does not
> deal with arbitrary bit strings but with "entropies"
> that are 128 to 256 bits long and a multiple of 32 bits.
> 4 to 8 bits are copied from the front to the end.
> (So selecting *this* bit field can be done by taking
> the first byte of a ByteArray.)  This makes the sequence
> 132 to 264 bits.  This is then chopped into 11 bit
> subsequences.  These are not arbitrary subsequences and
> they are not taken in arbitrary order.  They are a stream.
>
> My own Smalltalk library include BitInputStream and
> BitOutputStream, wrapping byte streams.  So we could
> do something like
>
>ent := aByteArray size * 8.  "BIP-39 ENT"
>cs  := ent // 32."BIP-39 CS"
>foo := ByteArray new: (ent + cs) // 8.
>o   := BitOutputStream on: foo writeStream.
>i   := BitInputStream on: aByteArray readStream.
>1 to: ent do: [:x | o nextPut: i next].
>i reset.
>o nextUnsigned: cs put: (i nextUnsigned: cs).
>i close.
>o close.
>i := BitInputStream on: foo readStream.
>ans := (1 to: (ent + cs) // 11) collect: [:x |
>   WordList at: 1 + (i nextUnsigned: 11)].
>
> Stare at this for a bit, and you realise that you don't
> actually need the working byte array foo.
> ByteArray
>   methods for: 'bitcoin'
> mnemonic
>   |ent csn i t|
>   (ent between: 128 and: 256)
> ifFalse: [self error: 'wrong size for BIP-39'].
>   cs  := ent // 32.
>   n   := (ent + cs) // 11.
>   i   := BitInputStream on: (ReadStream on: self).
>   t   := i nextUnsigned: cs.
>   i reset.
>   ^(1 to: n) collect: [:index |
> WordList at: 1 + (index = n
>   ifTrue:  [((i nextUnsigned: 11 - cs) bitShift: cs) bitOr: t]
>   ifFalse: [i nextUnsigned: 11])]
>
> My BitInputStream and BitOutputStream classes are,
> um, not really mature.  They aren't *completely*
> naive, but they could be a lot better, and in
> particular, BitInputStream>>nextUnsigned: and
> BitOutputStream>>nextUnsigned:put: are definitely
> suboptimal.  I put this out there just to suggest
> that there is a completely different way of thinking
> about the problem.  (Actually, this isn't *entirely*
> unlike using Erlang bit syntax.)
>
> Bit*Streams are useful enough to justify primitive
> support.  (Which my classes don't have yet.  I did
> say they are not mature...)
>
> This reminds me of a lesson I learned many years
> ago: STRINGS ARE WRONG.  (Thank you, designers of
> Burroughs Extended Algol!)  When trees aren't the
> answer, streams often are.
>
>
>
>
> On 6 March 2018 at 07:21, Esteban A. Maringolo <emaring...@gmail.com> wrote:
>>
>> 2018-03-05 14:02 GMT-03:00 Stephane Ducasse <stepharo.s...@gmail.com>:
>> > On Sun, Mar 4, 2018 at 9:43 PM, Esteban A. Maringolo
>> > <emaring...@gmail.com> wrote:
>> >> 2018-03-04 17:15 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
>> >>> Bits are actually numbered from right to left (seen from how they are
>> >>> printed).
>> >>
>> >> I understand bit operations, used it extensively with IP address eons
>> >> ago.
>> >>
>> >> But if a spec says: "Take the first n bits from the hash", it means
>> >> the first significant bits.
>> >> so in 2r100101

Re: [Pharo-users] Bitwise operations in ByteArray (slicing, etc.)

2018-03-05 Thread Esteban A. Maringolo
2018-03-05 14:02 GMT-03:00 Stephane Ducasse <stepharo.s...@gmail.com>:
> On Sun, Mar 4, 2018 at 9:43 PM, Esteban A. Maringolo
> <emaring...@gmail.com> wrote:
>> 2018-03-04 17:15 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
>>> Bits are actually numbered from right to left (seen from how they are 
>>> printed).
>>
>> I understand bit operations, used it extensively with IP address eons ago.
>>
>> But if a spec says: "Take the first n bits from the hash", it means
>> the first significant bits.
>> so in 2r10010 the first 3 bits are "100" and not "111".
>
> naive question: why?

Because it says so.
"A checksum is generated by taking the first ENT / 32 bits of its
SHA256 hash. This checksum is appended to the end of the initial
entropy.
Next, these concatenated bits are split into groups of 11 bits, each
encoding a number from 0-2047, serving as an index into a wordlist.
Finally, we convert these numbers into words and use the joined words
as a mnemonic sentence." [1].

> To me it looks like a lousy specification.

It might be, I can't really tell.

But such manipulation could be useful if you are knitting different
parts of a binary packet whose boundaries are not at byte level, but
bit instead. So you can take "these 5 bits, concatenate with this
other 7, add 13 zero bits, then 1 followed by the payload". I'm
assuming a non real case here though, my use case was fulfilled
already.

Regards!

--
Esteban A. Maringolo

[1] 
https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#generating-the-mnemonic



Re: [Pharo-users] Bitwise operations in ByteArray (slicing, etc.)

2018-03-05 Thread Esteban A. Maringolo
2018-03-05 10:52 GMT-03:00 Richard O'Keefe <rao...@gmail.com>:
> As I understand it, the OP's problem is that he wants to
> count bits from the high end, and Integers don't *have*
> a finite high end.

Exactly.

I want to work with a block of bits, today the best proxy for that is
using an Integer.

> Smalltalk/X has a BitArray class; see
> http://live.exept.de/ClassDoc/classDocOf:,BitArray
> for documentation.

This class basically does the job.

Thank you for the reference.

Esteban A. Maringolo



Re: [Pharo-users] [Pharo-dev] Looking for names for the booklet collection

2018-03-04 Thread Esteban A. Maringolo
2018-03-04 13:49 GMT-03:00 Peter Uhnák <i.uh...@gmail.com>:
>> Pharo Tools & Technologies
>> Pharo Language & Environment
>
> +1 ... simple, obvious, to the point

I adhere to this.

I add one more option: "Pharo Tools & Libraries"

Regards,

Esteban A. Maringolo



Re: [Pharo-users] Bitwise operations in ByteArray (slicing, etc.)

2018-03-04 Thread Esteban A. Maringolo
2018-03-04 17:15 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
> Bits are actually numbered from right to left (seen from how they are 
> printed).

I understand bit operations, used it extensively with IP address eons ago.

But if a spec says: "Take the first n bits from the hash", it means
the first significant bits.
so in 2r10010 the first 3 bits are "100" and not "111".

> But in a fixed amount of bits you could indeed number them the other way 
> around.
> It does not matter that you write the leading zeros or not, everything to the 
> left is zero anyway. When shifting, the right thing happens.

If it were a packet, with a fixed size, and the header started with 0,
then the leading zeros matter.

So in my use case it isn't the same ""
than "" (both in hex
notation).
See [1]

> Adding something like Integer>>#bitSliceFrom:to:size: based on your reverse 
> numbering would be wrong, IMHO.

Yes, it would be wrong. Unless you have to option to specify the
endianess you want to use.

> I guess you could write it like
>
> n := 2r10101000.
> from := 8.
> to := 13.
> size := 32.
> (n >> (size - 13)) bitAnd: ((1 << ( to - from + 1)) - 1).
>
> But the size feels out of place.

How so?

Thanks in advance, this is super low priority, I just wanted to check
whether something like that already existed.

Regards!


[1] 
https://github.com/eMaringolo/pharo-bip39mnemonic/blob/master/src/BIP39Mnemonic-Core.package/BIP39MnemonicTest.class/instance/jsonTestVectors.st


Esteban A. Maringolo



Re: [Pharo-users] Bitwise operations in ByteArray (slicing, etc.)

2018-03-04 Thread Esteban A. Maringolo
I do bitshifts and masks on Integer.

What if you want to take the bits from the 3rd to the 7th? You have to
do a some arithmetic to get the slice you want.
I'm simply asking for something more dev-friendlier that adds a
"layer" on top of that, but that internally does regular bitwise.

What I don't like about Integers is that you "lose" information about
the zero bits to the left, and with a ByteArray you don't, because the
array is fixed size.

E.g.
(1 << 16) printStringBase: 16. "'1'"
#[1 0 0] hex "'01'"

Maybe I'm too lazy asking when I could have done it myself :)

Regards,

Esteban A. Maringolo


2018-03-04 16:40 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
> Take a 24-bit number and you want to isolate the first 5 (these are actually 
> the last, higher order) bits.
>
> n := 2r10101000.
> n >> (16+3).
>
> If necessary, you can apply a mask (assume there are bits earlier/later 
> still).
>
> (n >> (16+3)) bitAnd: 2r1
>
> Large integers behave as bit strings, see the 'bit manipulation' protocol, 
> and are efficient at it.
>
>> On 4 Mar 2018, at 20:29, Esteban A. Maringolo <emaring...@gmail.com> wrote:
>>
>> Is there any package/library that makes bitwise operations as simple
>> as with an Integer, but for larger numbers (as in a ByteArray).
>>
>> Something that allows me to "slice" a sequence of bits, or extract
>> some using the same protocol as with a String of ones and zeros.
>>
>> Now when I need to work with sequence of bits, I convert an Integer to
>> a zero padded version of it up a known size, and then do #copyFrom:to:
>> to extract what I need and read back the number from it.
>>
>> I could use a bytearray for it, but as its name implies, it is
>> oriented towards bytes rather than bits (as in the case of Integer).
>>
>> Now I do stuff like the following to to extract the first 5 bits of a
>> fixed length 256 bit array (an Integer).
>>
>> Integer
>>  readFrom:
>>(((SHA256 hashMessage: message)) asInteger
>>  printStringBase: 2 length: 256 padded: true)
>>   copyFrom: 1 to: 5)
>>  base: 2
>>
>> I understand bitwise operations, but I couldn't find something that
>> does the above in a conciser way.
>>
>> Performance in my case isn't critical, but working with strings is
>> probably two orders of magnitude slower than manipulating bits in
>> integers or ByteArrays
>>
>> Regards,
>>
>> Esteban A. Maringolo
>>
>
>



[Pharo-users] Bitwise operations in ByteArray (slicing, etc.)

2018-03-04 Thread Esteban A. Maringolo
Is there any package/library that makes bitwise operations as simple
as with an Integer, but for larger numbers (as in a ByteArray).

Something that allows me to "slice" a sequence of bits, or extract
some using the same protocol as with a String of ones and zeros.

Now when I need to work with sequence of bits, I convert an Integer to
a zero padded version of it up a known size, and then do #copyFrom:to:
to extract what I need and read back the number from it.

I could use a bytearray for it, but as its name implies, it is
oriented towards bytes rather than bits (as in the case of Integer).

Now I do stuff like the following to to extract the first 5 bits of a
fixed length 256 bit array (an Integer).

Integer
  readFrom:
(((SHA256 hashMessage: message)) asInteger
  printStringBase: 2 length: 256 padded: true)
   copyFrom: 1 to: 5)
  base: 2

I understand bitwise operations, but I couldn't find something that
does the above in a conciser way.

Performance in my case isn't critical, but working with strings is
probably two orders of magnitude slower than manipulating bits in
integers or ByteArrays

Regards,

Esteban A. Maringolo



Re: [Pharo-users] HMAC-SHA512

2018-03-04 Thread Esteban A. Maringolo
2018-03-04 0:45 GMT-03:00 Pierce Ng <pie...@samadhiweb.com>:
> On Fri, Mar 02, 2018 at 11:24:36AM -0300, Esteban A. Maringolo wrote:
>> There is a PBKDF2 package made by Udo Schneider, and seems to be
>> easily pluggable with a different hashing algorithm, so I'd need a
>> SHA512 class.
>
> OpenSSL-Pharo wraps the SHA512 in libcrypto. See LcEvpSHA512Test.
>
>   https://github.com/PierceNg/OpenSSL-Pharo

Thank you Pierce, I managed to make play the SHA classes of your
OpenSSL wrapper with the PBKDF2 from Udo's plus HMAC from the
Cryptography package.
I sent you a pull-request
<https://github.com/PierceNg/OpenSSL-Pharo/pull/1> that includes
missing accessors that I needed to achieve the above interplay.

The end result is this: https://github.com/eMaringolo/pharo-bip39mnemonic

What I'm missing is a better PRNG to generate random numbers from 128
to 256 bits.
But my main objective was a proof of concept that ended up being successful.

Thanks for your help.



Esteban A. Maringolo



Re: [Pharo-users] casting to subclass

2018-03-02 Thread Esteban A. Maringolo
"Castings" are aliens in the Smalltalk world, although there is a
#become*: method family, I would discourage you from using it as an
alternative unless you really need to do it.

If your use case is that concrete, I'd do something like:

`ILHTMLBuilderElement fromXMLElement: anXMLElement`

Then all subclasses of `ILHTMLBuilderElement` will know what to look
and what to omit from the `XMLElement` parameter.

Regards!

Esteban A. Maringolo


2018-03-02 17:08 GMT-03:00 Stephan Eggermont <step...@stack.nl>:
> Siemen Baader <siemenbaa...@gmail.com> wrote:
>>
>> What else could I do, apart from removing the element from its tree,
>> creating a new (subclass) instance and then putting this element in place
>> of the old one? Some #perform or `super` magic..?
>
> Use composition? Generate accessing code where necessary.
> Is this very performance critical code?
>
> Stephan
>
>
>



Re: [Pharo-users] HMAC-SHA512

2018-03-02 Thread Esteban A. Maringolo
2018-03-02 8:54 GMT-03:00 Ben Coman <b...@openinworld.com>:

> On 2 March 2018 at 10:43, Esteban A. Maringolo <emaring...@gmail.com> wrote:

>> So after all this what's the recommended way to use HMAC-SHA512 in Pharo
>> 6?

> Libsodium installation instructions...
> https://github.com/Traadh/bittrex

Why did you create  BittrexLibsodium library wrapper instead of a
plain Libsodium wrapper like the one at
http://smalltalkhub.com/#!/~tonyg/Crypto-Nacl/ ?


>> I'd need it in combination with PBKDF2 to replicate this Python call:
>> PBKDF2(password, salt, iterations, macmodule=hmac,
>> digestmodule=hashlib.sha512).read(64)

> I guess with iterations=1 you should get the same result as libsodium
> I had to play around a bit before I worked out where to use bytes and where
> to use hex strings.
> It might help to run these test cases through PBKDF2...
> https://github.com/Traadh/bittrex/tree/master/src/Bittrex.package/BittrexLibsodiumTest.class/instance

Well, I need 2048 iterations.

There is a PBKDF2 package made by Udo Schneider, and seems to be
easily pluggable with a different hashing algorithm, so I'd need a
SHA512 class.


Thanks in advance.

Regards.


Esteban A. Maringolo



Re: [Pharo-users] HMAC-SHA512

2018-03-01 Thread Esteban A. Maringolo
Hi Ben, all,

So after all this what's the recommended way to use HMAC-SHA512 in Pharo 6?

I'd need it in combination with PBKDF2 to replicate this Python call:
PBKDF2(password, salt, iterations, macmodule=hmac,
digestmodule=hashlib.sha512).read(64)

Regards,

Esteban A. Maringolo


2017-12-10 6:01 GMT-03:00 Ben Coman <b...@openinworld.com>:
> Can anyone recommend libraries (native Smalltalk or via FFI)
> to do generate a HMAC-SHA512 ?
>
> cheers -ben



Re: [Pharo-users] adding 1 year to the date - bug?

2018-02-26 Thread Esteban A. Maringolo
This is a discussion we already had years ago. And comes back every once in
a while.

Pharo, and all dialects to my knowledge, uses incremental based
calculations instead of field based calculations (like java.util.Calendar).

This is the best thread I remember where we discussed this.
http://forum.world.st/Interesting-Date-Time-Thread-
on-Squeak-Dev-td4778652.html#a4778970


Regards,

--
Esteban.

El feb. 26, 2018 7:33 AM, "jtuc...@objektfabrik.de" 
escribió:

Am 26.02.18 um 11:13 schrieb Petr Fischer:

So "date addMonths: 12" behaves better for my needs. Thanks
>
Hmm. We've had this discussion just the other day at Lunch. What is a
month? Should addMonths: 1 and then subtractMonths: 1 on January 31st bring
you back to January 31st? How would you implement that?

I guess this is a problem that cannot be solved by a machine without
additional context. Does 1 month later mean "on this day next month" or
does it mean "exactly as many days in the future as the current month has
days"? None of the two? Can one month later be in March when today is
January 30th?

It seems years and months are a bit incompatible with informatics ;-) In my
opinion, there is more info needed than "x months/years later" in order to
calculate the correct result.

Joachim






>
> Hello, just simple test:
>>
>> (Date year: 2019 month: 2 day: 26) + 1 year.
>> returns: 26 February 2020
>> OK
>>
>> (Date year: 2020 month: 2 day: 26) + 1 year.
>> returns: 25 February 2021
>> What?
>>
>> (maybe I do not understand something  about dates again)
>>
>> Thanks! pf
>>
>>
>
-- 
---
Objektfabrik Joachim Tuchel  mailto:jtuc...@objektfabrik.de
Fliederweg 1 http://www.objektfabrik.de
D-71640 Ludwigsburg  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1


Re: [Pharo-users] [ANN] PI

2018-02-19 Thread Esteban A. Maringolo
Hi Hernan,

It's not clear to me where the install happens. In the first available
image file at the same working directory where you executed the pi
command?

Also, I'd make it case-insensitive, and only complain if there is an
ambiguity in some name (which I think there isn't).

Thanks again!

Esteban A. Maringolo


2018-02-18 17:12 GMT-03:00 Hernán Morales Durand <hernan.mora...@gmail.com>:
> Thanks, please let me know issues or ideas for enhacements.
>
> I just uploaded a new version adding a search packages feature,
> supporting both GitHub and SmalltalkHub repositories.
>
> Cheers,
>
> Hernán
>
>
> 2018-02-18 5:12 GMT-03:00 john pfersich <jpfers...@gmail.com>:
>> Congrats! Looks really useful. Can’t wait to try it out.
>>
>> Sent from my iPhone
>> Encrypted email at jgpfers...@protonmail.com
>>
>>> On Feb 17, 2018, at 23:23, Hernán Morales Durand <hernan.mora...@gmail.com> 
>>> wrote:
>>>
>>> Hi,
>>>
>>> PI is a MIT-pip-like command line program for Pharo Smalltalk. PI
>>> stands for Pharo Install. It is written in bash and tested
>>> successfully under MSYS and GNU/Linux.
>>>
>>> Look for details in the GitHub repository:
>>>
>>> https://github.com/hernanmd/pi
>>>
>>> Try and play around, if you found any bugs or want to integrate new
>>> feature, feel free to submit PR.
>>>
>>> Cheers,
>>>
>>> Hernán
>>>
>>
>



Re: [Pharo-users] canonical way to convert Symbol into Class (retrieve class by its name)

2018-02-10 Thread Esteban A. Maringolo
2018-02-10 11:33 GMT-03:00 Peter Uhnák <i.uh...@gmail.com>:
>> c) self class environment at: #Array
>> => this will work in the future if your code is a class which
>> environment/namespace/module includes the Array class you would expect
>
> Let's say that namespaces are added; Array is now in the module
> Collections.Array
> My code is now in module MyProject.MyWhatever
>
> I would imagine that in such situation I would need to change the code
> anyway, because it would try to look up MyProject.Array, no?
>
> So if the argument for asClass is based on future addition of modules, then
> I will need to manually change it anyway regardless of what approach I used,
> because I don't know in which namespace the class will end up.

If it is as in VisualWorks, it creates references, and such references
can be resolved dynamically.

If the reference specifies a namespace, then something such as
Core.OrderedCollection is resolved directly looking at the referenced
namespace, otherwise it looks at the same namespace of the class or
any namespace imported by the class definition.

With the added complexity of "nested" namespaces (Smalltalk.Core,
Smalltalk.Kernel, etc), and namespaces can also import other
namespaces, e.g.:
```
Smalltalk defineNameSpace: #Seaside
  private: false
  imports: '
private Smalltalk.*
private SUnit.*
private Grease.*
  '
  category: ''
```

I think that the explicit namespacing approach adds more complexity
than anything else, I'd use a more dynamic approach, like using
modules.

Regards,


Esteban A. Maringolo



Re: [Pharo-users] Generate equality

2018-02-07 Thread Esteban A. Maringolo
I wouldn't start a flamewar on this, but being able to separate
equality and identity is important.

Otherwise we should have to remove #= or #== since of either is redundant. :)

If you're dealing with ORM having a good implementation of #= is
important, since you might have several instances representing the
same "abstraction" (I wouldn't call it an object). Then you have to
implement #hash as well.

What is wrong most of the times is the implementation of #= and #hash itself.
I remember that Eclipse for Java provides Herbert's required feature,
where it can coherent equals() and hashcode() functions based on the
attributes of your choice.

Regards!

Esteban A. Maringolo


2018-02-07 17:09 GMT-03:00 Norbert Hartl <norb...@hartl.name>:
> I think that implementing = and hash is almost always wrong. So I guess the 
> answer is no :)
>
> Norbert
>
>> Am 07.02.2018 um 17:10 schrieb Herbert Vojčík <he...@mailbox.sk>:
>>
>> Hi!
>>
>> Do you think it would be reasonable to have, a la "generate accessors" / 
>> "generate initialize method", a "generate equality" thingie that would 
>> generate #= and #hash for the method, mechanically?
>>
>> Just created a new "piece of data" class and felt like it would be helpful.
>>
>> Herby
>



Re: [Pharo-users] [ANN] sentry.io (OSS error tracking platform) SDK

2018-02-07 Thread Esteban A. Maringolo
Thank you. It looks really nice. I enjoy every time I see Pharo integrated
with a "regular" tool for Devops.

The only thing that concerns me is whether we should have a credentials
manager of some sort, I cannot stop worrying about saving the username and
password in plaintext, not only for Sentry.

Esteban A. Maringolo

2018-02-07 16:20 GMT-03:00 Stephane Ducasse <stepharo.s...@gmail.com>:

> Nice :)
>
> Do you send the stack?
>
> Stef
>
> On Tue, Feb 6, 2018 at 10:55 PM, Peter Uhnák <i.uh...@gmail.com> wrote:
>
>> I guess the subject should say [ANN] too... :)
>>
>>
>> On Tue, Feb 6, 2018 at 10:55 PM, Peter Uhnák <i.uh...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I've made an experimental SDK for sentry.io to track errors in end-user
>>> installations.
>>>
>>> Also usable as a Logger for Beacon (which I guess should be the primary
>>> way to use this).
>>>
>>> ... and  as an extension for Debugger (basically a replacement for
>>> ShoreLine, which is too simplistic for my needs).
>>>
>>> https://github.com/peteruhnak/pharo-sentry
>>>
>>> [image: Inline image 1]
>>>
>>> Peter
>>>
>>
>>
>


Re: [Pharo-users] looking for another iterator :)

2018-01-24 Thread Esteban A. Maringolo
2018-01-22 6:57 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
> yes, we need composition to avoid API explosion (things are already very bad 
> in this respect)

And the names of the proposed selectors suggests it could be even worst.

+1 to composition.

Esteban A. Maringolo



Re: [Pharo-users] Databases

2018-01-15 Thread Esteban A. Maringolo
2018-01-15 12:25 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:

>> On 15 Jan 2018, at 10:55, Sven Van Caekenberghe <s...@stfx.eu> wrote:

>> To add to your list, I recently wrote a new PostgreSQL client, P3, that is 
>> using only TCP networking (no native library mess).
>
> Another important advantage of a TCP/IP based database client is that 
> outstanding/long-running calls do not block your image.

I think thas has more to do with the way FFI calls work in Pharo
rather than TCP/IP.
I.e. Dolphin Smalltalk had the option of non-blocking FFI, used
extensively for DB access where there is more wait and transfer state,
than execution.



Esteban A. Maringolo



Re: [Pharo-users] Zinc JSON parsing error handling

2017-12-14 Thread Esteban A. Maringolo
Is this Bittrex client available somewhere to play with?

Regards!

Esteban A. Maringolo

2017-12-13 3:59 GMT-03:00 Ben Coman <b...@openinworld.com>:

>
> With...
>   Object subclass: #BittrexResponse
> instanceVariableNames: 'success message result'
> classVariableNames: ''
> package: 'Bittrex'
>
>   Object subclass: #BittrexMarketSummary
> instanceVariableNames: 'MarketName High Low Volume Last
> BaseVolume TimeStamp Bid Ask OpenBuyOrders
> OpenSellOrders PrevDay Created DisplayMarketName'
> classVariableNames: ''
> package: 'Bittrex'
>
> this code works great when the response holds good data...
>   ZnClient new
> url: 'https://bittrex.com/api/v1.1/public/getmarketSummary?market=BTC-LTC
> ';
> enforceHttpSuccess: true;
> accept: ZnMimeType applicationJson;
> contentReader: [ :entity | |reader|
> reader := (NeoJSONReader on: entity readStream).
> reader for: BittrexResponse do: [:m|
> m mapInstVar: #success.
> m mapInstVar: #message.
> (m mapInstVar: #result) valueSchema: #ResultArray].
> reader for: #ResultArray customDo: [ :mapping |
>mapping listOfElementSchema: BittrexMarketSummary ].
> reader mapInstVarsFor: BittrexMarketSummary.
>   reader nextAs: BittrexResponse ];
>get.
>
> i.e. a raw response looking like this
> (ZnClient new
> url: 'https://bittrex.com/api/v1.1/public/getmarketsummary?market=BTC-LTC
> <https://bittrex.com/api/v1.1/public/getticker?market=BTC-LTC>';
> get) inspect.
> ==> "'{""success"":true,""message"":"",""result"":[{""
> MarketName"":""BTC-LTC"",""High"":0.01982450,""Low"":0.
> 01285257,""Volume"":1436429.81313360,""Last"":0.01842000,"
> "BaseVolume"":24841.17217724,""TimeStamp"":""2017-12-13T05:
> 56:25.937"",""Bid"":0.01840001,""Ask"":0.01842000,""
> OpenBuyOrders"":10140,""OpenSellOrders"":6306,""PrevDay"":0.01439800,""
> Created"":""2014-02-13T00:00:00""}]}'"
>
>
> But for bad response looking like this...
> (ZnClient new
> url: 'https://bittrex.com/api/v1.1/public/getmarketsummary?market=INVALID
> ';
> get) inspect.
> ==> {"success":false,"message":"INVALID_MARKET","result":null}
>
> the JSON handling code fails deep in the call stack with an error
>  "NeoJSONParseError: [ expected"
> which is not so friendly for users of the Bittrex library.
>
> What are the different/recommended approaches with Zinc
> for catching JSON errors such that I can pass "message"
> as a higher level Error up the stack to the Bittrex user.
>
>  cheers -ben
>


Re: [Pharo-users] Namespaces (was Re: Behold Pharo: The Modern Smalltalk)

2017-10-13 Thread Esteban A. Maringolo
You're mixing modularization, namespacing, packaging and parametrization.

If we're speaking about modules/namespaces I rather call them as such,
not Pink Elephant.
Having an agreement on the terms semantic is important for any communication.

To me a module is not a factorization for the bootstrap process nor
the proper packaging to enable partial loading, a module must be
reified as such.

The only Smalltalks I remember had something closer to a module were
VisualSmalltalk and maybe VisualWorks binary parcels can be thought as
modules, but strictly speaking none of them implement modules as such.
Only Modtalk tried to do that, but the project seems defunct now.

Regards,

Esteban A. Maringolo


2017-10-13 12:00 GMT-03:00 Dimitris Chloupis <kilon.al...@gmail.com>:
> Modularisation is coming whether you like it or not
> its called
>
> Bootstrap
>
> And the more modular the image will get the more will get closer to
> namespaces anyway. So frankly all I have to do is wait and if I can of
> course contribute ;)
>
> You can call it Bootstrap or the Pink Elephant for all I care, in the end
> for me its about having multi layer system. That's all I care.
>
> But you wont get an argument from me the more about the fact that the more
> we wait the harder will get but again, I am not a Bootstrap contributor so I
> have no right to complain. I really admire those people :D
>
> Modularisation for personal project is super easy to do,if you do it from
> the start that is,  its the existing code that is a pain in the hat to
> modularise when until fairly recently even colors were hard coded into the
> IDE.
>
> On Fri, Oct 13, 2017 at 3:55 PM Esteban A. Maringolo <emaring...@gmail.com>
> wrote:
>>
>> 2017-10-13 5:55 GMT-03:00 Norbert Hartl <norb...@hartl.name>:
>> >
>> >> Am 13.10.2017 um 10:24 schrieb stephan <step...@stack.nl>:
>> >>
>> >> On 13-10-17 09:55, Thierry Goubier wrote:
>> >>> Because namespaces, by essence, come with serious issues. I won't take
>> >>> someone seriously on namespaces until he can cite those faithfully.
>> >>
>> >> Let's start with the misconception that namespaces are about
>> >> modularisation
>> >>
>> > +1
>>
>> +1 to this as well.
>>
>> Having modularization is like having security, very hard to add them
>> later if you didn't include it in the original design.
>>
>> I'm using VisualWorks these days, and I find its namespaces something
>> more of a hassle than a real use.
>>
>> If we could name Classes with a dot, that could solve most of what
>> namespaces are used for in practice: avoiding name colissions.
>> That's why most of the popular frameworks have prefixes like Zn, WA,
>> RB, and so on and so forth. But now I'm used to prefixes, I don't need
>> them. :)
>>
>> Modularity is a different beast, if you look at how some modules work
>> in JS, like AMD, you see that in practice they avoid collisions by
>> importin what they need from a module, and assign it to a "namespace"
>> (it is not, but works as such), so they get modules first, and
>> namespacing later.
>>
>> Regards,
>>
>> Esteban.
>>
>



Re: [Pharo-users] Namespaces (was Re: Behold Pharo: The Modern Smalltalk)

2017-10-13 Thread Esteban A. Maringolo
2017-10-13 5:55 GMT-03:00 Norbert Hartl :
>
>> Am 13.10.2017 um 10:24 schrieb stephan :
>>
>> On 13-10-17 09:55, Thierry Goubier wrote:
>>> Because namespaces, by essence, come with serious issues. I won't take
>>> someone seriously on namespaces until he can cite those faithfully.
>>
>> Let's start with the misconception that namespaces are about modularisation
>>
> +1

+1 to this as well.

Having modularization is like having security, very hard to add them
later if you didn't include it in the original design.

I'm using VisualWorks these days, and I find its namespaces something
more of a hassle than a real use.

If we could name Classes with a dot, that could solve most of what
namespaces are used for in practice: avoiding name colissions.
That's why most of the popular frameworks have prefixes like Zn, WA,
RB, and so on and so forth. But now I'm used to prefixes, I don't need
them. :)

Modularity is a different beast, if you look at how some modules work
in JS, like AMD, you see that in practice they avoid collisions by
importin what they need from a module, and assign it to a "namespace"
(it is not, but works as such), so they get modules first, and
namespacing later.

Regards,

Esteban.



Re: [Pharo-users] why are Help topics in the meta-side

2017-10-03 Thread Esteban A. Maringolo
2017-10-03 10:14 GMT-03:00 H. Hirzel <hannes.hir...@gmail.com>:
> In the end it is probably a matter of conventions.
>
> Instruction how to construct something (e.g. Spec)

Conventions and history, which maybe are the same thing :)

VisualSmalltalk/VisualWorks, Dolphin, VAST keep the definition of the
windows/panes in the class side, whether they're Smalltalk expressions
or binary/literal arrays (Dolphin).

In the case of Dolphin each "class method" defines a "resource" you
can have more than one layout for the same class, so you can have a
"read only" view (resource) and an "editable" view sharing the same
instance behavior.

Also, having it class side you can reference it/preview (rendered)
from other views without having to instantiate them, which might
require having a valid model, etc.

> / configuration information / descriptions
> / help information / examples are kept on the class side.

In fact I don't like that Magritte moved the descriptions from class
to instance side.

My two cents on this.

Regards!

Esteban A. Maringolo



Re: [Pharo-users] PharoCloud method sources

2017-09-22 Thread Esteban A. Maringolo
It's pretty simple for small graphics. Although I'm not using it anymore.

There is also a great Seaside wrapper for Highcharts, which is more
actively used and maintained.

Esteban A. Maringolo


2017-09-22 15:04 GMT-03:00 Stephane Ducasse <stepharo.s...@gmail.com>:
> Cool I did not know about rickshaw
>
>
>
> On Thu, Sep 21, 2017 at 9:40 PM, Esteban A. Maringolo
> <emaring...@gmail.com> wrote:
>> I recentrly noticed that the examples gently hosted at PharoCloud
>> don't have any sources available, and since the examples for both
>> Bootstrap[1] and Rickshaw[2] uses code reflection to display the
>> sources used to produce each example, they don't work and you get a
>> `self methodHasNoSourceCode` instad.
>>
>> Can this be fixed somehow?
>>
>> [1] http://pharo.pharocloud.com/bootstrap/browser/Alerts
>> [2] http://pharo.pharocloud.com/rickshaw
>>
>> Esteban A. Maringolo
>>
>



[Pharo-users] PharoCloud method sources

2017-09-21 Thread Esteban A. Maringolo
I recentrly noticed that the examples gently hosted at PharoCloud
don't have any sources available, and since the examples for both
Bootstrap[1] and Rickshaw[2] uses code reflection to display the
sources used to produce each example, they don't work and you get a
`self methodHasNoSourceCode` instad.

Can this be fixed somehow?

[1] http://pharo.pharocloud.com/bootstrap/browser/Alerts
[2] http://pharo.pharocloud.com/rickshaw

Esteban A. Maringolo



Re: [Pharo-users] Web stack practices (Glorp / QCMagritte)

2017-09-18 Thread Esteban A. Maringolo
Laurent,

Regarding QCMagritte I don't know, since I don't use it. I've used
Magritte and Glorp, but didn't bind them, the only special thing I
built for it was an "evented memento" that let me edit a tree of
objects (1:N relations derived from the edited object) within a single
DB transaction.

Regarding migrations I recently found that in VisualWorks Glorp
provides a migration-like strategy, where you define a subclass of a
root Description system, and then can use the diffing to create the
migration.

According to the VW docs, you can do it like this:
sessOld := MyDescriptorSystem new sessionForLogin: aLogin.
sessNew := MyDescriptorSystem01 new sessionForLogin: aLogin.
sessOld system migrateTo: sessNew system.

Such feature is not available in the Pharo port, and migrations are
not automatic, since you need a new class for each migration.
It is something I'd need to play with before porting it to Pharo, if
it's worth it.
Maybe we think about another strategy but still using the DDL objects of Glorp.

Regards!

Esteban A. Maringolo


2017-09-18 7:22 GMT-03:00 laurent <laurent.laff...@gmail.com>:
> Hi all,
>
> it's been a long time :) At work we are currently comparing several
> technologies to start a business project that will hopefully be used by
> thousands of people for several years ;)
>
> We need a web stack and we put Pharo & co in the comparative process. My
> team have strong experience in  load-balanced php / mysql deployment that
> handles millions of records  but we are ready to build on something else
> though MySQL is still a requirement.
>
> Thanks for Garage + Glorp, I can prototype things. I wonder how to handle
> database schema migrations. With our PHP projects we have versionned PHP
> scripts that are automatically run given a database revision number ( see
> http://git.afi-sa.fr/afi/opacce/tree/master/cosmogramme/sql/patch ). What
> are the practices with Glorp ?
>
>
> We try QCMagritte and we enjoy what we see so far. What are the best
> practices to glue Magritte and Glorp together ? Especially when you
> load-balance requests on several images. Some examples ?
>
> ( FYI, I cannot load QCMagritte in a fresh Pharo 6 image ( for #stable
> version, MADescriptionBuilder missing. For #development versions of Magritte
> and QCMagritte, QCConfiguration missing ). So actually I use the one built
> on CI. )
>
>
> May be you have some other suggestions on a framework you love ?
>
>
> Best regards,
>
> Laurent Laffont
>
>
>
>
>



Re: [Pharo-users] How to convert avoiding parser

2017-09-13 Thread Esteban A. Maringolo
Hi,

Side note: Please sanitize the strings you use for the concatenation
or use prepared statements, otherwise you could be vulnerable to SQL
INJECTION attacks.

Best regards,

Esteban A. Maringolo


2017-09-13 17:34 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
>
>> On 13 Sep 2017, at 19:44, Casimiro de Almeida Barreto 
>> <casimiro.barr...@gmail.com> wrote:
>>
>> Hello,
>>
>> Perhaps someone can help me with this problem: I'm saving a key pair in a 
>> mariadb/mysql table as follows:
>>
>> str := 'INSERT INTO chaves_de_encriptacao (numero_funcional, 
>> chave_privada, chave_publica) '.
>> str := str,'VALUES ('''.
>> str := str, self personId leaId asString, ''', '''.
>> str := str, self keyPair privateKey asAsn1DerBytes asByteArray hex, ''', 
>> '''.
>> str := str, self keyPair publicKey  asAsn1DerBytes asByteArray hex,''')'.
>>
>> [ dbConnection execute: str ] on: Exception do: [ ^ false ].
>>
>> And I'd like to recover the keys (SELECT * FROM chaves_de_encriptacao WHERE 
>> numero_funcional = 1010) and then reconvert in order to recover the original 
>> keys. Obviously I can do that by writting a parser that will get the hex and 
>> bring it back to binary but I'd like to avoid it.
>>
>> Question is: is there a reverse for asByteArray hex?
>
> Yes:
>
> ByteArray readHexFrom: #[ 0 1 2 3 4 5 6 7 8 9 10 ] hex.
>
> HTH,
>
> Sven
>
>
>



Re: [Pharo-users] Object>>#name deprecated in Pharo 6 -- what do I need to do?

2017-09-11 Thread Esteban A. Maringolo
2017-09-11 14:44 GMT-03:00 Norbert Hartl <norb...@hartl.name>:
>> Am 11.09.2017 um 19:05 schrieb H. Hirzel <hannes.hir...@gmail.com>:

>> Now  488 out of 479 tests pass.
> I would call that superb quality 

It's a 10+taxes as we say :)


Esteban A. Maringolo



Re: [Pharo-users] Standalone HTML Model

2017-09-11 Thread Esteban A. Maringolo
I don't know how modular it is, but maybe loading only the 'Seaside-Canvas'
package you can use the WAHtmlCanvas to create the HTML content.

I used it together with Mandrill client by creating the mail body with the
result of `WAHtmlCanvas builder render: [ :html | ... ]`.

HTH.

Regards,



Esteban A. Maringolo

2017-09-11 7:31 GMT-03:00 Pierce Ng <pie...@samadhiweb.com>:

> On Fri, Sep 08, 2017 at 03:15:56PM -0700, Sean P. DeNigris wrote:
> > I'd like to create HTML via a DSL, like Seaside's canvas builder, but
> without
> > loading a whole web framework. Any ideas?
>
> I wrote this but subsequently decided that loading the whole of Seaside
> into my
> image just for this functionality is ok and stopped.
>
>   http://smalltalkhub.com/#!/~PierceNg/WaterMint-HTML
>
> Pierce
>
>
>


Re: [Pharo-users] Dark Mode

2017-08-28 Thread Esteban A. Maringolo
I think it not only a matter of user preference, but also environment
lighting conditions.
In bright environments, as with natural light, I prefer to use the
light theme. At night or with artificial light dark theme fits better.

Regards,


Esteban A. Maringolo


2017-08-28 9:30 GMT-03:00 Tim Mackinnon <tim@testit.works>:
>
> I found the place to adjust this - but I need to debug it as it seems my
> change also effects the colour used to highlight selected text (which is
> weird).
>
> If you modify the following method (possibly in a subclass), I found this
> helped - but haven’t figured out why text highlight colour would be impacted
> by this change?
>
> configureWindowBorderFor: aWindow
> "Made window borders a bit thcker and slightly lighter to its easier to
> distinguish
> overlapping windows"
> | aStyle |
> aStyle :=
> SimpleBorder new
> color: self borderColor lighter lighter lighter;
> width: 2.
> aWindow borderStyle: aStyle.
>
>
> Tim
>
> On 28 Aug 2017, at 01:08, PBKResearch <pe...@pbkresearch.co.uk> wrote:
>
> Dimitris
>
>
>
> Update – there is a sort of bug in the screenshot, which I have caused. I
> opened the page with my usual light theme, then changed themes. This updated
> the colour of the background, but not the text in the foreground. If I open
> the same playground display with the dark theme, the text is white and shows
> up OK. But I still don’t like it.
>
>
>
> Peter Kenny
>
>
>
> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of
> PBKResearch
> Sent: 27 August 2017 23:48
> To: 'Any question about pharo is welcome' <pharo-users@lists.pharo.org>
> Subject: Re: [Pharo-users] Dark Mode
>
>
>
> Dimitris
>
>
>
> Screenshot attached. Look particularly at the text in the right-hand page of
> the playground. Also the control buttons of the playground window – the
> buttons go black when the window gets focus. I opened the ‘About’ window so
> you can see which version I have – not yet Pharo 6.1, but not very out of
> date.
>
>
>
> Peter Kenny
>
>
>
> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of
> Dimitris Chloupis
> Sent: 27 August 2017 23:10
> To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
> Subject: Re: [Pharo-users] Dark Mode
>
>
>
> Also most don't know this but light themes of Pharo were in part hard coded.
> Esteban in order to create the dark theme which is based on the most popular
> dark theme ( if my memory serves correctly) , Darcula , he had to remove all
> this nasty code. He essentially made it possible for Pharo to have themes
> without worrying about hard coded colors. So if you ever want to make the
> light theme even lighter you have the dark theme to thank for making it
> easier for you.
>
> Quite an irony , would not agree ?
>
> If the doctors say your eye sight is great , he knows what he is talking
> about.
>
> Black foreground against dark grey background sound like a bug. Care to
> share a screenshot ?
>
> On Mon, 28 Aug 2017 at 00:51, PBKResearch <pe...@pbkresearch.co.uk> wrote:
>
> I agree with Dimitris - it is all a matter of preference - not all eyes are
> the same. For myself, I find the default dark theme in Pharo very
> uncomfortable. On my system, some elements have a black foreground on a dark
> grey background, which is almost impossible to see. This is always true of
> the maximise/minimise/close buttons, but sometimes also of text fields in a
> playground. Whenever I download a new image, I immediately switch to the
> Watery theme, with light background and nice coloured buttons on the
> windows.
>
> Of course, my eyes may not be typical. I am now aged 84, and I have had
> cataract operations on both eyes. My sight is actually quite good - my
> optometrist confirms that I am legal to drive without spectacles - but my
> adverse reaction to dark mode is strong and immediate.
>
> Just my 2p worth
>
> Peter Kenny
>
> -Original Message-
> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of
> stephan
> Sent: 27 August 2017 21:46
> To: pharo-users@lists.pharo.org
> Subject: Re: [Pharo-users] Dark Mode
>
> On 27-08-17 22:37, Dimitris Chloupis wrote:
>> White or dark is a matter of preference. But the matter of preference
>> is also a matter of biology . Not all eyes are same.
>
> The research is pretty clear: a large majority of developers does better
> with light themes. I have been sufficiently clear on the choice to make
> Pharo6 theme dark default
>
> Stephan
>



Re: [Pharo-users] [ANN] Pharo wiki , is here

2017-08-24 Thread Esteban A. Maringolo
Why are you using markup documents to create the wiki when you could
use Github wiki itself?

For portability?
Esteban A. Maringolo


2017-08-24 9:59 GMT-03:00 Dimitris Chloupis <kilon.al...@gmail.com>:
> Actually I have already done this
>
> https://github.com/SquareBracketAssociates/PharoWiki/blob/master/contents/projects.md
>
> when he announced the project on the mailing list, but thanks for trying to
> inform me, I appreciate it. I will try to update the wiki each time
> something new pops up in the mailing list that is usable which means
> a) new project
> b) some kind of news of general interest about pharo
> c) some kind of documentation (article, pdf, power point, blog post etc)
> about pharo or third party library/tool
>
> On Thu, Aug 24, 2017 at 3:38 PM H. Hirzel <hannes.hir...@gmail.com> wrote:
>>
>> Another thing to add
>>
>> link to
>> https://github.com/dionisiydk/TelePharo
>>
>> with short description
>>
>> Complete toolset for remote development of Pharo images. It includes:
>>
>> remote playground
>> remote browser
>> remote debugger
>> remote inspector
>> remote process browser
>>
>>
>>
>> On 8/22/17, Dimitris Chloupis <kilon.al...@gmail.com> wrote:
>> > absolutely
>> >
>> > done !
>> >
>> >
>> > https://github.com/SquareBracketAssociates/PharoWiki/blob/master/contents/projects.md
>> >
>> > On Tue, Aug 22, 2017 at 10:28 PM Stephane Ducasse
>> > <stepharo.s...@gmail.com>
>> > wrote:
>> >
>> >> You should add the script that generate the list of catalog items so
>> >> that we can update it.
>> >>
>> >> On Tue, Aug 22, 2017 at 8:18 PM, Dimitris Chloupis
>> >> <kilon.al...@gmail.com> wrote:
>> >> > Ok I restructured the wiki , giving it a table of contents.
>> >> >
>> >> > Added Pharo 6 Catalog projects
>> >> > Added PettitParser2
>> >> > Added a sections for How tos , and a couple of them
>> >> > Added a news section
>> >> > Added a link to Grafoscopio homepage at its Catalaog section
>> >> > Added a wikis section with a link to Astares Pharo wiki
>> >> >
>> >> > Keep your suggestions coming , thank you Hirzel
>> >> >
>> >> > https://squarebracketassociates.github.io/PharoWiki/
>> >> >
>> >> >
>> >> > On Mon, Aug 21, 2017 at 7:19 PM H. Hirzel <hannes.hir...@gmail.com>
>> >> wrote:
>> >> >>
>> >> >> Please add the reference to the PetitParser2 book
>> >> >>
>> >> >> https://kursjan.github.io/petitparser2/pillar-book/build/book.html
>> >> >>
>> >> >> On 8/21/17, H. Hirzel <hannes.hir...@gmail.com> wrote:
>> >> >> > And this one produces a catalog list in markdown format
>> >> >> >
>> >> >> > "Produce a list of Pharo 6 catalog entries (tag: 'Pharo 6.0')"
>> >> >> > | catalog |
>> >> >> > catalog :=  CatalogProvider default retrieveProjects select: [ :x
>> >> >> > |
>> >> >> > (x at: 'repositoryUrl') =
>> >> >> > 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPharo60/main' ].
>> >> >> >
>> >> >> > Transcript show: '# Pharo 6 catalog list'; cr.
>> >> >> >
>> >> >> > (catalog asSortedCollection: [ :a :b | (a at: 'name') < (b at:
>> >> >> > 'name')
>> >> >> > ]) do: [ :entry | Transcript show: '## ', (entry at: 'name') ; cr;
>> >> >> >   show:  (entry at: 'description'); cr;cr.
>> >> >> >   Transcript show: 'keywords: '.
>> >> >> >   (entry at: 'keywords') sorted do: [ :keyword | Transcript
>> >> >> > show:
>> >> >> > keyword; space ].
>> >> >> >   Transcript cr; cr].
>> >> >> >
>> >> >> > Transcript show: '# Pharo 6 catalog list - description is
>> >> >> > missing';
>> >> cr.
>> >> >> >
>> >> >> > (catalog asSortedCollection: [ :a :b | (a at: 'name') < (b at:
>> >> >> > 'name')
>> >> >> > ])
>> >> >> > do: [:entry | (entry at: 'description') i

Re: [Pharo-users] Minimizing an Application

2017-08-24 Thread Esteban A. Maringolo
2017-08-24 14:51 GMT-03:00 stephan <step...@stack.nl>:
> On 22-08-17 12:46, horrido wrote:
>>
>> If you start with a minimal imaqe, it's not obvious to me how you'd add a
>> missing class and pull in all of its dependencies (which can be
>> voluminous).
>> And for a large application, there could be many, many missing classes.
>> This
>> sounds rather arduous.

> That has been solved by Craig years ago. Instead of DNU you just load the
> code from a connected image.

Has this been tested in Pharo? I'm aware of this since I have memory,
but I haven't know of any production system using it.

Regards!

Esteban A. Maringolo



Re: [Pharo-users] Minimizing an Application

2017-08-22 Thread Esteban A. Maringolo
VAST provided such image deployment tool, where you could save the
deployment instructions, as whether to include/exclude certain
packages, classes, methods, etc.  It was great, although it wasn't
"easy" to work with.

Dolphin Smalltalk has an Image Stripper, that does something like
that, but by "removing" stuff from a copy of the image, it worked
really well in practice and was super easy to use. Also, you can
decide what "SessionManager" will be used in the deployed image, for a
normal development image, it is DevelopmentSessionManger, but for a
web app it could be a CommandLineSessionManager, or if you have a GUI
desktop app, it could be your own session manager class.

But what I liked the most was VisualSmalltalk's SLL (Smalltalk's
Linked Library), where you could "link" your application with true
modules, that were binary. You explicitly specify its contents
(classes, methods, pools, etc.) when building (compiling), and could
be replaced without having to redeploy everything. It could lead to
some dependency hell if done wrong, but not more than any other module
solution. And they were very compact.

In my Pharo deployments, since they are web applications, I always
deployed the whole image in the server, built from a vanilla one, but
without stripping anything.

Regards,

Esteban A. Maringolo


2017-08-22 0:22 GMT-03:00 Richard Sargent <richard.sarg...@gemtalksystems.com>:
> VA Smalltalk doesn't strip an image; it builds a new image based on
> application dependencies. With VA's packaging functionality, you are more
> likely to get a packaging error that reports you are trying to use something
> that isn't reachable according to the defined dependencies.
>
> I admit that except for the first few years, most of my early Smalltalk
> experience involved ENVY and VA/VisualAge Smalltalk. Still, I prefer it's
> practice of building an image based on what you have told it to include.
>
> On Aug 21, 2017 15:22, "Tim Mackinnon" <tim@testit.works> wrote:
>>
>> There has been a lot of great work on this front on the Pharo side from
>> the "team" and PharoLambda has made use of it (although it's a tiny
>> project).
>>
>> My footprint is ~22mb including vm & image. And leaving out sources.
>>
>> The ./scripts directory has the example of how to do it, along side the
>> .gitlab-ci.yml file.
>>
>> Unlike the commercial distributions (and this may have changed recently),
>> there is a minimal image you can have download, which has enough to
>> bootstrap loading your project via metacello. There are no browser tools or
>> morphic things in the starting image I have chosen.
>>
>> You can potentially get smaller - but it's a decent result. The only bit I
>> added was to remove testcases (optional), and clear down metacello.
>>
>> It's probably worthy of a blog post - but honestly the running example is
>> pretty straight forward.
>>
>> The commercial tools all have a decent "strip dead code" tool, that does a
>> similar thing in reverse - which is equally a decent way of approaching the
>> problem and can lead to even tinier results.
>>
>> Tim
>>
>> Sent from my iPhone
>>
>> On 21 Aug 2017, at 21:25, horrido <horrido.hobb...@gmail.com> wrote:
>>
>> I received this comment on Facebook:
>>
>> Smalltalk is a fantastic language and its development environment can't be
>> beat... But the documentation for the many open source implementations is
>> contradictory or confusing or missing. I can't speak for the commercial
>> versions. Without an experienced mentor it is not possible to create a
>> complex app. And even when you have done so, *I know no way to strip out
>> the
>> unused part of the image as well as the embedded source code*.
>> -
>>
>> This issue of stripping out unused code seems to recur a lot. And truth be
>> told, I've never seen a clear explanation of how to do this. Can someone
>> provide clear direction? Is this documented anywhere? I'd like to use the
>> information in future to assuage other people's concerns.
>>
>> Thanks.
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Minimizing-an-Application-tp4963262.html
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>
>



Re: [Pharo-users] [ANN] Pharo wiki , is here

2017-08-21 Thread Esteban A. Maringolo
In my previous company we ran Swiki served wikis for most of our
customers during years of uninterrupted uptime, it has proven to be
really stable, and a single image could handle lots of simultaneous
users.

We ended up moving to Atlassian Confluence because of a better
granularity of user permissions and some "enterprisey" features, but
we all missed the simplicity of Swiki. To migrate the content from
Swiki to Confluence what we did was to implement a crawler/spider that
navigated the wiki contents and recreated the pages in the new server
(with some replacements because of different syntax).

So if Torsten's wiki has lots of contents (I wasn't aware of it), and
most people want to move to a new wiki server, we should consider
recovering Swiki's content.  It's a fun project as well (if you have
the time).

Regards,

Esteban A. Maringolo


2017-08-20 6:43 GMT-03:00 Torsten Bergmann <asta...@gmx.de>:
>>> Many seemed to like the idea of a Pharo wiki , I like it too. I created
>>> one, can be found here and super easy to contribute to.
>>>
>>> https://github.com/SquareBracketAssociates/PharoWiki
>
> I still prefer to have one based on Smalltalk and as there never was an 
> official one
> maintain my own private hosted Pharo wiki since 2015
>
>http://wiki.astares.com/pharo
>
> including lots of useful informations.
>
> It us a Swiki server ("Winterlong" release) - so it is based on Squeak + 
> Comanche.
> http://wiki.squeak.org/swiki/
>
> I once offered it to the community but there were doubts as Swiki is not more
> maintained and a Pharo solutions would be preferable.
>
> Unfortunately there never was a Pharo based wiki implementation although we 
> have all the bits
> and pieces (Pillar, Teapot/Tealight, Zinc, ...) to write one.
>
> I have several swikis running over the years and all of them run very very 
> stable and
> without any problems. Even in case of trouble they are easy to repair and 
> extend as the
> content is written into XML files.
>
> Also it has an UNZIP and go concept - so it is easy to install/run and 
> maintain or move
> to a different server. Squeak community is running their swiki for years 
> already.
> The only problem there is that it is not well maintained and lost of pages 
> are outdated
> - but this is a problem independent from the wiki technology used.
>
> So creating a wiki is quick and easy - be able to maintain up to date infos 
> another issue.
>
> Thanks
> T.
>
>
>
>
>



Re: [Pharo-users] What is proper fix for this?

2017-08-17 Thread Esteban A. Maringolo
2017-08-17 6:51 GMT-03:00 Esteban Lorenzano <esteba...@gmail.com>:
> > On 17 Aug 2017, at 11:34, jtuc...@objektfabrik.de wrote:
> > Am 17.08.17 um 11:31 schrieb Esteban Lorenzano:
> >>> On 17 Aug 2017, at 11:28, jtuc...@objektfabrik.de wrote:
> >>>
> >>> Herby,
> >>>
> >>> back when Alan was maintaining Glorp, he took care for portability, he 
> >>> even maintained the port to VA Smalltalk, IIRC. Niall and Tim(?) at 
> >>> Cincom also try not to break any dialect in their changes and they also 
> >>> work on keeping things portable. I am not sure there ever was any 
> >>> (semi-)automated process to keep ports in sync, my guess would be that 
> >>> that is not the case.
> >>>
> >>> What I am very sure of is that the ppl at Cincom would welcome any 
> >>> volunteers to support them in keeping things portable and improve the 
> >>> ecosystem for this.
> >>> Is any of you going to be at ESUG?
> >> I will, but I will not maintain Glorp port… I have just too much work :)
> > Same for me. I am not a regular Pharo user, so I cannot do it.
>
> yeah… too bad :(
> “unofficial maintainer” of Glorp port is Esteban Maringolo. But since he has 
> to make a living (and right now he is working on VW, not Pharo), he cannot do 
> it but lightly.
> Other maintainers should be the people using it, so the addition of Herby is 
> welcome (Esteban M. will check at when he has time… but at least now is 
> available for other people to check).

Glorp was built with portability in mind, but it's too "old school",
the packaging itself is a nightmare. And most of the design, and
"portable" parts are designed around VW database layers. The code
sharing is a thing in its own, I had to "adapt" a Monticello exporter
in VW to get better package names instead of a single "Glorp" package.

FileTree is stilll not available in Cincom, Martin McLure said they're
working in a new Cypress spec that'd work in VW as well, I look
forward to see that, because I'd need it to move code back/forth Pharo
and VW.

Last year I did a port to Pharo from the latest availalable version in
Cincom and tried to keep both in sync, but the feedback loops are
quite different in Pharo than Cincom, skillsets are also different
(I'm still struggling with Store), and even with some support, Cincom
doesn't have portability as a main objective, Glorp today is a means
to and end, and that end is their SCM, Store. So modifying a core tool
just to be more portable is not a priority for them.

Also the way Glorp is made portable is very differently from how
Seaside is done, Glorp has a lot of #isVW, #isSqueak, #isPharo, etc...
which I removed from the latest port.
The last time I did not dare to "hard-fork" the whole project and
refactor it, maybe the next time.

> I myself keep track of my own beast: Voyage… but thankfully I can just check 
> time to time since we have a small but active community around it. Ideal 
> situation for Glorp would be having the same.

I'm a "happy"[1] user of ORMs, and used them in Smalltalk for over a
decade (in Pharo for a couple of years), unfortunately for Glorp, I've
been coding for GemStone based projects and now also Glorp but in VW,
with SQLite for a minimal part of the application.

So, bottom line,  it takes me some time to catch-up and get into ORM
"mode", since it's something I'm not doing every day.

Best regards!


Esteban A. Maringolo



[Pharo-users] GTInspect auto-update in raw view?

2017-08-16 Thread Esteban A. Maringolo
Hi all,

Is there a way to enable the auto-update of instance variables display in
the GTInspector?

There are cases where the instance is nil, I then initialize it somehow,
but the variable is still displayed as nil.

I know there is an "Update" button, which BTW should be labeled "refresh"
instead, to do it manually, but hey, this is Smalltalk, we invented MVC :D

We can consider the previous as a feature, but what I think it is a bug is
that if the variable is nil, and later it is initialized, nil is still
displayed, but when clicked the nodes below it shows the variables of the
new object in the instance variable.

E.g.
[image: Imágenes integradas 1]

Is this a bug or a feature?

Regards!

Esteban A. Maringolo


Re: [Pharo-users] What is proper fix for this? (was: Re: Big Glorp problem w/ type coercion, pls help)

2017-08-16 Thread Esteban A. Maringolo
Herby,

Please apologize I can't take the time to look into your code.

I granted you write access to
<http://smalltalkhub.com/#!/~DBXTalk/Glorp/>, could you upload your
latter version to it?

Regards!
Esteban A. Maringolo


2017-08-15 19:07 GMT-03:00  <he...@mailbox.sk>:
> BTW I took the latter way (as method tries to be as optimized as
> possible), it is in
> http://smalltalkhub.com/#!/~herby/Glorp/versions/Glorp-HerbyVojcik.127,
> consider merging in. Thanks.
>
> Herby Vojčík wrote:
>> Hello!
>>
>> I think I found the culprit. Few methods posted here:
>>
>>
>> Mapping >> expressionFor: anObject basedOn: anExpression relation:
>> aSymbol
>> "Return our expression using the object's values. e.g. if this was a
>> direct mapping from id->ID and the object had id: 3, then return
>> TABLE.ID=3. Used when rewriting object=object into field=field"
>>
>> | myValue result |
>> myValue := self expressionFor: anObject.
>> result := nil.
>> myValue with: self join allTargetFields do: [:eachValue :eachField |
>> | source |
>> source := anExpression get: self attribute name.
>> source hasDescriptor ifTrue: [source := source getField: eachField].
>> result := (source get: aSymbol withArguments: (Array with: eachValue))
>> AND: result].
>> ^result
>>
>>
>>
>> DirectMapping >> expressionFor: anObject basedOn: anExpression relation:
>> aSymbol
>> "Return our expression using the object's values. e.g. if this was a
>> direct mapping from id->ID and the object had id: 3, then return
>> TABLE.ID=3"
>>
>> | value |
>> value := anObject isNil
>> ifTrue: [nil]
>> ifFalse:
>> [anObject isGlorpExpression
>> ifTrue: [anObject getMapping: self named: self attributeName]
>> ifFalse: [anObject glorpIsCollection
>> ifTrue: [anObject collect: [:each | attribute getValueFrom: each]]
>> ifFalse: [attribute getValueFrom: anObject]]].
>> ^(anExpression get: self attribute name) get: aSymbol withArguments:
>> (Array with: value)
>>
>>
>>
>> Mapping >> expressionFor: anObject
>> "Return an expression representing the value of the object. This can be
>> nil, an object value or values, an expression, or a collection of
>> expressions (for a composite key, if we're passed an expression)"
>>
>> anObject isNil ifTrue: [^#(nil)].
>> anObject isGlorpExpression ifFalse: [
>> ^self mappedFields collect: [:each |
>> self valueOfField: each fromObject: anObject]].
>> ^self mappedFields
>> collect: [:each | (anObject getField: each)]
>>
>>
>>
>> Mapping >> getValueFrom: anObject
>>
>> ^self attribute getValueFrom: anObject
>>
>>
>>
>> DirectMapping >> valueOfField: aField fromObject: anObject
>> field = aField ifFalse: [self error: 'Mapping doesn''t describe field'].
>> ^self convertedDbValueOf: (self getValueFrom: anObject)
>>
>>
>>
>> DirectMapping >> mappedFields
>> "Return a collection of fields that this mapping will write into any of
>> the containing object's rows"
>>
>> ^Array with: self field
>>
>>
>> The thing is, both Mapping >> expressionFor:basedOn:relation: and the
>> overridden DirectMapping's version eventually send
>>
>> someSource get: aSymbol withArguments: (Array with: eachValue)
>>
>> but in Mapping's code, the value is taken from `myValue := self
>> expressionFor: anObject`. which, as seen in #expressionFor: code, gets
>> the value via
>>
>> self valueOfField: aMappedField fromObject: anObject
>>
>> and indeed, if tried aDirectMapping expressionFor: anObject in debugger,
>> it gets the value of the primary key converted in the below case (that
>> is, as a ByteArray). This is clear from the DirectMapping >>
>> valueOfField:fromObject: code above, which does `self getValueFrom:
>> anObject` (which passes it to `attribute getValueFrom: anObject`)
>> _and_converts_it_.
>>
>> But in the overridden DirectMapping >> expressionFor:basedOn:relation:,
>> the value to be passed in the
>>
>> someSource get: aSymbol withArguments: (Array with: value)
>>
>> is obtained by direct
>>
>> attribute getValueFrom: anObject
>>
>> but _is_not_converted_. IOW, it seems this method was heavily optimized
>> (`attribute getValueFrom:` instead of `self getValueFrom:`, for
>> example), but the conversion, normally present via expressionFor: and
>> ultimately valueOfField:fromObject: was opti

Re: [Pharo-users] Encoding Login information in your image (safely)

2017-08-16 Thread Esteban A. Maringolo
2017-08-16 13:55 GMT-03:00 Tim Mackinnon <tim@testit.works>:
> ./pharo Pharo.image eval "(ByteString allInstances)”
>
> I think you would ulimtately find those strings unless the Class encrypts
> them in some way right?
>
> So I’m wondering why we don’t have an EncryptedString object for just this
> (I’ve seen lots of cryptography libraries etc), but isn’t this quite a
> common thing to deal with? And should Pharo provide something that library
> writers adopt to encourage better image safety? Or am I wrong in my
> analysis?

It is something imporant, and maybe exceeds Pharo itself and needs
sound criptography techniques to overcome, like zero knowledge proofs.

It is very common to have "config files" sitting in the same directory
as the image, with the credentials to access a remote API, a database
or both.

My solution in the cases where I was worried about a config file leak
was to mitigate the risk, by using symmetric encryption algorithms,
where the shared secret is split in two different strings and
concatenated at runtime. The image, in turn holds the encryption key
also split as two literals. This way the encryption key is not "saved"
as a whole literal in the image.

In your case you might have to break the secret in more than one part,
and pass the parts as arguments. You could also pass it encrypted and
decrypt it using the above mentioned technique.

It's dirty and it helps with the mentioned mitigation, but it's well
known that security by obfuscation won't get you far.

Regards,

Esteban A. Maringolo



Re: [Pharo-users] Big Glorp problem w/ type coercion, pls help

2017-08-14 Thread Esteban A. Maringolo
Do you have the code somewhere loadable? Reading chunk is something I
do only when everything crashed :D
Esteban A. Maringolo


2017-08-14 13:44 GMT-03:00 Herby Vojčík <he...@mailbox.sk>:
> Hello!
>
> I encountered a problem with OneToOneMapping and type coercion. When writing
> data, thing work; when reading data, the right child of relation fails to
> convert.
>
> I tried everything possible to inject converters (even subclassing
> GlorpBlobType), but to no avail. RelationExpression passes conversion to its
> left child:
>
> convertedDbValueOf: anObject
> "Assume that our types match, so we can ask either child to do the
> conversion. That isn't guaranteed, but should at least work for the common
> cases."
> ^leftChild convertedDbValueOf: anObject.
>
> but the left child is FieldExpression in case of OneToOneMapping, which:
>
> convertedDbValueOf: anObject
> "We don't do any conversion"
> ^anObject
>
> What is strange, writing works (even the OneToOneMapping, I opened the
> sqlite file with an explorer), but second SELECT, one using the relation
> (`state := self dao findStateByAgent: agent` in clientSync), fails with
> "GlorpDatabaseReadError: Could not coerce arguments". FWIW, the first one
> _does_ convert when creating bindings, as it uses MappingExpression as left
> child (stepped over it in debugger).
>
>
>
> Is it meant to be a strange case that primary key is something non-primitive
> needing coercion (in this case, it is a UUID which needs coercion to
> ByteArray, even if it is its subclass)?
>
>
>
> Here's the stack of running the test which fails:
>
> PharoDatabaseAccessor(DatabaseAccessor)>>handleError:for:
> [ :ex | self handleError: ex for: command ] in [ | result |
> self checkPermissionFor: command.
> result := [ (self useBinding and: [ command useBinding ])
> ifTrue: [ command executeBoundIn: self ]
> ifFalse: [ command executeUnboundIn: self ] ]
> on: Dialect error
> do: [ :ex | self handleError: ex for: command ].
> aBoolean
> ifTrue: [ result ]
> ifFalse: [ result upToEnd ] ] in
> PharoDatabaseAccessor(DatabaseAccessor)>>executeCommand:returnCursor:
> BlockClosure>>cull:
> Context>>evaluateSignal:
> Context>>handleSignal:
> Error(Exception)>>signal
> Error(Exception)>>signal:
> ExternalLibraryFunction(Object)>>error:
> ExternalLibraryFunction(Object)>>externalCallFailed
> ExternalLibraryFunction(ExternalFunction)>>invokeWithArguments:
> UDBCSQLite3Library>>apiBindBlob:atColumn:with:with:with:
> UDBCSQLite3Library>>with:at:putBlob:
> UDBCSQLite3Statement>>at:putByteArray:
> UDBCSQLite3ResultSet>>execute:withIndex:withValue:
> [ :v | i := self execute: statement withIndex: i withValue: v ] in
> UDBCSQLite3ResultSet>>execute:withCollection:
> OrderedCollection>>do:
> UDBCSQLite3ResultSet>>execute:withCollection:
> UDBCSQLite3ResultSet>>execute:with:on:
> UDBCSQLite3Connection>>execute:with:
> GlorpSQLite3Driver>>basicExecuteSQLString:binding:
> PharoDatabaseAccessor>>executeCommandBound:
> QuerySelectCommand(DatabaseCommand)>>executeBoundIn:
> [ (self useBinding and: [ command useBinding ])
> ifTrue: [ command executeBoundIn: self ]
> ifFalse: [ command executeUnboundIn: self ] ] in [ | result |
> self checkPermissionFor: command.
> result := [ (self useBinding and: [ command useBinding ])
> ifTrue: [ command executeBoundIn: self ]
> ifFalse: [ command executeUnboundIn: self ] ]
> on: Dialect error
> do: [ :ex | self handleError: ex for: command ].
> aBoolean
> ifTrue: [ result ]
> ifFalse: [ result upToEnd ] ] in
> PharoDatabaseAccessor(DatabaseAccessor)>>executeCommand:returnCursor:
> BlockClosure>>on:do:
> [ | result |
> self checkPermissionFor: command.
> result := [ (self useBinding and: [ command useBinding ])
> ifTrue: [ command executeBoundIn: self ]
> ifFalse: [ command executeUnboundIn: self ] ]
> on: Dialect error
> do: [ :ex | self handleError: ex for: command ].
> aBoolean
> ifTrue: [ result ]
> ifFalse: [ result upToEnd ] ] in
> PharoDatabaseAccessor(DatabaseAccessor)>>executeCommand:returnCursor:
> [ caught := true.
> self wait.
> blockValue := mutuallyExcludedBlock value ] in Semaphore>>critical:
> BlockClosure>>ensure:
> Semaphore>>critical:
> PharoDatabaseAccessor(DatabaseAccessor)>>executeCommand:returnCursor:
> [ session accessor executeCommand: command retu

Re: [Pharo-users] Honest question, new to ecosystem: are Glorp and Garage alive?

2017-08-14 Thread Esteban A. Maringolo
2017-08-14 9:07 GMT-03:00 Herby Vojčík <he...@mailbox.sk>:
>> Garage is not maintained as people started developing the alternative
>> UDBC drivers, that share the same spirit at the end. I do not know if
>> they share the same API though.
>
> I did not know. So I should use ConfigurationOfGlorpSQLite instead of
> ConfigurationOfGarageGlorp as my dependency?

In the Glorp booklet these are the instructions to install SQLite:

Gofer it
  smalltalkhubUser: 'TorstenBergmann' project: 'UDBC';
  configuration;
  load.

(Smalltalk at: #ConfigurationOfUDBC) loadBleedingEdge.

Gofer it
  smalltalkhubUser: 'DBXTalk' project: 'Garage';
  configurationOf: 'GarageGlorp';
  load.

(Smalltalk at: #ConfigurationOfGarageGlorp) project stableVersion
  load.

Gofer it
  smalltalkhubUser: 'DBXTalk' project: 'Glorp';
  package: 'Glorp-SQLite3';
  load.



>> About Glorp, I will let Esteban Maringolo ask :).
> It seems from other responses that Glorp is fine. :-)

Glorp was updated in Pharo last year from the latest version in Cincom
Public Repository, although a year might seem like a lot, it isn't
much because Glorp is mostly in "maintenance", and the ORM domain
isn't a moving target anymore.

What we're still lacking is better database drivers, not for Glorp
which supports many, but in terms of low level connectivity.

I really liked the idea of an unified driver layer the way UDBC was
taking, unfortunately this was put to a halt.
Maybe we should focus on having good reliable native drivers instead
of trying to support all and end up having incomplete support for only
a few.

Regards!


Esteban A. Maringolo

ps: I'm currently not doing any RDBMS on Pharo, and that's why I'm not
"updating" Glorp with minor/usability changes, but I'm using Glorp
with SQLite in VW, so in the future I might update Pharo's port if
there are changes. However those update must be manual, since Glorp
isn't coordinated to be portable as Seaside or other projects are.



Re: [Pharo-users] [ANN] PharoLambda 1.5 - Pharo running on AWS Lambda now with saved Debug sessions via S3

2017-08-10 Thread Esteban A. Maringolo
Hi Tim,

Impressive pet project you have. And what a way to deliver! Not only
with fun features never built before, but also with a documented repo
and a detailed screencast.

Congratulations.

In my self interest, and indirectly for the Pharo community, I look
forward to see more contributions like this from you.

Regards!

Esteban A. Maringolo


2017-08-10 10:47 GMT-03:00 Tim Mackinnon <tim@testit.works>:
> I just wanted to thank everyone for their help in getting my pet project
> further along, so that now I can announce that PharoLambda is now working
> with the V7 minimal image and also supports post mortem debugging by saving
> a zipped fuel context onto S3.
>
> This latter item is particularly satisfying as at a recent serverless
> conference (JeffConf) there was a panel where poor development tools on
> serverless platforms was highlighted as a real problem.
>
> In our community we’ve had these kinds of tools at our fingertips for ages -
> but I don’t think the wider development community has really noticed.
> Debugging something short lived like a Lambda execution is quite startling,
> as the current answer is “add more logging”, and we all know that sucks. To
> this end, I’ve created a little screencast showing this in action - and it
> was pretty cool because it was a real example I encountered when I got
> everything working and was trying my test application out.
>
> I’ve also put a bit of work into tuning the excellent GitLab CI tools, so
> that I can cache many of the artefacts used between different build runs
> (this might also be of interest to others using CI systems).
>
> The Gitlab project is on: https://gitlab.com/macta/PharoLambda
> And the screencast: https://www.youtube.com/watch?v=bNNCT1hLA3E
>
> Tim
>
>
> On 15 Jul 2017, at 00:39, Tim Mackinnon <tim@testit.works> wrote:
>
> Hi - I’ve been playing around with getting Pharo to run well on AWS Lambda.
> It’s early days, but I though it might be interesting to share what I’ve
> learned so far.
>
> Usage examples and code at https://gitlab.com/macta/PharoLambda
>
> With help from many of the folks here, I’ve been able to get a simple
> example to run in 500ms-1200ms with a minimal Pharo 6 image. You can easily
> try it out yourself. This seems slightly better than what the GoLang folks
> have been able to do.
>
> Tim
>
>



Re: [Pharo-users] Stylistic question: private helper vs extension method?

2017-08-09 Thread Esteban A. Maringolo
2017-08-08 17:49 GMT-03:00 Esteban Lorenzano <esteba...@gmail.com>:
> Extension. Helpers are for javaers.

Extensions are concise, and right to the point, but as long as they
stay in your private image or prove of value to everybody else both in
function and selector naming.

My guides are:
A. If it's your image, extend Dictionary, Object or whatever you want.
It's your mess, your image, your rules.
B. If you're going to share the code with others (as a library), then
you should check whether the selectors clash with existing ones, or
have "side effects".
C. If it's going in the "core" image, then the selector should be well
thought, having broad application semantics and coherence with the
existing selectors, like the current #at:ifAbsent:, #at:ifPresent:,
etc.

In this case I'd go for something like:

Dictionary>>#at: key ifPresentPut: aBlock
"Lookup the given key in the receiver. If it is present, update it
with the value of evaluating the given block with the value associated
with the key. Otherwise, answer nil."

 ^self at: key ifPresent: [ :object | self at: key put: (aBlock
cull: object) ]


And you'd call it like:
  responsePayload at: each ifPresentPut: [ :uuid | uuid asString ].
or:
  responsePayload at: each ifPresentPut: [ 'FooBaz' ].


Regards,

Esteban A. Maringolo



Re: [Pharo-users] Fetching https site content with Zinc

2017-08-07 Thread Esteban A. Maringolo
Hi,

Probably, the hashbang (#code) is causing the front end proxy to
respond with a 400 error.

It works if you do:
ZnEasy get:  
'https://etherscan.io/address/0xbcff2d15c698d3874bc29aa170c89fd7a6146a4b'

However, I think there might be an specify REST API to get the
Solidity code of that SmartContract.

Also, you can use an available Pharo driver for Ethereum:
https://github.com/sbragagnolo/Fog

I'm not familiar with Ethereum, but according to Fog's docs you can
get the contract doing:

FogConnection eth  getContract: 'ContractHash'  blockTag: 'latest'

Regards!


Esteban A. Maringolo


2017-08-07 9:16 GMT-03:00 Henrique Rocha <henrique.ro...@gmail.com>:
> Hi there,
>
> I am trying to automate the fetching of a site content in Pharo. Basically,
> I want to fetch smart contract information from Etherscan. Here is an
> example URL:
> https://etherscan.io/address/0xbcff2d15c698d3874bc29aa170c89fd7a6146a4b#code
>
> I tried to use Zinc to fetch that, here is my code (very simple):
>
> ZnEasy get:
> 'https://etherscan.io/address/0x9C169d81420aAD7D8a0D6d9F295C3ba2C33575De#code'
>
> Although it runs without errors the fetched content is "Bad Request -
> Invalid URL" and not the actual website.
>
> Anyone know what am I doing wrong here?
>
>
>
> --
> View this message in context: 
> http://forum.world.st/Fetching-https-site-content-with-Zinc-tp4959072.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>



Re: [Pharo-users] Glorp: `session login` fails for Garage SQLite

2017-08-06 Thread Esteban A. Maringolo
2017-08-06 8:05 GMT-03:00 Herby Vojčík <he...@mailbox.sk>:
> Guillermo Polito wrote:
>>
>> How did you install garage and glorp? Catalog, configurations? Can you
>> paste here the installation instructions you followed?
>
>
> Just adding GarageGlorp as dependency:
> configuration: 'GarageGlorp' with: [ spec
> version: #stable;
> repository:

> I presume this is how it should be done?

It is. [1]


> In fact, from what I saw, it seems Glorp accumulated its share of technical
> debt, drivers came and went, platforms, too, dialects on which it runs, too.
> It seems to me it needs serious detanglement. Get rid of ifs, structure
> clenly, change ifs comparing to hardcoded symbols with double dispatch, etc.

Glorp as a project accumulates technical debt because it is an old
framework, which in the last years has received maintenance in its
main trunk but is missing several refactorings and a good
re-architecture of its internals.

Also, since there wasn't an official maintenance of the ports from VW
to other languages, there are many "old" ports still around, some
work, some doesn't, but they add to the confusion. Think of Seaside
being ported several times from Pharo to, let's say, VW, and many of
those ports were abandoned for a long time.

I attach a screenshot from the latest version of Glorp in VisualWorks
8 (the main trunk), it has the same login methods as the Pharo
version.

[1] See: 
http://files.pharo.org/books-pdfs/booklet-Glorp/2017-05-02-Glorp-Spiral.pdf

Regards,

Esteban A. Maringolo


Re: [Pharo-users] Glorp: `session login` fails for Garage SQLite

2017-08-05 Thread Esteban A. Maringolo
Which version of Pharo, Glorp and SQLite are you using?


Esteban A. Maringolo


2017-08-05 19:20 GMT-03:00 Herby Vojčík <he...@mailbox.sk>:
> Esteban A. Maringolo wrote:
>>
>> Herby,
>>
>> I regularly use `session login`, but I don't use SQLite in Pharo, but I
>> do in VisualWorks and it works just fine.
>> Maybe if there is a bug we should fix it. Even with a no-op method.
>>
>> Regards!
>>
>> Esteban A. Maringolo
>
>
> It's hard. The problem is
>
> PharoDatabaseAccessor >> encoding
>  ^self connection queryEncoding
>
> which overrides parent, which is atm:
>
> encoding
> "The connection is specific to the dialect;  some dialects will need
> to override this method."
>
> ^connection encoding
>
> The former was added at GuillermoPolito.73 back in 2011 (and the latter was
> the same back then). It probably fixed something, but I don't see any
> implementors of queryEncoding atm (definitely not in Garage). From the diff
> it is clear lots of databases and drivers have gone. Now, why was it change
> for Pharo (and does it need to be changed in 2017)?
>
> Ccing Guillermo Polito.
>
> Herby
>
> P.S.: I wonder how it is that no one actually had problem with this? This
> predictably fails on `session login` on pharo, unless queryEncoding is
> somehow magically present without seeing it in source code for other
> platforms?
>
>>
>> 2017-08-05 15:52 GMT-03:00 Herby Vojčík <he...@mailbox.sk
>> <mailto:he...@mailbox.sk>>:
>>
>> Alistair Grant wrote:
>>
>> Hi Herby,
>>
>> On 5 August 2017 at 18:09, Herby Vojčík<he...@mailbox.sk
>> <mailto:he...@mailbox.sk>>  wrote:
>>
>> Hello!
>>
>> First of all, what is preferred way to (first time) login
>> into database? I
>> had the impression that `aDatabaseAccessor login` is sorta
>> low-level, and
>> one should do `session login` (after all, it is session you
>> get to work
>> with, not an accessor).
>>
>> But with Garage SQLite, `session login`, when accessor is
>> not logged, always
>> fails with "MessageNotUnderstood:
>> GASqlite3Driver>>queryEncoding".
>>
>> Should one not use `session login` at all, then (when
>> accessor is logged, it
>> just does nothing, if it isn't, it connects the accessor,
>> but tries to do
>> some additional work which always fails)?
>>
>> Herby
>>
>>
>>   From memory this is caused by differences between VisualWorks
>> and Pharo.
>>
>> Anyway, it is discussed and resolved in:
>>
>> http://forum.world.st/Glorp-SQLite3-issue-td4899792.html
>> <http://forum.world.st/Glorp-SQLite3-issue-td4899792.html>
>>
>>
>> Doesn't look like solved to me. Anyway, at least I know it is known
>> for year and no-one seemed to see it as a bug.
>>
>> I think it is one (you cannot just send queryEncoding where no class
>> implements it and be fine, imo).
>>
>> So what is the state of `session login`? Is it meant to be used, or
>> everyone just took a step down to low-level and uses `accessor
>> login` instead? :-(
>>
>>
>> Cheers,
>> Alistair
>>
>>
>> Thanks, Herby
>>
>>
>
>



Re: [Pharo-users] Lazy-initialization patterns

2017-08-05 Thread Esteban A. Maringolo
2017-08-05 19:21 GMT-03:00 Peter Uhnak <i.uh...@gmail.com>:

> 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"

I like this approach very much, it makes the accessor code concise and
separates the implementation of the property creation.

Thank you!

Esteban A. Maringolo



Re: [Pharo-users] Lazy-initialization patterns

2017-08-05 Thread Esteban A. Maringolo
I know the compiler is smart enough in most cases, and even if it isn't, an
extra send or two won't hurt me in the kind of computation I do.

But it's the style what "worried" me the most.

Let's use the first then :)


Esteban A. Maringolo

2017-08-05 19:18 GMT-03:00 Paul DeBruicker <pdebr...@gmail.com>:

> Seems like either way would have unmeasurable performance impact for your
> application vs the other and you should go for whats most
> legible/comprehensible.
>
>
> On that metric I prefer the first but #yolo
>
>
>
>
>
>
>
> Esteban A. Maringolo wrote
> > Hi there,
> >
> > I have a question about lazy initialization accessor methods that always
> > keep me thinking in terms of performance and style.
> >
> > For years I did something like:
> >
> > MyClass>>#property
> >   property isNil ifTrue: [ self initializeProperty ]. "It could be ifNil:
> > as well"
> >   ^property
> >
> > MyClass>>#initializeProperty
> >   "Returns the receiver, not the property."
> >property := self foo collect: [:e | ... ].
> >
> >
> > But this made me think that maybe I'm performing extra operations, so I
> > started doing something like:
> >
> > MyClass>>#property
> >   ^property ifNil: [ self initializeProperty ]
> >
> > MyClass>>#initializeProperty
> >   ^property := self foo collect: [:e | ... ]
> >
> > The initialize method is often created by an "Extract Method" refactoring
> > I
> > do in the accesor, where I do the initial implementation.
> >
> >
> > The messages makes me think that the second implementation is "faster",
> > but
> > an initializationMethod returning the value instead of the receiver is a
> > code smell to me.
> >
> > I early initialize everything I know will be be used right away, but for
> > cases it doesn't make sense.
> >
> >
> > What do you think/prefer? Why?
> >
> > Maybe we could use the reified variables (slots) to implement the lazy
> > initialization themselves :)
> >
> >
> > Best regards!
> >
> > Esteban A. Maringolo
>
>
>
>
>
> --
> View this message in context: http://forum.world.st/Lazy-
> initialization-patterns-tp4958897p4958901.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


[Pharo-users] Lazy-initialization patterns

2017-08-05 Thread Esteban A. Maringolo
Hi there,

I have a question about lazy initialization accessor methods that always
keep me thinking in terms of performance and style.

For years I did something like:

MyClass>>#property
  property isNil ifTrue: [ self initializeProperty ]. "It could be ifNil:
as well"
  ^property

MyClass>>#initializeProperty
  "Returns the receiver, not the property."
   property := self foo collect: [:e | ... ].


But this made me think that maybe I'm performing extra operations, so I
started doing something like:

MyClass>>#property
  ^property ifNil: [ self initializeProperty ]

MyClass>>#initializeProperty
  ^property := self foo collect: [:e | ... ]

The initialize method is often created by an "Extract Method" refactoring I
do in the accesor, where I do the initial implementation.


The messages makes me think that the second implementation is "faster", but
an initializationMethod returning the value instead of the receiver is a
code smell to me.

I early initialize everything I know will be be used right away, but for
cases it doesn't make sense.


What do you think/prefer? Why?

Maybe we could use the reified variables (slots) to implement the lazy
initialization themselves :)


Best regards!

Esteban A. Maringolo


Re: [Pharo-users] Glorp: `session login` fails for Garage SQLite

2017-08-05 Thread Esteban A. Maringolo
Herby,

I regularly use `session login`, but I don't use SQLite in Pharo, but I do
in VisualWorks and it works just fine.
Maybe if there is a bug we should fix it. Even with a no-op method.

Regards!

Esteban A. Maringolo

2017-08-05 15:52 GMT-03:00 Herby Vojčík <he...@mailbox.sk>:

> Alistair Grant wrote:
>
>> Hi Herby,
>>
>> On 5 August 2017 at 18:09, Herby Vojčík<he...@mailbox.sk>  wrote:
>>
>>> Hello!
>>>
>>> First of all, what is preferred way to (first time) login into database?
>>> I
>>> had the impression that `aDatabaseAccessor login` is sorta low-level, and
>>> one should do `session login` (after all, it is session you get to work
>>> with, not an accessor).
>>>
>>> But with Garage SQLite, `session login`, when accessor is not logged,
>>> always
>>> fails with "MessageNotUnderstood: GASqlite3Driver>>queryEncoding".
>>>
>>> Should one not use `session login` at all, then (when accessor is
>>> logged, it
>>> just does nothing, if it isn't, it connects the accessor, but tries to do
>>> some additional work which always fails)?
>>>
>>> Herby
>>>
>>
>>  From memory this is caused by differences between VisualWorks and Pharo.
>>
>> Anyway, it is discussed and resolved in:
>>
>> http://forum.world.st/Glorp-SQLite3-issue-td4899792.html
>>
>
> Doesn't look like solved to me. Anyway, at least I know it is known for
> year and no-one seemed to see it as a bug.
>
> I think it is one (you cannot just send queryEncoding where no class
> implements it and be fine, imo).
>
> So what is the state of `session login`? Is it meant to be used, or
> everyone just took a step down to low-level and uses `accessor login`
> instead? :-(
>
>
>> Cheers,
>> Alistair
>>
>>
> Thanks, Herby
>
>


Re: [Pharo-users] How to load a baseline in Iceberg? Get #addTo: sent to nil?

2017-08-02 Thread Esteban A. Maringolo
What is the Metacello integration setting?

Esteban A. Maringolo

2017-08-02 19:01 GMT-03:00 Tim Mackinnon <tim@testit.works>:

> Answering a portion of my own question - enabling the Metacello
> Integration setting, does get a bit further, but then it expects my
> BaselineOF package to have a project method (which I guess configurationOF
> packages have) - but as this is a baseline I didn’t think it was supposed
> to have one of these?
>
> So I guess that setting isn’t applicable?
>
> Tim
>
> On 2 Aug 2017, at 22:31, Tim Mackinnon <tim@testit.works> wrote:
>
> I’m wondering if I’m missing a trick somewhere - but I have a simple
> project with 2 packages, one is a BaseLineOfMyPkg and the other is MyPkg
> (technically I don’t need the BaseLineOf, but I was learning how to use
> them and I simply added a postLoad hook to run some code in it).
>
> Anyway, If I clone my repo with Iceberg, I get 2 unloaded packages in the
> UI. If I right click on the BaseLine one, and click the “install baseline
> (default)” option, I was expecting it to load both packages for me -
> however I get the talkback error “#addTo: was sent to nil from the
> MCRepositoryGroup>>addRepository: method”.
>
> In trying to debug the code I can see its trying to find a handler for
> gitlocal:///, doesn’t find one and then tries to create a repo and bails…
> this seems like a bug? I did notice in tracing the code that there is a
> reference to a Setting that I saw - “Enable Metacello Integration” - should
> I set that to true (its false by default)?
>
> I’m wondering how other people are loading their projects in Iceberg if
> this doesn’t work?
>
> Tim
>
>
>


Re: [Pharo-users] Problems verifying the cryptographic signature of a file.

2017-07-31 Thread Esteban A. Maringolo
How do check the signature of a file?

I guess you must ensure the file creation is complete as well as its
digital signing. So if these steps are done asynchronously you should
synchronize them by means of a semaphore or similar.

Regards!

Esteban A. Maringolo


2017-07-31 14:11 GMT-03:00 Offray Vladimir Luna Cárdenas
<offray.l...@mutabit.com>:
> Hi,
>
> I'm having problems to verify the cryptographic signature of a file. It
> seems that the test is running, some times, while the file is being created,
> and some times when the file writing is finished (which is my purpose). How
> can I run the cryptographic signature verification only after the writing of
> the file is finished? I imagine that is something related with jobs and
> completion, but I don't know where to look for, specifically.
>
> Any hints and suggestions are welcomed.
>
> Cheers,
>
> Offray



Re: [Pharo-users] Iceberg and removing packages

2017-07-31 Thread Esteban A. Maringolo
Hi,

Yes, I commited.

I noticed the package wasn't remove from disk because in Github the
MyPackage-Tests.package folder was still there. And in the iceberg
local directory it was there as well.
I removed it manually with this commit:
<https://github.com/eMaringolo/NeoJSONRPC/commit/7d2d7422812216615e684c838f9bd7521590cc27>

Regards!

Esteban A. Maringolo


2017-07-31 9:30 GMT-03:00 Esteban Lorenzano <esteba...@gmail.com>:
> Did you commit?
>
>> On 31 Jul 2017, at 14:06, Esteban A. Maringolo <emaring...@gmail.com> wrote:
>>
>> That's exactly what I did. But after synchronizing the repo, the
>> package wasn't listed on Iceberg but it still was in in the repo.
>> It happened with another package in another repo as well.
>>
>> If it happens again I'll let you know.



Re: [Pharo-users] Iceberg and removing packages

2017-07-31 Thread Esteban A. Maringolo
That's exactly what I did. But after synchronizing the repo, the
package wasn't listed on Iceberg but it still was in in the repo.
It happened with another package in another repo as well.

If it happens again I'll let you know.

Regards!

Esteban A. Maringolo


2017-07-31 7:03 GMT-03:00 Esteban Lorenzano <esteba...@gmail.com>:
> Hi,
>
> In iceberg, you have to go to package tab and say "remove package from disk"
>
> Esteban
>
>> On 30 Jul 2017, at 17:01, Esteban A. Maringolo <emaring...@gmail.com> wrote:
>>
>> I got into the pharo-local/iceberg/... and git rm'ed the directory,
>> commited and synchronized the project in Iceberg.
>>
>> I hope it doesn't break anything since I don't know how much "magic"
>> does Iceberg behind the scenes other than automating the git commands
>> and providing a centralized UI.
>>
>> What is the "This is all you need to read to understand Iceberg?"
>> document I should read? I read its wiki, but it seems there is more to
>> go.
>>
>> Regards!
>>
>> Esteban A. Maringolo
>>
>>
>> 2017-07-30 11:28 GMT-03:00 Peter Uhnak <i.uh...@gmail.com>:
>>> 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] NeoJSON "conditional" parsing/mapping

2017-07-30 Thread Esteban A. Maringolo
2017-07-26 18:36 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
> Esteban,
>
> I had a quick look at the spec you mentioned.
>
> I am a bit puzzled though. Result can be anything, so how are you going to 
> map that to specific classes (and why) ?
> That would require serious prior knowledge and even then, not every situation 
> can be mapped easily to a class

Since I'm going to use it in the context of RPC calls, I can know
beforehand what kind of class is the result, so I want to leverage
that knowledge to avoid going through an intermediate Dictionary/map
to build the object.

> You speak about subclassing NeoJSONObject, which is cool, because it is so 
> flexible, but then why type it further ?
> If I were you, I would at least start the easy/lazy way.
> For example you could do
>   NeoJSONObject fromString: '...'
> And see how far you get. If things get slow, I would look for alternatives.

Yeap... I took your advice after making things unnecessarily complex...
after the first... and second attempt.
I tried to make a client too smart and early optimize for things I
haven't used before,
so I ended up making stuff convoluted (I'm specialist).

Long story short, I almost ended up where I started, which was a fork of
LtRpcJsonClient, with some minor fixes, using NeoJSON instead of the
JSON package for parsing/writing and using NeoJSONObject as mapClass,
named: NeoJSONRPCClient [1]

I'm using it to build a particular client that uses JSON-RPC, so most
of my specific needs were moved/implemented in my still unfinished
client subclass, if behavior becomes abstract enough, I can push it up
to the "general purpose" client.

I didn't skip the build of the map object, but for my domain specific
classes I pass the map to my specific instances, so each instance
holds a reference to the map object used to build it. I didn't feel
comfortable subclassing domain specific classes from Dictionary.

Regards!

Esteban A. Maringolo

[1] It's available at https://github.com/eMaringolo/NeoJSONRPC but I'm
still learning how to do Baselines and other stuff to work with this
pet-project I'm using to learn Iceberg. So the baseline doesn't
work... yet :|



Re: [Pharo-users] Iceberg and removing packages

2017-07-30 Thread Esteban A. Maringolo
I got into the pharo-local/iceberg/... and git rm'ed the directory,
commited and synchronized the project in Iceberg.

I hope it doesn't break anything since I don't know how much "magic"
does Iceberg behind the scenes other than automating the git commands
and providing a centralized UI.

What is the "This is all you need to read to understand Iceberg?"
document I should read? I read its wiki, but it seems there is more to
go.

Regards!

Esteban A. Maringolo


2017-07-30 11:28 GMT-03:00 Peter Uhnak <i.uh...@gmail.com>:
> 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
>>
>



[Pharo-users] Iceberg and removing packages

2017-07-30 Thread Esteban A. Maringolo
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] Pharo Seaside RESTful services pragma question

2017-07-29 Thread Esteban A. Maringolo
Did you try setting the pragma  in the list method?
Esteban A. Maringolo


2017-07-28 18:40 GMT-03:00 Greg Hutchinson <the.greg.hutchin...@gmail.com>:
> I am new to Pharo/Seaside and it has been a long time since I have used
> Smalltalk. I am trying to make a RESTful service and can’t get the pragmas
> to work the way I think it should. (This might be the problem already).
>
>
>
>  Ie Here is my list method within class TeamMembers which is a direct
> subclass of WARestfulHandler.
>
> list
>
>
>
>   ^ String streamContents: [ :stream |
>
>self teamMembers do: [ :each |
>
>stream nextPutAll: each ; crlf ]
>
>]
>
>
>
> and
>
>
>
> listJson
>
> 
>
> 
>
>
>
>^ (Array streamContents: [ :stream |
>
>   self teamMembers do: [ :each |
>
>  stream nextPut: (Dictionary new
>
> at: 'name' put: each ;
>
> yourself) ] ])
>
>   asJavascript
>
>
>
>
>
>
>
> After doing all the proper registration WAAdmin register: TeamMembers at:
> 'team-members' when I execute in the browser
> (http://localhost:8080/team-members) I received the message
>
> /team-members not found
> but if I execute (http://localhost:8080/team-members/list), it brings back
> the team member list. (However, I didn’t think I would have to add /list to
> the URL).
>
>
>
> This seems to contradict the documentation in
> http://book.seaside.st/book/advanced/restful/getting-started/define-handler.
>
>
>
>
>
> However, If I override the TeamMembers>>
>
> createRoutes
>
> | route pType|
>
> pType := WAFullMimeTypeMatch main:'text' sub: 'json' .
>
> route := WASimpleRoute method: 'GET' selector: #listJson
> produces: pType consumes: WAWildcardMimeTypeMatch new.
>
> ^ OrderedCollection new
>
> "GET"
>
> add: route;
>
> add: (WARoute get: #list);
>
> yourself.
>
>
>
> Then I get the expected behaviour when I browse to
> (http://localhost:8080/team-members) and using curl. (ie.
>
> curl -H "Accept: text/json" http://localhost:8080/team-members
>
> to get the Json response.
>
>
>
> When I debug the difference in the routes, it looks like using the pragmas,
> I get WAComplexRoute(s) but of course in the overridden method createRoutes,
> I get WASimpleRoutes.
>
>
>
> Is this the way it is supposed to work?
>
>
>
>
>
> Thanks in advance for any hints.
>



Re: [Pharo-users] NeoCSV on Irregular Files

2017-07-26 Thread Esteban A. Maringolo
2017-07-26 13:04 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
> I agree.
>
> If the file is non-homegeneous it is not longer CSV by definition.
>
> Holding on to the original stream and creating new readers for each section 
> is one option, an other one could be to add a #reset method.
>
> The big question is how to known when one section begins/ends.

In my experience I looked for certain delimiters, like a header row
with the field names.
Oil & Gas telemetry instruments generate outputs like that, like a
concatenation of several CSVs into one, maybe even with a non-csv like
header of 10 rows of data.

What I had to do to deal with that was either:
a) Reading it line by line, buffering the hole "segment" until EOF or
the next delimiter is found, or...
b) Pre-scanning the whole file, and marking start and end positions of
each segment, generating a new readStream with the contents and passed
it the CSV parser (which doesn't care nor know about segments).

> NeoCSVReader holds a one char buffer, so you could peek for something, just 
> maybe. Then you could discover the section switches while parsing (a bit like 
> #atEnd is used from #upToEnd, add a #atSectionEnd). But it all depends on 
> your specific format.

It's harder to do if it is char based, instead of "line" based. Or at
least harder to code.

Regards!

Esteban A. Maringolo



Re: [Pharo-users] NeoCSV on Irregular Files

2017-07-26 Thread Esteban A. Maringolo
There is no way to perform this with NeoJSON or any other CSV
framework I'm aware of.

I had to deal with that kind of "format" (which is likely an export
format), and the way to deal with it was to process each "segment"
using a different instance of the CSV reader, the segments where
scanned in the stream using the delimiting heuristics of your choice
(headers, blank lines, etc.), and then each segment was extracted and
passed as argument to the reader of that segment.

The drawback was that if the file was big there was no way to have "a
stream over a stream" (like a window function), so passing the segment
to the reader implied copying its string contents within the segment
delimiters.

It's something I already put some thought into, but never had the will
to code and share publicly.

Regards,

Esteban A. Maringolo


2017-07-26 12:02 GMT-03:00 Sean P. DeNigris <s...@clipperadams.com>:
> I have a CSV file that has several subsections, each with its own format.
> What I'd like to do is parse one, reset the NeoCSVReader, set it up for the
> next section, and continue. I didn't see an API for this. Is it possible?
> Thanks.
>
>
>
> -
> Cheers,
> Sean
> --
> View this message in context: 
> http://forum.world.st/NeoCSV-on-Irregular-Files-tp4956850.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>



[Pharo-users] NeoJSON "conditional" parsing/mapping

2017-07-25 Thread Esteban A. Maringolo
Hi Sven, all,

I'm working on a JSON-RPC client, I started using LtJsonRpcClient, but
since it's based on the "legacy" JSON package I decided to try to
adapt it to use NeoJSON. So I created a NeoJSONRPCClient based on
LtJson... because... why not.

At its core JSON-RPC is a pretty simple protocol, every response is a
JSON object with a 'result' attribute holding the returned object from
the RPC call, an 'error' one (nil if no error happened), and a few
other ones [1].

If I convert the response using the traditional `NeoJSONReader
fromString: responseObject` all the object three is converted to a
Dictionary, and what I want is to be able to:

1. Determine whether there was an error in the response
2. If there was no error, convert the 'result' field to my preferred
class of object instead of a Dictionary. I plan to make my classes
inherit from NeoJSONObject though.

All the above to avoid the use of an intermediate set of nested
dictionaries (which could be in the thousands).
I understand I could subclass NeoJSONReader to perform that at the
character stream level, but I wanted to ask first whether there is a
pattern/configuration of dealing with something like this.

Best regards!

[1] http://www.jsonrpc.org/specification#response_object

Esteban A. Maringolo



  1   2   3   4   5   >