[Pharo-users] mentoring continued I hope

2020-08-30 Thread Roelof Wobben via Pharo-users
--- Begin Message ---

Hello,

I have this challenge from exercism : 
https://github.com/exercism/pharo-smalltalk/tree/master/exercises/clock


and this function is given :

hour: anInteger minute: anInteger2
    self shouldBeImplemented


Schould I make it on this class method work that the minutes will not 
exceed the 59 minutes
So when for example when 70 min are given so hour:0  minute:70 it will 
be converted to hour: 1 minutes: 10

or can I better do this on the instance side.

Regards,

Roelof


--- End Message ---


Re: [Pharo-users] PostgresV2 Driver available?

2020-08-30 Thread Esteban Maringolo
Hi,

My question was done in a quest to crack an issue with Postgres which
was already solved, and it involved the connection, but it wasn't the
driver nor the server, but a firewall in between.

So I don't see the need, nor I think it would be advisable, to use the
v2 driver when the P3 is available and well tested and proven in
production.

Regards!

Esteban A. Maringolo

On Sun, Aug 30, 2020 at 9:06 AM Stéphane Ducasse
 wrote:
>
> Jan
>
> may be we should host your version to pharo-rdbms?
> So that people can find it.
>
> S.
>
>
> On 30 Aug 2020, at 13:49, Jan Blizničenko  wrote:
>
> Hello,
>
> actually, I do, although not with Garage or Glorp.
>
> I am not sure how exactly is related version in
> https://github.com/pharo-rdbms/garage and the one on
> deprecated.smalltalkhub.com/#!/~PharoExtras/PostgresV2 ,
> but I migrated the smalltalkhub one to
> https://github.com/JanBliznicenko/PostgresV2 and updated dependencies for my
> own purposes. It might be, however, actually even older than the one in
> garage repository.
>
> Best regards,
> Jan
>
>
> Esteban A. Maringolo wrote
>
> Hi,
>
> Is anybody using the "old" PostgresV2 driver in Pharo 8?
>
> I just checked in the pharo-rdbms/garage repository and of course
> everything is very old there. But I'm having a few issues with P3 that
> I didn't have before (with the PgV2) and I want to be test whether
> there is something related with the connection or the problem lies
> somewhere else.
>
> Regards!
>
> Esteban A. Maringolo
>
>
>
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>
> 
> Stéphane Ducasse
> http://stephane.ducasse.free.fr / http://www.pharo.org
> 03 59 35 87 52
> Assistant: Aurore Dalle
> FAX 03 59 57 78 50
> TEL 03 59 35 86 16
> S. Ducasse - Inria
> 40, avenue Halley,
> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
> Villeneuve d'Ascq 59650
> France
>



Re: [Pharo-users] [Ann] Workshop: IndieWeb with pocket infrastructures

2020-08-30 Thread Offray Vladimir Luna Cárdenas
Thanks Siemen and Steph,

If you or anyone in the community wants to be aware of the behind scenes
of this project you can check:

[1] Brea source code repository: https://code.tupale.co/Offray/Brea
[2] Brea documentation and issues repository:
https://mutabit.com/repos.fossil/brea/
[3] Indie Web with Brea repository:
  [3a] Front page:  https://is.gd/indieweb
  [3b] Timeline RSS: https://mutabit.com/repos.fossil/indieweb/timeline.rss
[4] Brea booklet and code to do:
https://mutabit.com/repos.fossil/brea/doc/trunk/wiki/agenda.md.html

Cheers,

Offray

On 29/08/20 8:27 a. m., Siemen Baader wrote:
>
>> On 29 Aug 2020, at 02.07, Offray Vladimir Luna Cárdenas 
>>  wrote:
>>
>> Hi all,
>>
>> Due to the confinement in the pandemic, our forms of telepresence become
>> more important and many suddenly got even more immersed into an
>> Oligopoly cyberspace (Zoom, Google, Facebook, Twitter, Apple, Amazon,
>> Microsoft, etc) with opaque algorithms that under extractive logic
>> commodify our privacy and communications, try to condition our attention
>> and habits, as well as to shape our current and future behavior. But
>> this is not the only way to inhabit cyberspace.
>>
>> From the Grafoscopio community[1], we would like to invite you to a
>> series of workshops that we are doing to make visible other ways of
>> populating and building the web, aligned with the movements of
>> IndieWeb[1a], from what we have called "pocket infrastructures".
> This is very cool! Thanks! 
>
> Siemen
>
>
>> You can
>> find more information about these topics in [2] and in particular about
>> the workshops in [3] (in Spanish).
>>
>> [1] https://mutabit.com/grafoscopio/en.html
>> [1a] https://indieweb.org/
>> [2] https://mutabit.com/repos.fossil/indieweb/
>> [3]
>> https://mutabit.com/repos.fossil/indieweb/doc/trunk/docs/es/index.html#talleres
>>
>>
>> The second workshop will be tomorrow, Saturday, Aug. 29 from 3:15 PM to
>> 7:15PM CO (GMT - 5) -- I will try to share the other workshops earlier,
>> but the site in [2] will be the consolidated memory of them, for those
>> who want to join us asynchronously.
>>
>> We will see how IndieWeb sites help us to untangle and reweave that
>> other web and how this help us to reconnect in this stranger times.
>>
>> Rethinking the infrastructure is also to rethink the ways in which it
>> enables and makes visible (or not) certain ways of being and acting.
>> Infrastructures are embodied discourses. So thank you in advance for
>> joining us in rethinking this in practice.
>>
>> Of course, Pharo is behind scenes, as usual, powering this experience.
>> But with these IndieWeb workshops I think we have found a sweet spot
>> that puts coding in front with a practical introduction and motivation
>> beyond the kind of boring "Hello World". Following a "local first"
>> approach, documentation will be in Spanish, but source code[5] and
>> interactive documentation will be in English to bridge our worlds :-),
>>
>> [4] https://mutabit.com/offray/blog/en/entry/dumb-hello-world
>> [5] https://mutabit.com/repos.fossil/brea/
>>
>>
>> See you on cyberspace,
>>
>> Offray
>>
>>
>>




Re: [Pharo-users] Question ZnClient with file

2020-08-30 Thread Sven Van Caekenberghe



> On 30 Aug 2020, at 18:05, Sabine Manaa  wrote:
> 
> Hi Sven,
> 
> thanks a lot for your answer! I was already replying 3 hours ago but my 
> answer did not pass the mailing list.
> 
> Perhaps you can answer this mail for the mailing list again:
> 
> I was writing: 
> 
> Hi Sven,
> you see me here very happy here. 
> It is much simpler as I was thinking. Just:
> 
> ^ ZnClient new
> url:
> 'https://my.sevdesk.de/api/v1/Voucher/Factory/uploadTempFile?token=32695d076245b124b066faaa56afc71b74';
> addPart:
> (ZnMimePart
> fieldName: 'file'
> fileNamed: '/Users/sabine/Desktop/belege/neue_belege/mcdonalds.jpeg');
> post
> 
> With this, it succeeds with the upload.

Great.

In production you should also check whether the upload succeeded.

One way to do this is by using #enforceHttpSuccess - this will signal an 
exception unless the host returned a 200 or similar code (assuming the 
receiving host acts like this).

> ...
> 
> Please allow me to ask one more question:
> 
> My situation in my application is, that I do not have the file local as in 
> the example but in amazon S3 and I have a url like this:
> 
> https://s3.eu-central-1.amazonaws.com/spf-belege-dev/K1000137/201905061113-506963984-9575877/31/7/small-202008241549-7987688-1.png?X-Amz-Algorithm=AWS4-HMAC-SHA256=AKIAJUHEWICJ33EJAUMA%2F20200830%2Feu-central-1%2Fs3%2Faws4_request=20200830T155656Z=6000=host=ab3f329b1e63c896f8hh95e36951f199fae081ca
> 
> My question is: Is it possible to NOT download this file to my server for 
> then sending it with filename and path to the other system but setting this 
> url directly in the ZnClient?
> For the other system it has to be like a file upload...
> This would save transfer costs and time.

I understand, but unless the host supports this, there is not much you can do. 
The data has to be transferred, if they are not willing to fetch it from some 
URL, you will have to do the copying.

If the files are not too large, you can take them temporarily in memory if you 
want (so that you do not have to create a temp file).

See ZnImageExampleDelegateTest and how #testUpload uses #image there.

It probably would also work with a ZnStreamingEntity (so that not everything 
has to be in memory at the same time, just the buffer to do stream copying), 
but that might require some more experimenting.

> Regards
> Sabine
>  
> 
> Sabine
> 
> Am So., 30. Aug. 2020 um 14:48 Uhr schrieb Sabine Manaa 
> :
> Hi Sven,
> 
> you see me here very happy here. 
> 
> It is much simpler as I was thinking. Just:
> 
> ^ ZnClient new
>   url:
>   
> 'https://my.sevdesk.de/api/v1/Voucher/Factory/uploadTempFile?token=32695d076245b124b0faaa56afc71b74';
>   addPart:
>   (ZnMimePart
>   fieldName: 'file'
>   fileNamed: 
> '/Users/sabine/Desktop/belege/neue_belege/mcdonalds.jpeg');
>   post
> 
> succeeds with the upload.
> 
> Thank you very very much!
> I write this in discord, too.
> 
> Sabine
> 
> Am So., 30. Aug. 2020 um 14:03 Uhr schrieb Sven Van Caekenberghe-2 [via 
> Smalltalk] :
> Hi, 
> 
> CC'ing the Pharo Users ML since that gives a permanent record of my answer. 
> 
> File uploads using ZnClient do work in the common case. You can check 
> ZnServerTest>>#testFormTest3 or ZnImageExampleDelegateTest>>#testUpload as 
> well as several other senders of #addPart: 
> 
> First you are mixing 2 types of forms (see 
> https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/Zinc-HTTP-Client/Zinc-HTTP-Client.html
>  section 6. Submitting HTML Forms). 
> 
> For a file upload you need a ZnMultiPartFormDataEntity which is configured 
> automatically in ZnClient by #multiPartFormDataEntity when you do #addPart: 
> (no need to set a content type). 
> 
> Next you are mixing the file name and the file contents. It is best to use 
> the class side ZnMimePart instance creation methods, either 
> #fieldName:fileName:entity: or #fieldName:fileNamed: 
> 
> Also, when you create a ZnByteArray entity with the contents of a .jpg or 
> .png you not only have to load the actual bytes (obviously), but you also 
> have to set the mime type correctly. In #fieldName:fileNamed: you can see how 
> this is done by using the file extension, but that is just one way to do it, 
> if you know the type upfront, just set it. 
> 
> There is also ZnClient>>#uploadEntityFrom: (used by #testUploadSmallDocument) 
> but that is not using a form. 
> 
> I am sure you will be able to figure it out, if not just ask. 
> 
> Sven 
> 
> > On 30 Aug 2020, at 09:51, Sabine Manaa <[hidden email]> wrote: 
> > 
> > Hi Sven, 
> > 
> > I hope you are well this serious times! 
> > 
> > I have a problem with ZnClient. I was asking yesterday in Discord but 
> > we did not find a solution. 
> > 
> > https://discordapp.com/channels/223421264751099906/223421264751099906/749313351859044382
> > 
> > I write a summary here: 
> > 

Re: [Pharo-users] PostgresV2 Driver available?

2020-08-30 Thread Stéphane Ducasse
Jan 

may be we should host your version to pharo-rdbms?
So that people can find it. 

S.


> On 30 Aug 2020, at 13:49, Jan Blizničenko  wrote:
> 
> Hello,
> 
> actually, I do, although not with Garage or Glorp.
> 
> I am not sure how exactly is related version in
> https://github.com/pharo-rdbms/garage and the one on
> deprecated.smalltalkhub.com/#!/~PharoExtras/PostgresV2 ,
> but I migrated the smalltalkhub one to
> https://github.com/JanBliznicenko/PostgresV2 and updated dependencies for my
> own purposes. It might be, however, actually even older than the one in
> garage repository.
> 
> Best regards,
> Jan
> 
> 
> Esteban A. Maringolo wrote
>> Hi,
>> 
>> Is anybody using the "old" PostgresV2 driver in Pharo 8?
>> 
>> I just checked in the pharo-rdbms/garage repository and of course
>> everything is very old there. But I'm having a few issues with P3 that
>> I didn't have before (with the PgV2) and I want to be test whether
>> there is something related with the connection or the problem lies
>> somewhere else.
>> 
>> Regards!
>> 
>> Esteban A. Maringolo
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 


Stéphane Ducasse
http://stephane.ducasse.free.fr / http://www.pharo.org 
03 59 35 87 52
Assistant: Aurore Dalle 
FAX 03 59 57 78 50
TEL 03 59 35 86 16
S. Ducasse - Inria
40, avenue Halley, 
Parc Scientifique de la Haute Borne, Bât.A, Park Plaza
Villeneuve d'Ascq 59650
France



Re: [Pharo-users] Question ZnClient with file

2020-08-30 Thread Sven Van Caekenberghe
Hi,

CC'ing the Pharo Users ML since that gives a permanent record of my answer.

File uploads using ZnClient do work in the common case. You can check 
ZnServerTest>>#testFormTest3 or ZnImageExampleDelegateTest>>#testUpload as well 
as several other senders of #addPart:

First you are mixing 2 types of forms (see 
https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/Zinc-HTTP-Client/Zinc-HTTP-Client.html
 section 6. Submitting HTML Forms).

For a file upload you need a ZnMultiPartFormDataEntity which is configured 
automatically in ZnClient by #multiPartFormDataEntity when you do #addPart: (no 
need to set a content type).

Next you are mixing the file name and the file contents. It is best to use the 
class side ZnMimePart instance creation methods, either 
#fieldName:fileName:entity: or #fieldName:fileNamed: 

Also, when you create a ZnByteArray entity with the contents of a .jpg or .png 
you not only have to load the actual bytes (obviously), but you also have to 
set the mime type correctly. In #fieldName:fileNamed: you can see how this is 
done by using the file extension, but that is just one way to do it, if you 
know the type upfront, just set it.

There is also ZnClient>>#uploadEntityFrom: (used by #testUploadSmallDocument) 
but that is not using a form.

I am sure you will be able to figure it out, if not just ask.

Sven

> On 30 Aug 2020, at 09:51, Sabine Manaa  wrote:
> 
> Hi Sven,
> 
> I hope you are well this serious times!
> 
> I have a problem with ZnClient. I was asking yesterday in Discord but
> we did not find a solution.
> 
> https://discordapp.com/channels/223421264751099906/223421264751099906/749313351859044382
> 
> I write a summary here:
> 
> I have this command, which works fine on the command line:
> 
> curl -X POST 
> "https://my.sevdesk.de/api/v1/Voucher/Factory/uploadTempFile?token=32695d076245b124b0faaa56afc71b74;
> -H "accept: application/xml" -H "Content-Type: multipart/form-data" -F
> "file=@/Users/sabine/Desktop/belege/neue_belege/mcdonalds.jpeg;type=image/jpeg"
> 
> Now, I want to "translate" this in a ZnClient command, but I do not
> get it. my command is:
> 
> ^ ZnClient new
>   systemPolicy;
>   https;
>   accept: ZnMimeType applicationXml;
>   headerAt: 'Content-Type' add: 'multipart/form-data';
>   host: 'my.sevdesk.de';
>   path: 
> '/api/v1/Voucher/Factory/uploadTempFile?token=32695d076245b124b0faaa56afc71b74';
>   ifFail: [ :exception | exception response entity inspect ];
>   formAt: 'file' put:
> '@/Users/sabine/Desktop/belege/neue_belege/mcdonalds.jpeg';
>   formAt: 'type' put: 'image/jpeg';
>   post
> 
> There must be a difference between the command line and the ZnClient
> command because with the ZnClient command, I get this error:
> {"objects":null,"error":{"message":"Uploaded file is not inside the
> allowed directory","code":null,"data":null}}.
> 
> I was also trying to get the command line from the ZnClient instance
> with the method curl but that gives me this:
> 
> echo 
> 66696c653d402f55736572732f736162696e652f4465736b746f702f62656c6567652f6e6575655f62656c6567652f6d63646f6e616c64732e6a70656726747970653d696d6167652f6a706567
> | xxd -r -p | curl -X POST
> https://my.sevdesk.de:443/api/v1/Voucher/Factory/uploadTempFile?token=32695d076245b124b0faaa56afc71b74
> -H"User-Agent:Zinc HTTP Components 1.0 (Pharo/7.0)"
> -H"Accept:application/xml"
> -H"Content-Type:application/x-www-form-urlencoded"
> -H"Host:my.sevdesk.de" -H"Content-Length:77" --data-binary @-
> 
> Would be very nice if you could help me. All I want ist to "translate"
> the above curl command in a corresponding ZnClient command
> 
> Regards
> Sabine




Re: [Pharo-users] PostgresV2 Driver available?

2020-08-30 Thread Jan Blizničenko
Hello,

actually, I do, although not with Garage or Glorp.

I am not sure how exactly is related version in
https://github.com/pharo-rdbms/garage and the one on
deprecated.smalltalkhub.com/#!/~PharoExtras/PostgresV2 ,
but I migrated the smalltalkhub one to
https://github.com/JanBliznicenko/PostgresV2 and updated dependencies for my
own purposes. It might be, however, actually even older than the one in
garage repository.

Best regards,
Jan


Esteban A. Maringolo wrote
> Hi,
> 
> Is anybody using the "old" PostgresV2 driver in Pharo 8?
> 
> I just checked in the pharo-rdbms/garage repository and of course
> everything is very old there. But I'm having a few issues with P3 that
> I didn't have before (with the PgV2) and I want to be test whether
> there is something related with the connection or the problem lies
> somewhere else.
> 
> Regards!
> 
> Esteban A. Maringolo





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



Re: [Pharo-users] Pharo at JPL

2020-08-30 Thread Konrad Hinsen
Hi Ted,

> I'm the person at JPL who (somehow) got "The Powers That Be" here to agree
> to join the Consortium.

Congratulations! That must have been a significant effort.

> I'm also the major champion of Pharo at JPL, and am leading an effort to get
> Pharo introduced & infused at JPL.

That's what I am most interested in. I am in biophysics research myself,
where Pharo is best described as invisible and unheard of. So I wonder
which techniques could work for introducing and infusing.

> I see the initial "market" for Pharo here to be:
>
> * Scientific & engineering data analysis & visualization,
> * Modeling and simulation, 
> * Internal web servers,
> * Custom ground support & test systems, 
> * Small-to-medium sized scripting to "support applications".

That looks like a lot of people to convince!

> I'm sure more application areas will open up as I get people to start using
> Pharo in their particular areas of expertise.

Indeed, the hard part is getting started.

> Wish me luck!

All you need!

Konrad.