Re: [Pharo-users] Diacritics in github

2020-07-13 Thread Alistair Grant
Thanks, Hernán!

On Mon, 13 Jul 2020 at 20:11, Hernán Morales Durand
 wrote:
>
> Hi Alistair,
>
> You can install it like this from Github:
>
> Metacello new
> baseline: 'Diacriticals';
> repository: 'github://hernanmd/Diacriticals';
> load
>
> Cheers,
>
> Hernán
>
>
>
> El lun., 13 jul. 2020 a las 10:19, Alistair Grant () 
> escribió:
>>
>> Hi All,
>>
>> Is anyone aware of a port of Diacritics from smalltalkhub to github?
>>
>> MCSmalltalkhubRepository
>> owner: 'hernan'
>> project: 'Diacritics'
>> user: ''
>> password: ''
>>
>> I'm way behind in reading the pharo lists, but I couldn't find any
>> reference to this.
>>
>> If not, I'll try and make a port, but it will be without history.
>>
>> Thanks,
>> Alistair
>>



[Pharo-users] Diacritics in github

2020-07-13 Thread Alistair Grant
Hi All,

Is anyone aware of a port of Diacritics from smalltalkhub to github?

MCSmalltalkhubRepository
owner: 'hernan'
project: 'Diacritics'
user: ''
password: ''

I'm way behind in reading the pharo lists, but I couldn't find any
reference to this.

If not, I'll try and make a port, but it will be without history.

Thanks,
Alistair



Re: [Pharo-users] Unicode migration from SmalltalkHub to Github

2020-04-01 Thread Alistair Grant
Thanks, Sven and Guille.

The Unicode library is now available at:
https://github.com/pharo-contributions/pharo-unicode

Metacello new
repository: 'github://pharo-contributions/pharo-unicode/src';
baseline: 'Unicode';
load.


Cheers,
Alistair

On Wed, 1 Apr 2020 at 12:14, Sven Van Caekenberghe  wrote:
>
> Please do, great initiative.
>
> > On 1 Apr 2020, at 11:57, Alistair Grant  wrote:
> >
> > Hi Sven and All,
> >
> > We have a need to migrate the Unicode library
> > (http://smalltalkhub.com/#!/~Pharo/Unicode) to github (for our release
> > tagging process).
> >
> > I've imported the code, with full history, in to:
> > https://github.com/feenkcom/pharo-unicode
> >
> > If there's no suggestions / objections, I'll request that it be added
> > to https://github.com/pharo-contributions.
> >
> > Thanks,
> > Alistair
> >
>
>



[Pharo-users] Unicode migration from SmalltalkHub to Github

2020-04-01 Thread Alistair Grant
Hi Sven and All,

We have a need to migrate the Unicode library
(http://smalltalkhub.com/#!/~Pharo/Unicode) to github (for our release
tagging process).

I've imported the code, with full history, in to:
https://github.com/feenkcom/pharo-unicode

If there's no suggestions / objections, I'll request that it be added
to https://github.com/pharo-contributions.

Thanks,
Alistair



Re: [Pharo-users] uFFI: Debugging "External module not found" Error

2019-12-03 Thread Alistair Grant
Hi Sean,

On Tue, 3 Dec 2019 at 17:26, Sean P. DeNigris  wrote:
>
> I was trying to get Pharo-LibVLC working on Mac. The following is copied from
> a GH issue[1]:
>
> > I have VLC installed via Homebrew cask, the formula for which simply
> > installs the dmg. I
> > first tried supplying a full path to the dylib that the VLC app uses
> > (/Applications/VLC.app/Contents/MacOS/lib/libvlc.5.dylib), which resulted
> > in "Error:
> > External module not found". I then remembered some trouble people have had
> > in the past
> > with FFI lookup locations and tried copying into the VM's plugin folder
> > both a link and the
> > actual dylib, with the same error. I read the uFFI booklet, but didn't
> > learn anything more.
> >
> > I also checked that the VLC lib was 64-bit via:
> >
> > lipo -info .../Pharo.app/Contents/MacOS/Plugins/libvlc.5.dylib
> > which returned:
> > Non-fat file: .../Plugins/libvlc.5.dylib is architecture: x86_64

The same message is returned whether the module itself isn't found, or
if one of its dependencies can't be found.

On linux you can check dependencies with `ldd file.so`, I don't know
what the Mac equivalent is.

HTH,
Alistair



Re: [Pharo-users] Deploy a Pharo 8 application remotely

2019-10-10 Thread Alistair Grant
Hi Sergio,

On Thu, 10 Oct 2019 at 20:14, sergio ruiz  wrote:
>
> Hey, all..
>
> I put together a quick REST interface to use internally here.
>
> It’s ready to launch to a production server, and I’m not sure how to set it 
> up on the remote server.
>
> The current zeroconf downloads and sets up a Pharo 7 instance.
>
> What I would like to do is set up Pharo 8 on the remote server, and just 
> replace the image and changes with mine, and start up the Teapot server  
> remotely.
>
> I usually just use rsync to update the remote image and changes files, but I 
> am not sure how to go about getting the correct setup to run the correct 
> (Pharo 8) interpreter remotely.
>
> I tried doing:
>
> curl https://get.pharo.org/64/80 | bash
>
> But this brings down only the changes and image files down.. no pharo-vm.

curl https://get.pharo.org/64/80+vm | bash

for the vm + image

curl https://get.pharo.org/64/vm80 | bash

for just the VM.

> will the pharo-vm that runs pharo 7 also run pharo 8?

Sometimes, but in general it is safer to assume that they're different.

HTH,
Alistair



Re: [Pharo-users] TelePharo / Seamless Bitmaps are all 0s

2019-05-25 Thread Alistair Grant
Hi Denis,


On Thu, 16 May 2019 at 19:17, Denis Kudriashov  wrote:
>
> Hi Alistair
>
> ср, 15 мая 2019 г. в 10:11, Alistair Grant :
>>
>> Hi Denis,
>>
>> On Wed, 15 May 2019 at 10:16, Denis Kudriashov  wrote:
>> >
>> > Hi Alistair
>> >
>> > I will look when have a time.
>> > But you can try to write a test for bitmap serialization/materialization 
>> > in TostSerializationTests (if I remember correctly the name).
>> > It will show if bitmap transport requires extra logic.
>>
>> If I remove Bitmap>>travelGuide (so that it inherits the default
>> OrdinaryObjectTravelGuide instead of an empty travel guide) everything
>> seems to work OK.
>>
>> This seems reasonable to me as a Bitmap's format is basically the same
>> as an Array, which doesn't seem to require any special processing.
>
>
> Not really. Bitmap is specifically array of integers. So it does not make 
> sense to traverse it as a complex structure considering that all its items 
> are real objects. it could be quite expensive.
> Bitmap represents an image (form) and I think it is logical to trait it as a 
> whole structure, like bytearray or string. And EmptyObjectTravelGuide marks 
> such kind of objects to be not traversable.

I meant "reasonable" as in I have a reasonable expectation that it
will work.  You are of course correct that it won't be as efficient.

> So the issue was with missing implementation of Bitmap serialization. 
> TostSerializer requires that any integral object implements couple of 
> "primitive methods". And it was not done for Bitmap.
>
> I fixed serializer and released all dependent projects. So try update 
> TelePharo.

Yep, it looks like it is working correctly now.

Thanks!
Alistair



>>
>>
>> I can add a simple test and submit a PR (in a few days time) if the
>> change sounds OK to you.
>>
>> Thanks,
>> Alistair
>>
>>
>> > ср, 15 мая 2019 г., 8:49 Alistair Grant :
>> >>
>> >> Hi Denis,
>> >>
>> >> If I print:
>> >>
>> >> remotePharo evaluate: [ Array withAll: #(42 42 42) ] "==> #(42 42 42)"
>> >>
>> >> which is obviously correct, but:
>> >>
>> >> remotePharo evaluate: [ Bitmap withAll: #(42 42 42) ]
>> >>
>> >> gives me a bitmap with all zeroes (running it locally does the expected 
>> >> thing).
>> >>
>> >> I can see that the bitmap is being created correctly on the server,
>> >> but by the time it gets back the values have been lost (all converted
>> >> to 0s).  If I change the Bitmap>>seamlessDefaultTransferStrategy for
>> >> the Bitmap to #defaultByReference I can correctly access the values
>> >> (just for debugging, by reference isn't practical for the real
>> >> system).
>> >>
>> >> Any hints on where to look?
>> >>
>> >> Thanks again,
>> >> Alistair
>> >>
>>



Re: [Pharo-users] TelePharo / Seamless Bitmaps are all 0s

2019-05-15 Thread Alistair Grant
Hi Denis,

On Wed, 15 May 2019 at 10:16, Denis Kudriashov  wrote:
>
> Hi Alistair
>
> I will look when have a time.
> But you can try to write a test for bitmap serialization/materialization in 
> TostSerializationTests (if I remember correctly the name).
> It will show if bitmap transport requires extra logic.

If I remove Bitmap>>travelGuide (so that it inherits the default
OrdinaryObjectTravelGuide instead of an empty travel guide) everything
seems to work OK.

This seems reasonable to me as a Bitmap's format is basically the same
as an Array, which doesn't seem to require any special processing.

I can add a simple test and submit a PR (in a few days time) if the
change sounds OK to you.

Thanks,
Alistair


> ср, 15 мая 2019 г., 8:49 Alistair Grant :
>>
>> Hi Denis,
>>
>> If I print:
>>
>> remotePharo evaluate: [ Array withAll: #(42 42 42) ] "==> #(42 42 42)"
>>
>> which is obviously correct, but:
>>
>> remotePharo evaluate: [ Bitmap withAll: #(42 42 42) ]
>>
>> gives me a bitmap with all zeroes (running it locally does the expected 
>> thing).
>>
>> I can see that the bitmap is being created correctly on the server,
>> but by the time it gets back the values have been lost (all converted
>> to 0s).  If I change the Bitmap>>seamlessDefaultTransferStrategy for
>> the Bitmap to #defaultByReference I can correctly access the values
>> (just for debugging, by reference isn't practical for the real
>> system).
>>
>> Any hints on where to look?
>>
>> Thanks again,
>> Alistair
>>



[Pharo-users] TelePharo / Seamless Bitmaps are all 0s

2019-05-15 Thread Alistair Grant
Hi Denis,

If I print:

remotePharo evaluate: [ Array withAll: #(42 42 42) ] "==> #(42 42 42)"

which is obviously correct, but:

remotePharo evaluate: [ Bitmap withAll: #(42 42 42) ]

gives me a bitmap with all zeroes (running it locally does the expected thing).

I can see that the bitmap is being created correctly on the server,
but by the time it gets back the values have been lost (all converted
to 0s).  If I change the Bitmap>>seamlessDefaultTransferStrategy for
the Bitmap to #defaultByReference I can correctly access the values
(just for debugging, by reference isn't practical for the real
system).

Any hints on where to look?

Thanks again,
Alistair



Re: [Pharo-users] TelePharo breaks Calypso tabs

2019-05-14 Thread Alistair Grant
Thanks, Denis!

That fixes it.

Thanks again,
Alistair

On Tue, 14 May 2019 at 14:06, Denis Kudriashov  wrote:
>
> Hi Alistair.
>
> We forgot update telepharo baseline for fixed calypso version.
>
> For now just load latest calypso from master on top of telepharo
>
> вт, 14 мая 2019 г., 7:54 Alistair Grant :
>>
>> Hi Dennis & Everyone,
>>
>> I'm just starting to play with TelePharo - it's really impressive.
>>
>> However loading either the server or client in Pharo 7 or Pharo 8
>> breaks Calypso so that I can no longer click on tabs to move between
>> the Comment, Class Definition or methods.
>>
>> Is this a known issue?  And is there a fix or workaround?
>>
>>
>> In both Pharo 7 & 8 TelePharo was loaded with:
>>
>> Metacello new
>>   baseline: 'TelePharo';
>>   repository: 'github://pharo-ide/TelePharo';
>>   load: 'Server'.
>>
>>
>> Metacello new
>>   baseline: 'TelePharo';
>>   repository: 'github://pharo-ide/TelePharo';
>>   load: 'Client'.
>>
>> in separate clean images downloaded 14 May 2019.
>>
>> OS: Ubuntu 16.04.
>>
>>
>> Thanks!
>> Alistair
>>



[Pharo-users] TelePharo breaks Calypso tabs

2019-05-13 Thread Alistair Grant
Hi Dennis & Everyone,

I'm just starting to play with TelePharo - it's really impressive.

However loading either the server or client in Pharo 7 or Pharo 8
breaks Calypso so that I can no longer click on tabs to move between
the Comment, Class Definition or methods.

Is this a known issue?  And is there a fix or workaround?


In both Pharo 7 & 8 TelePharo was loaded with:

Metacello new
  baseline: 'TelePharo';
  repository: 'github://pharo-ide/TelePharo';
  load: 'Server'.


Metacello new
  baseline: 'TelePharo';
  repository: 'github://pharo-ide/TelePharo';
  load: 'Client'.

in separate clean images downloaded 14 May 2019.

OS: Ubuntu 16.04.


Thanks!
Alistair



Re: [Pharo-users] how to -- buffered read / write to stdio

2019-03-27 Thread Alistair Grant
Hi Isaac,

On Wed, 27 Mar 2019 at 17:18, Isaac Gouy via Pharo-users
 wrote:
>
> From — "Pharo 7 file streams guideline"
>
> https://github.com/pavel-krivanek/pharoMaterials/blob/master/Filestreams.MD
>
>
> I have some ideas like —
>
>in := ZnFastLineReader on:   (ZnCharacterReadStream on: Stdio stdin).  
>  out := ZnBufferedWriteStream on:
>   (ZnCharacterWriteStream on: Stdio stdout).
>
>
> What would be faster / better / more Pharo ways to do buffered reads and 
> buffered writes to stdio ?

This is heading in the right direction.  The buffered wrappers are
normally placed on the underlying binary stream, and then wrapped with
the encoder / decoder.  Follow through FileReference>>writeStream and
FileReference>>readStream to see how it is done for files.

in := ZnFastLineReader on: (ZnCharacterReadStream on:
(ZnBufferedReadStream on: Stdio stdin)).

out := ZnCharacterWriteStream on: (ZnBufferedWriteStream on: Stdio stdout).

Note that if you're doing terminal IO you'll need to handle stdin differently.

If you're writing to a terminal on Linux / MacOS you'll need to use
LFs instead of Pharo's standard CRs, so it may be worthwhile adding
ZnNewLineWriterStream on: out.

HTH,
Alistair



Re: [Pharo-users] eval from the linux commandline

2019-03-25 Thread Alistair Grant
On Mon, 25 Mar 2019 at 10:36, Steve Quezadas  wrote:
>
> is it part of the base image? It's not listed in spotter. I also checked the 
> packages for something beginning with Clap and it's not there either.
>
> I am also running linux, so "eval" is not an option in my commandline.

$ curl get.pharo.org/64/vmLatest80 | bash
  % Total% Received % Xferd  Average Speed   TimeTime Time  Current
 Dload  Upload   Total   SpentLeft  Speed
100  5344  100  53440 0  35976  0 --:--:-- --:--:-- --:--:-- 36108
Downloading the latest pharoVM:
http://files.pharo.org/get-files/80/pharo64-linux-latest.zip
pharo-vm/pharo
Creating starter scripts pharo and pharo-ui


$ curl get.pharo.org/64/80 | bash
  % Total% Received % Xferd  Average Speed   TimeTime Time  Current
 Dload  Upload   Total   SpentLeft  Speed
100  3244  100  32440 0   5358  0 --:--:-- --:--:-- --:--:--  5353
Downloading the latest 80 Image:
http://files.pharo.org/get-files/80/pharo64.zip
Pharo.image


$ ./pharo Pharo.image eval '4+3'
7


$ ./pharo Pharo.image clap hello --help
Provides greetings

Usage: hello [--help] [--whisper] [--shout] [--language] []

Parameters:
   Recipient of the greetings

Options:
--help  Prints this documentation
--whisper   Greet discretely
--shout Greet loudly
--language
Select language of greeting


$ ./pharo Pharo.image clap hello --shout everyone
HELLO, EVERYONE!


$ uname -a
Linux alistair-xps13 4.15.0-46-generic #49~16.04.1-Ubuntu SMP Tue Feb
12 17:45:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux


HTH,
Alistair



Re: [Pharo-users] eval from the linux commandline

2019-03-25 Thread Alistair Grant
Inline below ...

Cheers,
Alistair
(on phone)

On Mon., 25 Mar. 2019, 10:36 Steve Quezadas,  wrote:

> is it part of the base image? It's not listed in spotter. I also checked
> the packages for something beginning with Clap and it's not there either.
>


My apologies, I should have added "in Pharo 8".




> I am also running linux, so "eval" is not an option in my commandline.
>


I run Linux (Ubuntu 16.04), eval should work fine (but I'm not at my PC at
the moment to produce an example).



> On Sun, Mar 24, 2019 at 12:06 PM Alistair Grant 
> wrote:
>
>> On Sun, 24 Mar 2019 at 00:54, test email  wrote:
>> >
>> > i need to eval an object from my linux commandline. I understand that
>> clap-st is able to do this, but I can't seem to import it into pharo7, I
>> suppose because of compatability reasons.
>>
>> Clap is now part of the base image, so you should be able to just
>> download the latest image and use it "out of the box".
>>
>> Cheers,
>> Alistair
>>
>>


Re: [Pharo-users] eval from the linux commandline

2019-03-24 Thread Alistair Grant
On Sun, 24 Mar 2019 at 00:54, test email  wrote:
>
> i need to eval an object from my linux commandline. I understand that clap-st 
> is able to do this, but I can't seem to import it into pharo7, I suppose 
> because of compatability reasons.

Clap is now part of the base image, so you should be able to just
download the latest image and use it "out of the box".

Cheers,
Alistair



Re: [Pharo-users] Read and parse maildir (offlineimap) files

2019-03-08 Thread Alistair Grant
Hi Cédrick,

On Fri, 8 Mar 2019 at 16:12, Cédrick Béler  wrote:
>
> Hi Alistair,
>
> This looks like what I’d like to have (parsing emails). I’d better like an 
> IMAP Client but using offlinmap might be an option.
>
> Will look at it.
>
> Do you have an exemple of milder format files ?

Attached is the email you sent.

I found https://github.com/codeZeilen/SMailDir but it is written for
Squeak and doesn't load cleanly in Pharo (I haven't actually done
anything with it yet).

Cheers,
Alistair


> > Le 8 mars 2019 à 15:49, Alistair Grant  a écrit :
> >
> > Hi Everyone,
> >
> > I'd like to be able to parse and read the mail files as saved by
> > offlineimap, i.e. in maildir format (one message per file).
> >
> > Does anyone know of any existing libraries in Pharo?
> >
> > Thanks very much,
> > Alistair
> >
>
>
Delivered-To: akgrant0...@gmail.com
Received: by 2002:adf:f60c:0:0:0:0:0 with SMTP id t12csp8602606wrp;
Fri, 8 Mar 2019 07:12:35 -0800 (PST)
X-Google-Smtp-Source: 
APXvYqyBULvLpmGOcHmSY32oNpah6+9Q1+jsoGuCWrldlE+6N1ssoDlcF4sOe56oCvZf45IQq8Tz
X-Received: by 2002:a37:7ac6:: with SMTP id v189mr1718893qkc.205.1552057955857;
Fri, 08 Mar 2019 07:12:35 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1552057955; cv=none;
d=google.com; s=arc-20160816;
b=nWzIqH0rl4J/gIywtYSkjB0MpJKZmVEAij9WfoNQ+7w8TpsTvHZ2rO6RrD2JBV938b
 /cr80WR/f/ThOF9Zio63/dweitly+DXR1dBAXCXG8h1ZbQsn4uwo8LoJSIE7diVA31kh
 oRqXv1KaS1PegIfpt3VnkjlEYyIoyUzX2GuA5bniS109AP5NA2Ccs0/K6nKhJr70E6l1
 mQqR/ttf3wc91wIv6VKfW4u5/a4gA3Fy0BXxjCpZNAfeVK6LNk6oTyXiDVcG2ewrEzam
 ojsspfJixRk9DDQ4/6mDrQeBNT+a3olgi7Yvhvu1rRZpS6Jya+F1u0vkKoEQi2hG3lhA
 fyqA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; 
s=arc-20160816;
h=sender:errors-to:reply-to:list-subscribe:list-help:list-post
 :list-archive:list-unsubscribe:list-id:precedence:subject:message-id
 :in-reply-to:to:references:date:mime-version
 :content-transfer-encoding:from:dkim-signature;
bh=JLBqlHE8xrteXdPe7tOJaVhkGilsOxLBhklK69nyufI=;
b=ldgX5puIMSXDWv48kjErgF1ObLYmtqQx//YsZJIQISD7PPkLzw+baSvf/REjrwLc9v
 CsQMfYOPtDrYOv6nDJjuKd5+I6pP/WR5kahXt6Qbud781AA4wCEonhvHEanqEkuJTL2p
 KDIW163ExeOw7O4slhgrwtbyvzqIGVp4dVunHyO/oLqmdrvyrPx97nGkX4a1J9OMYAHe
 VCqd/dRLAWVS77ZnskCUnzGN0fmC8HwIt+dfY4T5O0ea9HXdfKbUbQ1crf8gF3hZ8Vhp
 sgfBTNIMbl7TsJKC4X+5/oXF3mguBoj7No+IKO3xUXty/44+VxAsi/HTJdufU96Lio5S
 ZvHw==
ARC-Authentication-Results: i=1; mx.google.com;
   dkim=pass header.i=@gmail.com header.s=20161025 header.b=vQv+2Amn;
   spf=neutral (google.com: 172.104.12.73 is neither permitted nor denied 
by best guess record for domain of pharo-users-boun...@lists.pharo.org) 
smtp.mailfrom=pharo-users-boun...@lists.pharo.org;
   dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Return-Path: 
Received: from mm1.emwd.com (mm1.emwd.com. [172.104.12.73])
by mx.google.com with ESMTPS id 7si5019284qto.247.2019.03.08.07.12.35
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Fri, 08 Mar 2019 07:12:35 -0800 (PST)
Received-SPF: neutral (google.com: 172.104.12.73 is neither permitted nor 
denied by best guess record for domain of pharo-users-boun...@lists.pharo.org) 
client-ip=172.104.12.73;
Authentication-Results: mx.google.com;
   dkim=pass header.i=@gmail.com header.s=20161025 header.b=vQv+2Amn;
   spf=neutral (google.com: 172.104.12.73 is neither permitted nor denied 
by best guess record for domain of pharo-users-boun...@lists.pharo.org) 
smtp.mailfrom=pharo-users-boun...@lists.pharo.org;
   dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Received: from [::1] (port=40352 helo=mm1.emwd.com)
by mm1.emwd.com with esmtp (Exim 4.91)
(envelope-from )
id 1h2HAp-0006Hr-3J; Fri, 08 Mar 2019 10:12:35 -0500
Received: from mail-wm1-f53.google.com ([209.85.128.53]:36403)
 by mm1.emwd.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
 (Exim 4.91) (envelope-from ) id 1h2HAn-00064x-Iq
 for pharo-users@lists.pharo.org; Fri, 08 Mar 2019 10:12:33 -0500
Received: by mail-wm1-f53.google.com with SMTP id j125so12764950wmj.1
 for ; Fri, 08 Mar 2019 07:12:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:content-transfer-encoding:mime-version:subject:date:references
 :to:in-reply-to:message-id;
 bh=JLBqlHE8xrteXdPe7tOJaVhkGilsOxLBhklK69nyufI=;
 b=vQv+2Amn6rfPv/JGQO38SvNlrlQxsnUjIUHZSRiYo8Eh9GrbRAP8W3tuVli7ERsfPM
 J9x3+AEebW37e/ir7BLvoTbzkh9bJfF8OXR7MRTfskaQJpJNGQhI7wuQ9IVhAC01SfRK
 yvVatoe1lroT0dnLDgKgiFoVO5MaZ3JiYBJMnTD8S5MtQ4Ubzjwda/X+CuZ51GI+9p8s
 t6y3Xh//Ujmtk/D0TtomuZuf/U1ocFNPBig9fyXV5/p34vAeH+Qo/ZwKaf6lPq3wtGRm
 GLjsY8WTlfDYTmSR8e0w/ezjz+5XUqzrKiNr064ga5CMTyJVCwLfqc1U+TcY0

[Pharo-users] Read and parse maildir (offlineimap) files

2019-03-08 Thread Alistair Grant
Hi Everyone,

I'd like to be able to parse and read the mail files as saved by
offlineimap, i.e. in maildir format (one message per file).

Does anyone know of any existing libraries in Pharo?

Thanks very much,
Alistair



Re: [Pharo-users] Fail on condense when image name is drgeo.image

2019-03-05 Thread Alistair Grant
On Tue, 5 Mar 2019 at 22:11, Alistair Grant  wrote:
>
> Hi Hilaire,
>
> On Tue, 5 Mar 2019 at 21:16, Hilaire  wrote:
> >
> > Alistair,
> >
> > I checked, the error shows under this specific situation I described in
> > my previous email.
>
> I figured out the environment that caused the primtiveFailure and can
> see how my modified code avoids the issue.
>
>
> > Yes, your code fixes this condition, the condense does not hit this
> > error anymore.
>
> Great.  I've refactored this quite a bit to make it more efficient and
> related methods more consistent.  I'll be opening an issue and
> submitting a PR for it.

For future reference:

Issue: https://github.com/pharo-project/pharo/issues/2753
PR: https://github.com/pharo-project/pharo/pull/2754

Cheers,
Alistair



Re: [Pharo-users] Fail on condense when image name is drgeo.image

2019-03-05 Thread Alistair Grant
Hi Hilaire,

On Tue, 5 Mar 2019 at 21:16, Hilaire  wrote:
>
> Alistair,
>
> I checked, the error shows under this specific situation I described in
> my previous email.

I figured out the environment that caused the primtiveFailure and can
see how my modified code avoids the issue.


> Yes, your code fixes this condition, the condense does not hit this
> error anymore.

Great.  I've refactored this quite a bit to make it more efficient and
related methods more consistent.  I'll be opening an issue and
submitting a PR for it.

Cheers,
Alistair



Re: [Pharo-users] Fail on condense when image name is drgeo.image

2019-03-05 Thread Alistair Grant
Hi Hilaire,

On Tue, 5 Mar 2019 at 15:09, HilaireFernandes  wrote:
>
> The problem seems to happen when there is the following conditions, in the
> folder containing the image:
>
> - there is a drgeo file, in my situation it is a link to the DrGeo
> repository
> - the image name is drgeo.image, ...
> - PharoCondense is executed, then FileRefrence>>nextVersion seems confused
> by the drgeo file.
>
> I could recheck, but it will be evening late.

I had a bit of trouble reading the stack traces, but it looked like
the issue is with FileReference>>nextVersion.  If that is the case:
#nextVersion is self contained, so the easiest thing will be to
trigger the problem, go in to the debugger and copy the pathString of
the FileReference that causes the issue.

I've attached a change-set that fixes #nextVersion so it returns the
correct values for file names with dots in them, e.g. "file.name.ext".
Could you check if it behaves as expected?

Cheers,
Alistair
'From Pharo8.0.0 of 3 March 2019 [Build information: Pharo-8.0.0+build.113.sha.c3e75ed590752fef4db5122071bfcaeab87c126e (64 Bit)] on 5 March 2019 at 5:49:43.067581 pm'!

!FileReference methodsFor: 'utilities' stamp: 'AlistairGrant 3/5/2019 17:45'!
nextVersion
	"Assumes a file (or folder) name includes a version number encoded as '.' followed by digits 
	preceding the file extension.  Increment the version number and answer the new file name.
	If a version number is not found, return just the file"

	| parent basename nameWithoutExtension extension max index |

	self exists
		ifFalse: [ ^ self ].

	parent := self parent.
	extension := self extension.
	basename := self basename.
	nameWithoutExtension := basename copyFrom: 1 to: (basename size - extension size - 1).
	"At this stage nameWithoutExtension may still include a version number.  Remove it if necessary"
	index := nameWithoutExtension size.
	[ index > 0 and: [ (nameWithoutExtension at: index) isDigit ] ] whileTrue:
		[ index := index - 1 ].
	((index between: 1 and: nameWithoutExtension size - 1) and: [ (nameWithoutExtension at: index) = $. ]) ifTrue: 
		[ nameWithoutExtension := nameWithoutExtension copyFrom: 1 to: index-1 ].

	max := 0.
	parent children do: [ :child | | number |
		((child basename beginsWith: nameWithoutExtension) and: [ child extension = extension ]) ifTrue: 
			[ number := Number 
squeezeNumberOutOfString: 
	(child basename last: (child basename size - nameWithoutExtension size - 1))
ifFail: [ 0 ].
			max := max max: number ] ].

	^ parent / (nameWithoutExtension, '.', (max+1) asString) , self extension! !


!FileReferenceTest methodsFor: 'tests' stamp: 'AlistairGrant 3/5/2019 17:48'!
testNextVersion

	| fs file versions |

	fs := FileSystem memory.
	file := fs / 'file.name'.
	versions := Array streamContents: [ :stream |
		5 timesRepeat: [ 
			file createFile.
			stream nextPut: file basename.
			file := file nextVersion. ] ].
	self assert: versions equals: #('file.name' 'file.1.name' 'file.2.name' 'file.3.name' 'file.4.name').

	fs := FileSystem memory.
	file := fs / 'file123.name.ext'.
	versions := Array streamContents: [ :stream |
		5 timesRepeat: [ 
			file createFile.
			stream nextPut: file basename.
			file := file nextVersion. ] ].
	self assert: versions equals: #('file123.name.ext' 'file123.name.1.ext' 'file123.name.2.ext' 'file123.name.3.ext' 'file123.name.4.ext').

	fs := FileSystem memory.
	file := fs / '123.ext'.
	versions := Array streamContents: [ :stream |
		5 timesRepeat: [ 
			file createFile.
			stream nextPut: file basename.
			file := file nextVersion. ] ].
	self assert: versions equals: #('123.ext' '123.1.ext' '123.2.ext' '123.3.ext' '123.4.ext').
! !



Re: [Pharo-users] Fail on condense when image name is drgeo.image

2019-03-04 Thread Alistair Grant
Hi Hilaire,

On Mon, 4 Mar 2019 at 22:18, Hilaire  wrote:
>
> Hi,
>
> When I use the stable P7, drgeo build fails.
>
> There is an obscure error in File>>nextVersion, with negative index
> which are not catch, although it looks like it should be.
>
> This same build was working on alpha P7 of June.
>
> The stack of the debugger is attached as well the PharoDebug.log.
>
> Does it sound familiar to any of you?

There were some changes made to FileReference>>nextVersion late last
year (it was broken with only .1 and .1.1 version numbers being
created).

It looks like drgeo.changes.new has uncovered another issue as
#nextVersion returns drgeo.1.new, when it should probably return
drgeo.changes.1.new.

But I can't reproduce the problem you're seeing.  Can you create a
small script that reproduces the issue?

Cheers,
Alistair



Re: [Pharo-users] OS X bundle, some progress

2019-03-03 Thread Alistair Grant
Hi Hilaire,

On Sun, 3 Mar 2019 at 09:31, Hilaire  wrote:
>
> One useful information will be to know where stdout file is created by
> default?
>
> VM, image, home, folder, ...

On linux and MacOS the three stdio streams exist for every process:
stdin, stdout & stderr.

If you're starting a process from the shell, they are normally
attached to the terminal (unless you redirect them).  I don't know
what happens on MacOS when you start a process from the GUI.


> Obviously there is situation with problem creating stdout files.

There's lots of MacOS users here who aren't having this problem, so my
first guess is that there's something about your environment that is
causing the issue.

Can you provide the text from System -> System Reporter -> VM General?

Cheers,
Alistair


> Can it be shutdown?
>
> For the record, the error is REPEATABLE, Pharo started from the CLI or
> from an installed Application. Once the image started:
>
> error with stdout does not exist, force recursive file creation, filename 
> "stdout"
>
> This occures with stock OS X 32bits VM and Image.
>
> Any one willing to do serious deliverable Pharo Application with Mac
> will be hit by this error. Is OS X making situation more difficult?
>
> Hilaire
>
> Le 01/03/2019 à 23:19, Hilaire a écrit :
> Hi,
> > I did some progress on the Dr.Geo bundle for OS X.
> >
> > The Mac admin of my school told me to download from Safari and
> > authorized the drgeo.eu web site (not sure what this exactly does), then
> > we installed the DrGeo.app at the Application location.
> >
> > DrGeo started fine but emit a startup error at the image level, related
> > to stdout. It looks like a stdout file can not be created. The stack is
> > enclosed here. When looking at the execution stack, I could not
> > determine (I have to go teaching) where the image wants to create this
> > stdout file.
> >
> > Any idea or opinion on this stdout matter?
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>



Re: [Pharo-users] OSProcess / OSSubprocess / LibC uniqueInstance

2019-02-19 Thread Alistair Grant
On Tue, 19 Feb 2019 at 13:45, Albrecht Baur via Pharo-users
 wrote:
>
> Thank you.
>
> The Metacello snippet helps. It loads a newer version than that from the 
> catalog browser.
>
>
> But 2 more questions:
>
> 1.: Is there a reason not to use just ...
>
> LibC uniqueInstance system: 'zip -r 123.zip zipme/'

You don't have the same level of control over the process, can't pipe
stdio, it introduces issues with interrupts (SIGINT, SIGQUIT), etc.


> And 2.: Is it ok to use OSSubprocess on in 64 bit images even though the 
> documentation says it doesn't work ? (but it does)
>
> -> https://github.com/pharo-contributions/OSSubprocess#installation

That's a surprise.  Yes, OSSubprocess is officially supported on 64
bits, the readme is out of date.

HTH,
Alistair



Re: [Pharo-users] Working VM for OS X for Pharo 7

2019-02-17 Thread Alistair Grant
Hi Hilaire,

On Thu, 14 Feb 2019 at 11:54, Hilaire  wrote:
>
> I know what you are describing, for example cairo can be impacted.
>
> My self questioning was: Does the VM rely on the host git library or is
> the one shipped with the vm sufficient?

I don't know the reasoning for including libgit2.  For libssh2 I
believe it was to ensure that certain options had been compiled in,
maybe this is the same?

Cheers,
Alistair



> Best,
>
> Hilaire
>
> Le 14/02/2019 à 10:33, Alistair Grant a écrit :
> > On Linux it is almost always:
> >
> > - A library isn't found because the search path is wrong, i.e.
> > LD_LIBRARY_PATH needs to be set, and/or
> > - there's a missing dependency.
> >
> > The ldd command helps track these down by showing which dependencies
> > are missing.
> >
> > On Linux you need to be careful because the pharo script sets
> > up LD_LIBRARY_PATH, so ldd may show something as missing which will be
> > found when pharo is actually run, e.g libssh.
> >
> > Cheers,
> > Alistair
> > (on phone)
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>



Re: [Pharo-users] Streams for FileReference in Pharo 7

2019-02-16 Thread Alistair Grant
On Sat, 16 Feb 2019 at 15:49, Sven Van Caekenberghe  wrote:
>
> > On 16 Feb 2019, at 14:35, Alistair Grant  wrote:
> >
> > Hi Sven & Jan,
> >
> > On Fri, 15 Feb 2019 at 10:25, Sven Van Caekenberghe  wrote:
> >>
> >> Hi Jan,
> >>
> >> I like #<< too, but I think your assumption that it can print anything on 
> >> a stream is generally wrong, dangerous and unreliable.
> >>
> >> IMHO, you better stick to #print: in that case.
> >>
> >> Consider the follow, that all fail:
> >>
> >> String streamContents: [ :s | s << 'hello' << 42.5 << $! ].
> >>
> >> String streamContents: [ :s | s << 'hello' << (1@2) << $! ].
> >>
> >> In other words: #<< works in bizar ways (check the implementors of 
> >> #putOn:).
> >>
> >> I would be inclined to change
> >>
> >> ZnEncodedStream>>#<< collection
> >>^ self nextPutAll: collection
> >>
> >> to
> >>
> >> ZnEncodedStream>>#<< collection
> >>^ self nextPutAll: collection asString
> >>
> >> but it would technically not be the same as the original #<< for in-memory 
> >> streams.
> >>
> >> Opinions ?
> >
> > I've often thought that this change would be nice to have.  #putOn:
> > doesn't really fit in with writing to text streams (text in the loose
> > sense of "something that will be read").
> >
> > I think an argument could be made that #printString or #displayString
> > should be used, but they both have their own issues in practice.
> > So...
> >
> > +1 to "collection asString".
> >
> > Cheers,
> > Alistair
>
> I have been thinking a bit more about this, and I have a lot of problems with
>
> Integer>>#putOn: aStream
> aStream isBinary
> ifTrue: [ self asByteArray do: [ :each | aStream nextPut: 
> each ] ]
> ifFalse: [ self asString putOn: aStream ]
>
> I think we should simply remove this method. It is ugly and wrong.
>
> #<< should simply be a shortcut for either #nextPut: and #nextPutAll: and 
> nothing more.
>
> The following two are OK for me:
>
>  String streamContents: [ :out | out << 'Hello' << $! ].
>  ByteArray streamContents: [ :out | out << #[ 1 2 3 ] << 4 ].
>
> But the following most definitively not:
>
>  (ByteArray streamContents: [ :out | out << 16rFF << 16rFF11 << 16r22 << 
> 16rFF33 ]) hex.
>
> When you write out an integer, you have to decide its size, that can never 
> depend on the magnitude (because there is no way to read this back unless 
> there is additional bracketing).
>
> Also, printing to a stream should be (very) efficient. Making copies of 
> objects just for conversion purposes should be avoided.
>
> I think that if we remove Integer>>#putOn: I could live with
>
>  ZnEncodedStream>>#<< anObject
> anObject putOn: self
>
> The other solution is to define #<< as strictly the same as #nextPutAll: and 
> remove all #putOn: implementors.

My thoughts aren't fully formed on this, but:

I think we can break the streams up in to three categories:

- Streams of arbitrary objects, i.e. streams writing to Arrays,
OrderedCollections, etc.
- Streams that serialise the objects, e.g. JSON, STON, ASN.1, etc.
- Streams that write to some form of text output intended for human reading.

We can then group the messages used by each category:

- Arbitrary object: nextPut:, nextPutAll:, putOn:, etc.
- Serialising: stonOn:, etc.
- Text: <<, cr, lf, etc.

Following these guidelines:

- I'd remove the Integer>>putOn: as you suggest.
- Add the #asString to ZnEncodedStream>><< as suggested earlier.

Cheers,
Alistair



Re: [Pharo-users] Streams for FileReference in Pharo 7

2019-02-16 Thread Alistair Grant
Hi Sven & Jan,

On Fri, 15 Feb 2019 at 10:25, Sven Van Caekenberghe  wrote:
>
> Hi Jan,
>
> I like #<< too, but I think your assumption that it can print anything on a 
> stream is generally wrong, dangerous and unreliable.
>
> IMHO, you better stick to #print: in that case.
>
> Consider the follow, that all fail:
>
> String streamContents: [ :s | s << 'hello' << 42.5 << $! ].
>
> String streamContents: [ :s | s << 'hello' << (1@2) << $! ].
>
> In other words: #<< works in bizar ways (check the implementors of #putOn:).
>
> I would be inclined to change
>
> ZnEncodedStream>>#<< collection
> ^ self nextPutAll: collection
>
> to
>
> ZnEncodedStream>>#<< collection
> ^ self nextPutAll: collection asString
>
> but it would technically not be the same as the original #<< for in-memory 
> streams.
>
> Opinions ?

I've often thought that this change would be nice to have.  #putOn:
doesn't really fit in with writing to text streams (text in the loose
sense of "something that will be read").

I think an argument could be made that #printString or #displayString
should be used, but they both have their own issues in practice.
So...

+1 to "collection asString".

Cheers,
Alistair



Re: [Pharo-users] Working VM for OS X for Pharo 7

2019-02-14 Thread Alistair Grant
On Thu., 14 Feb. 2019, 10:07 Hilaire,  wrote:

> Hopefully I may have access to a mac tomorrow to test your request, or
> it will be in 10 days.
>
> On the other hand, is not libgit integrated in the VM, so I don't
> understand how it can be related to system update? Or is libgit a
> binding to a system git or something like that?
>


On Linux it is almost always:

- A library isn't found because the search path is wrong, i.e.
LD_LIBRARY_PATH needs to be set, and/or
- there's a missing dependency.

The ldd command helps track these down by showing which dependencies are
missing.

On Linux you need to be careful because the pharo script sets up
LD_LIBRARY_PATH,
so ldd may show something as missing which will be found when pharo is
actually run, e.g libssh.

Cheers,
Alistair
(on phone)

>
>


Re: [Pharo-users] Working VM for OS X for Pharo 7

2019-02-14 Thread Alistair Grant
Hi Hilaire,

On Thu, 14 Feb 2019 at 09:09, Hilaire  wrote:
>
> Hi,
>
> Where is it possible to get a working OS X VM for Pharo7 ?
>
> Accoring to my test, the VM linked at http://pharo.org/download as error
> with a libgit plugin (same for linux VM btw)

I've been using both the stable and latest VMs on Ubuntu 16.04 without
libgit problems "forever" (I don't remember the last time I had
problem).

Can you provide the path to, and output of  "ldd libgit2.so"?

Which linux are you using?

Cheers,
Alistair



Re: [Pharo-users] pathSegments of workingDirectory?

2019-02-13 Thread Alistair Grant
Hi David & Sven,

On Thu, 14 Feb 2019 at 07:46, Sven Van Caekenberghe  wrote:
>
> David,
>
> > On 14 Feb 2019, at 03:56, David Richards  
> > wrote:
> >
> > Hi community,
> >
> > Consider:
> >
> > | file |
> > file := FileLocator workingDirectory .
> > file fullName .
> > "==> '/Users/dr/Documents/Pharo/images/Study (Pharo 7.0 - 64bit stable)'"
> > file pathSegments .
> > "==> #()"
> >
> > How do we obtain path segments for the working directory?
> >
> > Is this an edge case where pathSegments does not return a semantically 
> > consistent value?
> >
> > Thanks
> > David
>
> A FileLocator is a bit special, it is usable, but not yet fully realised, 
> more abstract.
>
> You can use resolve. Consider:
>
> FileLocator home pathString.
>  "'/Users/sven'"
>
> FileLocator home resolve pathSegments.
>  "#('Users' 'sven')"

What Sven wrote is, of course, correct.  But this is also an edge case:

FileLocator workingDirectory resolve pathSegments.
 "#()"

The reason in this case is because the directory is stored as a
RelativePath.  A RelativePath is resolved against the working
directory, which in this case is the same thing, so no movement is
required, and an empty path is used.

You can also try:

FileLocator workingDirectory asAbsolute pathSegments.
" #('home' 'alistair' 'pharo8' 'pharo64.04')"

Just for added confusion, FileLocator class>>workingDirectory is also
a special case.  Most of the methods in the origins protocol return an
instance of FileLocator.  But FileLocator class>>workingDirectory
returns an instance of FileReference.

HTH,
Alistair



Re: [Pharo-users] Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

2019-02-07 Thread Alistair Grant
Hi Esteban,

On Thu, 7 Feb 2019 at 09:41, Esteban Lorenzano  wrote:
>
> Means we will need a new stable for Pharo 7/8 ?
>
> Esteban

Albrecht will obviously be the one to say how urgent it is for him, or
whether he can get by with vmLatest80.  From my perspective: the issue
has been there "forever" (2010 or earlier) and has only just been
reported.  I expect that we'll eventually update the Pharo 7 VM
anyway, and this can probably wait until then.  Pharo 8 can wait as
well, for the same reasons.

Cheers,
Alistair



> > On 7 Feb 2019, at 09:23, Alistair Grant  wrote:
> >
> > On Thu, 7 Feb 2019 at 09:08, Albrecht Baur  
> > wrote:
> >>
> >> Hi Alistair,
> >>
> >> I have tested it and works with the latest VM.
> >
> > Great, thanks for the confirmation.
> >
> > Cheers,
> > Alistair
> >
> >
> >
> >> thanks,
> >>
> >> Albrecht
> >>
> >> On 07.02.19 07:56, Alistair Grant wrote:
> >>> Hi Albrecht,
> >>>
> >>> On Wed, 6 Feb 2019 at 19:51, Albrecht Baur via Pharo-users
> >>>  wrote:
> >>>> thank you! That is good news.
> >>>>
> >>>> best,
> >>>>
> >>>> Albrecht
> >>> Would you please download the latest VM and confirm that it resolves the 
> >>> issue:
> >>>
> >>> curl get.pharo.org/64/vmLatest80 | bash
> >>>
> >>> The Pharo 8 VM works with Pharo 7 images.
> >>>
> >>> Thanks,
> >>> Alistair
> >>>
> >>>
> >>>> On 06.02.19 09:34, Alistair Grant wrote:
> >>>>> Hi Albrecht,
> >>>>>
> >>>>> On Tue, 5 Feb 2019 at 15:26, Albrecht Baur 
> >>>>>  wrote:
> >>>>>> Hi Alistair,
> >>>>>>
> >>>>>> here the system report output:
> >>>>>>
> >>>>>> ...
> >>>>> Thanks for the info.  Please see:
> >>>>>
> >>>>> Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
> >>>>> PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
> >>>>>
> >>>>> Assuming the CI build passes, I'll wait a day or so to give the VM
> >>>>> guys a chance to review the changes and comment before merging.
> >>>>>
> >>>>> Cheers,
> >>>>> Alistair
> >>>>>
> >
>
>



Re: [Pharo-users] Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

2019-02-07 Thread Alistair Grant
On Thu, 7 Feb 2019 at 09:08, Albrecht Baur  wrote:
>
> Hi Alistair,
>
> I have tested it and works with the latest VM.

Great, thanks for the confirmation.

Cheers,
Alistair



> thanks,
>
> Albrecht
>
> On 07.02.19 07:56, Alistair Grant wrote:
> > Hi Albrecht,
> >
> > On Wed, 6 Feb 2019 at 19:51, Albrecht Baur via Pharo-users
> >  wrote:
> >> thank you! That is good news.
> >>
> >> best,
> >>
> >> Albrecht
> > Would you please download the latest VM and confirm that it resolves the 
> > issue:
> >
> > curl get.pharo.org/64/vmLatest80 | bash
> >
> > The Pharo 8 VM works with Pharo 7 images.
> >
> > Thanks,
> > Alistair
> >
> >
> >> On 06.02.19 09:34, Alistair Grant wrote:
> >>> Hi Albrecht,
> >>>
> >>> On Tue, 5 Feb 2019 at 15:26, Albrecht Baur  
> >>> wrote:
> >>>> Hi Alistair,
> >>>>
> >>>> here the system report output:
> >>>>
> >>>> ...
> >>> Thanks for the info.  Please see:
> >>>
> >>> Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
> >>> PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
> >>>
> >>> Assuming the CI build passes, I'll wait a day or so to give the VM
> >>> guys a chance to review the changes and comment before merging.
> >>>
> >>> Cheers,
> >>> Alistair
> >>>



Re: [Pharo-users] Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

2019-02-06 Thread Alistair Grant
Hi Albrecht,

On Wed, 6 Feb 2019 at 19:51, Albrecht Baur via Pharo-users
 wrote:
>
> thank you! That is good news.
>
> best,
>
> Albrecht

Would you please download the latest VM and confirm that it resolves the issue:

curl get.pharo.org/64/vmLatest80 | bash

The Pharo 8 VM works with Pharo 7 images.

Thanks,
Alistair


> On 06.02.19 09:34, Alistair Grant wrote:
> > Hi Albrecht,
> >
> > On Tue, 5 Feb 2019 at 15:26, Albrecht Baur  
> > wrote:
> >> Hi Alistair,
> >>
> >> here the system report output:
> >>
> >> ...
> > Thanks for the info.  Please see:
> >
> > Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
> > PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371
> >
> > Assuming the CI build passes, I'll wait a day or so to give the VM
> > guys a chance to review the changes and comment before merging.
> >
> > Cheers,
> > Alistair
> >
>



Re: [Pharo-users] Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

2019-02-06 Thread Alistair Grant
Hi Albrecht,

On Tue, 5 Feb 2019 at 15:26, Albrecht Baur  wrote:
>
> Hi Alistair,
>
> here the system report output:
>
> ...

Thanks for the info.  Please see:

Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368
PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/371

Assuming the CI build passes, I'll wait a day or so to give the VM
guys a chance to review the changes and comment before merging.

Cheers,
Alistair



Re: [Pharo-users] Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

2019-02-05 Thread Alistair Grant
Hi Albrecht,

On Fri, 1 Feb 2019 at 19:50, Albrecht Baur via Pharo-users
 wrote:
>
> I get a DirectoryIsNotEmpty exception on
> FileReference(AbstractFileReference)>>deleteAll.

Would you please confirm which version of the VM and Pharo you're
using?  (copy the output of System -> System Reporter default page)

Thanks,
Alistair



Re: [Pharo-users] Why DirectoryIsNotEmpty on FileReference>>deleteAll ?

2019-02-02 Thread Alistair Grant
Hi Albrecht,

On Fri, 1 Feb 2019 at 19:50, Albrecht Baur via Pharo-users
 wrote:
>
> I get a DirectoryIsNotEmpty exception on
> FileReference(AbstractFileReference)>>deleteAll.
>
> But deleteAll is supposed to delete children too. -> So why the exception ?

This is a bug in the FilePlugin.  When deleting directories it is
leaving the deleted directory open.  On Unix this is OK, the entry is
removed from the parent directory and actually deleted when the file
is closed.  I assume that because CIFS is a windows protocol it
doesn't handle it, and leaves the entry there until closed, causing
the problems later on.

The problem can be reduced to the following code:

| root deleteMeFolder |

root := '/path/to/cifs' asFileReference.
deleteMeFolder := root / 'delme'.
deleteMeFolder ensureCreateDirectory.
deleteMeFolder delete.

Then execute:

$ sudo lsof | grep delme

and you'll see the deleted entries.

Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/368

Cheers,
Alistair



Re: [Pharo-users] PharoV50.sources in VM?

2019-02-02 Thread Alistair Grant
On Sat, 2 Feb 2019 at 09:32, Hilaire  wrote:
>
> Thanks for the update.
>
> By the way, is there any reason to not remove the symbols in the Windows
> and Linux VM libraries? It saves several MB. At least for DrGeo
> distribution, there is no use.

I'm  not sure what the impact of this would be, so would prefer others
to comment.


> Hilaire
>
> Le 02/02/2019 à 09:01, Alistair Grant a écrit :
> > I can't see any reason for keeping this.  The sources file is now
> > generated for each image, so it doesn't make sense to distribute it
> > with the VM.
> >
> > I'll remove this in a few days if there aren't any other objections.

It looks like this is a linux only issue (I downloaded Win and Mac VMs
and the sources aren't present).

Issue: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/365
PR: https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/366

Cheers,
Alistair



Re: [Pharo-users] PharoV50.sources in VM?

2019-02-02 Thread Alistair Grant
Hi Hilaire,

On Fri, 1 Feb 2019 at 21:38, Hilaire  wrote:
>
> Hi,
>
> In the Linux distributed VM, I noted the file
> lib/pharo/5./PharoV50.sources.
>
> Can it be removed safely? What is its purpose?

I can't see any reason for keeping this.  The sources file is now
generated for each image, so it doesn't make sense to distribute it
with the VM.

I'll remove this in a few days if there aren't any other objections.

Cheers,
Alistair



[Pharo-users] Linux ARM v6 libgit2 libssh2 libsdl2

2019-01-02 Thread Alistair Grant
Hi All,

Downloading and installing the Pharo 7 vmLatest on a Raspberry Pi
succeeds, but is missing libgit2, libssh2 & libsdl2.  The build
scripts suggest this is intentional due to excessive build times,
which is quite believable.

Is there a place where the libraries can be downloaded from and
dropped in to the VM directory?

Thanks,
Alistair



Re: [Pharo-users] [Pharo-dev] New book: Pharo with Style

2019-01-01 Thread Alistair Grant via Pharo-users
--- Begin Message ---
Hi Richard,

On Tue, 1 Jan 2019 at 07:26, Richard O'Keefe  wrote:
>
> ...
>
> To get an example, I did (String allSelectors atRandom), getting
> #copyWithoutAll:.  That has only one definition, in Collection:
>copyWithoutAll: aCollection
> "Answer a copy of the receiver that does not contain any elements
> equal to those in aCollection."
>
> ^ self reject: [:each | aCollection includes: each]
>
> The comment simply paraphrases the rather simple code.

I agree with pretty much everything you've written, but have a
slightly different view here.

Including what the method does, even when the code is fairly simple
(OK, not getter / setter methods), is still useful.  If the comment is
absent, I have to look at the code, figure out what it does, and then
either figure out if that's what it is supposed to do, or just assume
that I'm correct.  Having to figure out whether I've interpreted the
code correctly just increases the cognitive load.  If the comment
includes what it is supposed to do, I have a context in which to read
and evaluate the code, and it becomes much less effort.

Cheers,
Alistair

--- End Message ---


Re: [Pharo-users] GPS / Longitude / Latitude library

2018-12-27 Thread Alistair Grant
Hi Benoît,

On Sat, 22 Dec 2018 at 09:02, Benoit St-Jean  wrote:
>
> Hi Alistair!
>
> First off, thanks for the "thank you note" in this email & on GitHub.
>
> Would you be interested in working on a port of GeoSphere
> (https://cran.r-project.org/web/packages/geosphere/geosphere.pdf) to
> Pharo ?  I'll have some spare time in the next weeks so we could work on
> that together.  Since this package is widely known and used, it could
> serve as a base for a Geo package for Pharo.  I have R installed with
> this package here so cross-checking Pharo results vs R calculations
> wouldn't be a problem!  That also means plenty of unit tests are
> possible !  ;)

I'm happy to work on this together (and with whoever else is
interested).  Pharo is my hobby which has to fit in with family, etc.,
so my time is rather sporadic.


> I noticed (at least on Pharo 6.1) that you reference "WebBrowser" which
> is either present in P7 (and not in P6) or it indicates a dependency
> problem.

That's why I put "Pharo 7" in the installation section :-)

I haven't tried, but I expect that loading WebBrowser in to Pharo 6 is
straightfoward.  With Pharo 7 about to go GA I have to admit that
personally I'm not interested in putting much effort in to supporting
earlier versions (other than a bit of testing, I haven't used Pharo 6
since it was released :-)).


> I also noticed that you use the WGS84 reference ellipsoid as a hardcoded
> constant (in other works, assuming the earth radius is 6378137 meters
> for all calculations).  Modifying the code to have reference ellipsoids
> objects and use the WGS84 as the default (which is what everyone uses)
> would be a more flexible solution.

Actually, there's #haversineDistanceTo:radius: for exactly this reason
(more below).


> Besides, it would also allow funky
> stuff like being able to use the same framework to work for every known
> spatial body like say, the Moon or Mars or whatever! Besides, that way
> (using reference ellipsoid objects), older maps/coordinates/calculations
> could still be used just by changing the ellipsoid reference.

At the moment the EarthRadius is a class variable.  It would be better
and more flexible to remove it and create separate objects for the
different standards and bodies.


> Let me know if you're interested!

Sure.  I had planned to extend this as required, but if you've got a
particular approach I'm happy to try and fit in (within the time
limitation mentioned above).


> P.S.  I couldn't find a similar package/framework for
> Pharo/Squeak/WhateverSmalltalk.  If I missed it, let me know guys!!  I'm
> not a big fan of reinventing the wheel!!

Ditto.

Cheers,
Alistair


> On 2018-12-19 02:32, Alistair Grant wrote:
> > Hi All,
> >
> > If anyone is interested, I've created the beginnings of a library for
> > handling coordinates at: https://github.com/akgrant43/GeoSphere
> >
> > It only:
> >
> > - Parses string coordinates
> > - Calculates the distance between coordinates
> > - Opens a web browser in OpenStreetMap at the receiver's coordinates
> >
> > Examples of string formats that can be parsed:
> >
> > - 144.61025 @ -38.28697
> > - 38° 17′ 13.09″ S, 144° 36′ 36.9″ E
> > - 38 deg 17' 13.09" S, 144 deg 36' 36.9" E
> > - https://www.openstreetmap.org/#map=18/-38.28697/144.61025
> >
> > The distance calculation uses haversine (assumes the earth is a
> > sphere), which is good enough for my needs at the moment.
> >
> > Thanks again to Sven, Benoit, Pierce and Richard for their input.
> >
> > Cheers,
> > Alistair
> >
> --
> -
> Benoît St-Jean
> Yahoo! Messenger: bstjean
> Twitter: @BenLeChialeux
> Pinterest: benoitstjean
> Instagram: Chef_Benito
> IRC: lamneth
> Blogue: endormitoire.wordpress.com
> "A standpoint is an intellectual horizon of radius zero".  (A. Einstein)
>



Re: [Pharo-users] GPS / Longitude / Latitude library

2018-12-18 Thread Alistair Grant
Hi All,

If anyone is interested, I've created the beginnings of a library for
handling coordinates at: https://github.com/akgrant43/GeoSphere

It only:

- Parses string coordinates
- Calculates the distance between coordinates
- Opens a web browser in OpenStreetMap at the receiver's coordinates

Examples of string formats that can be parsed:

- 144.61025 @ -38.28697
- 38° 17′ 13.09″ S, 144° 36′ 36.9″ E
- 38 deg 17' 13.09" S, 144 deg 36' 36.9" E
- https://www.openstreetmap.org/#map=18/-38.28697/144.61025

The distance calculation uses haversine (assumes the earth is a
sphere), which is good enough for my needs at the moment.

Thanks again to Sven, Benoit, Pierce and Richard for their input.

Cheers,
Alistair



Re: [Pharo-users] GPS / Longitude / Latitude library

2018-12-06 Thread Alistair Grant
Hi Pierce,

On Thu, 6 Dec 2018 at 03:38, Pierce Ng  wrote:
>
> On Wed, Dec 05, 2018 at 07:34:35AM +, Alistair Grant wrote:
> > I'm not doing any database work at the moment (storing results in STON
> > files for now), but will also add the links to the class comments.
>
> Hi Alistair,
>
> I wasn't suggesting storing data in a database per se.
>
> I thought that, given that the desired functionality is not available in
> Pharo, the options are to implement it in pure Smalltalk or wrap an
> existing library. In the latter case, typically one wraps a C library
> using FFI.  With SQLite, its extensions are C libraries that are already
> wrapped for SQL. Writing SQL queries may get you a long way where you're
> going.

Ah, thanks for the clarification, I hadn't thought of that.  I'll
probably still develop a standalone library as it will be useful for
the community, but this may help.

Thanks again,
Alistair



Re: [Pharo-users] GPS / Longitude / Latitude library

2018-12-06 Thread Alistair Grant
Hi Sven,

On Wed, 5 Dec 2018 at 16:08, Sven Van Caekenberghe  wrote:
>
> Alistair,
>
> I found this page really useful 
> http://www.movable-type.co.uk/scripts/latlong.html

Thanks! That will definitely save me some time.

And I used to own a TRS-80 clone. :-)

Cheers,
Alistair



Re: [Pharo-users] GPS / Longitude / Latitude library

2018-12-04 Thread Alistair Grant
Hi Pierce & Richard,

Thanks for your replies.

On Wed, Dec 05, 2018 at 10:24:18AM +0800, Pierce Ng wrote:
> On Tue, Dec 04, 2018 at 10:21:20AM +0100, Alistair Grant wrote:
> > Does anyone know of a library for processing GPS coordinates?
> > 
> > What I'm looking for are things like:
> > 
> > - Parsing from and printing to various string formats (HMS, NESW, decimal)
> > - Distance between two points
> > - etc.
> 
> SQLite-based possibilities:
> 
> - Spatialite: https://www.gaia-gis.it/fossil/libspatialite/index
> - R*Tree: https://sqlite.org/rtree.html
> - GeoPoly: https://sqlite.org/geopoly.html



On Wed, Dec 05, 2018 at 06:44:35PM +1300, Richard O'Keefe wrote:
> As Dershowitz and Reingold showed in their book "Calendrical Calculations",
> converting from UTC to several calendars needs latitude, longitude, and
> elevation.  ISO 6709 is the relevant standard:
> https://en.wikipedia.org/wiki/ISO_6709

My camera uses D M S (0 deg 0' 0.00", 0 deg 0' 0.00") so I'll use that
initially, but I'll definitely add links in the comments and make sure
that support for other formats can be added.

I'm not doing any database work at the moment (storing results in STON
files for now), but will also add the links to the class comments.

Thanks again,
Alistair




Re: [Pharo-users] GPS / Longitude / Latitude library

2018-12-04 Thread Alistair Grant
Hi Sven,

On Tue, 4 Dec 2018 at 11:04, Sven Van Caekenberghe  wrote:
>
> Hi Alistair,
>
> > On 4 Dec 2018, at 10:21, Alistair Grant  wrote:
> >
> > Hi,
> >
> > Does anyone know of a library for processing GPS coordinates?
> >
> > What I'm looking for are things like:
> >
> > - Parsing from and printing to various string formats (HMS, NESW, decimal)
> > - Distance between two points
> > - etc.
> >
> > Thanks,
> > Alistair
>
> We've got some elementary stuff based on WGS84 coordinates as points. For 
> example,
>
> T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733.
> T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733.
> T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500.
> T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 
> 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
> T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 
> 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
>
> This is not open source, but it is not rocket science either (just 
> implementations of public algorithms).

Right, I'll probably have a go at this a put it up on github.

It looks like you've chosen to model the coordinates using the Point
class rather than creating a Coordinate class.  Can you explain why (I
don't have a strong preference either way, so am wondering what your
thinking is).

It also looks like it is longitude @ latitude.  Is that correct?  (I
guess it lines up with the point y value being vertical, which is
latitude.  But most written forms put latitude first).

Thanks!
Alistair



Re: [Pharo-users] GPS / Longitude / Latitude library

2018-12-04 Thread Alistair Grant
Hi Sven,

Thanks.  This is just for me playing around with my photo collection,
i.e. find all photos from a particular location, i.e. within a
specified distance of a point.  Also maybe add GPS coordinates to some
photos.

Thanks again,
Alistair

On Tue, 4 Dec 2018 at 11:04, Sven Van Caekenberghe  wrote:
>
> Hi Alistair,
>
> > On 4 Dec 2018, at 10:21, Alistair Grant  wrote:
> >
> > Hi,
> >
> > Does anyone know of a library for processing GPS coordinates?
> >
> > What I'm looking for are things like:
> >
> > - Parsing from and printing to various string formats (HMS, NESW, decimal)
> > - Distance between two points
> > - etc.
> >
> > Thanks,
> > Alistair
>
> We've got some elementary stuff based on WGS84 coordinates as points. For 
> example,
>
> T3GeoTools distanceBetween: 5.33732@50.926 and: 5.49705@50.82733.
> T3GeoTools bearingFrom: 5.33732@50.926 to: 5.49705@50.82733.
> T3GeoTools destinationFrom: 5.33732@50.926 bearing: 45 distance: 2500.
> T3GeoTools centroidOf: { 5.48230@50.82249. 5.49523@50.81288. 
> 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
> T3GeoTools is: 5.33732@50.92601 inside: { 5.48230@50.82249. 5.49523@50.81288. 
> 5.50138@50.82008. 5.50228@50.82595. 5.49265@50.82560. 5.48230@50.82249 }.
>
> This is not open source, but it is not rocket science either (just 
> implementations of public algorithms).
>
> We have less need for special conversions, we do them case by case when they 
> occur.
>
> What are you planning to do ?
>
> Sven
>
>



[Pharo-users] GPS / Longitude / Latitude library

2018-12-04 Thread Alistair Grant
Hi,

Does anyone know of a library for processing GPS coordinates?

What I'm looking for are things like:

- Parsing from and printing to various string formats (HMS, NESW, decimal)
- Distance between two points
- etc.

Thanks,
Alistair



Re: [Pharo-users] UFFI and opaque(ish) types

2018-12-03 Thread Alistair Grant
Hi Ben and Phil,

Thanks for your replies.

On Sun, Dec 02, 2018 at 10:53:11PM +0800, Ben Coman wrote:
> One option could be to create a small shared library that you compile for each
> platform that just exported the member offsets... 
> https://www.embedded.com/design/prototyping-and-development/4024941/
> Learn-a-new-trick-with-the-offsetof--macro
> 
> You first FFI to that read struct member offsets and dynamically create the
> definitions for your target library.
> I haven't tried it in practice.
> 
> cheers -ben
> 
> P.S. Occasionally I dream about compilers being able to embed a pre-compiled
> header declaration block in the library for FFI users to iterate... 
> https://clang.llvm.org/docs/PCHInternals.html#declarations-block



On Sun, Dec 02, 2018 at 04:41:38PM +0100, p...@highoctane.be wrote:
> No, but what about FFIExternalPackedStructureTest  and FFITestStructure ?
> 
> Never tried with a typedef in the fieldsDesc but may work.
> 
> Phil


OK, it sounds like this still hasn't been adressed.

The other idea that we've discussed in the past is to supply human 
readable text files that describe the structures for each platform, e.g. 
a STON file.  The file would be generated by automatically creating a 
program that dumps the required information to the STON text file.  This 
would allow the definitions to be used on platforms that don't have a 
compiler or the dev versions of the libraries installed.  I think we 
could even use the current #fieldDesc methods to generate these programs 
(maybe with some additional information stored in the class).

A couple of links:

- 
http://forum.world.st/PATCH-added-FilePlugin-error-code-lookup-function-tp5071376p5071620.html
- 
http://forum.world.st/PATCH-added-FilePlugin-error-code-lookup-function-tp5071376p5075016.html


Thanks again,
Alistair




Re: [Pharo-users] UFFI and opaque(ish) types

2018-12-02 Thread Alistair Grant
Hi Phil and Esteban,

Thanks for your replies.

I've realised that I badly worded my question.  By "opaque" I meant that
it is difficult to determine the underlying type of the
variables, but I still want to be access the values of typeA and typeB
in my example structure.

Phil, I had a look through your XMPP code, if it does show an example of
actually retrieving a structure member such as "typeA" in my example, my
apologies and please let me know where it is.

Thanks again,
Alistair


On Fri, 30 Nov 2018 at 23:46, Esteban Lorenzano  wrote:
>
> On 30 Nov 2018, at 19:50, phil--- via Pharo-users 
>  wrote:
>
> From: "p...@highoctane.be" 
> Subject: Re: [Pharo-users] UFFI and opaque(ish) types
> Date: 30 November 2018 at 19:50:03 CET
> To: Any question about pharo is welcome 
>
>
> Inherit from FFIOpaqueObject
>
> + initialize TypeMap
>
> I have a few here:
>
> https://github.com/Pharophile/XmppTalk
>
> https://github.com/Pharophile/XmppTalk/tree/master/packages/XmppTalk-ExternalStructures.package
> https://github.com/Pharophile/XmppTalk/blob/master/packages/XmppTalk-LibStrophe.package/StropheLib.class/class/initializeTypeMap.st
>
> HTH
> Phil
>
>
> Yes, as he says/shows :)
>
> Esteban

> On Fri, Nov 30, 2018 at 2:39 PM Alistair Grant  wrote:
>>
>> How are opaque(ish) types normally handled in UFFI (or FFI)?
>>
>> E.g. if I want to use libstuff which defines the following structure:
>>
>> struct stuffstruct {
>> typeA a;
>> typeB b;
>> } stufftype;
>>
>>
>> I might know they're integers, but not the size, signed vs. unsigned,
>> etc.
>>
>> The definitions of typeA and typeB are buried in multiple layers of
>> header files, dependent on #if tests, can be different sizes on
>> different platforms (e.g. Linux vs. MacOS), etc.?
>>
>> Is this documented somewhere?
>>
>> Thanks,
>> Alistair



[Pharo-users] UFFI and opaque(ish) types

2018-11-30 Thread Alistair Grant
How are opaque(ish) types normally handled in UFFI (or FFI)?

E.g. if I want to use libstuff which defines the following structure:

struct stuffstruct {
typeA a;
typeB b;
} stufftype;


I might know they're integers, but not the size, signed vs. unsigned,
etc.

The definitions of typeA and typeB are buried in multiple layers of
header files, dependent on #if tests, can be different sizes on
different platforms (e.g. Linux vs. MacOS), etc.?

Is this documented somewhere?

Thanks,
Alistair



Re: [Pharo-users] Commit dates when migrating repos to github

2018-11-21 Thread Alistair Grant
On Wed, 21 Nov 2018 at 16:31, Ben Coman via Pharo-users
 wrote:
>
>
>
> On Wed, 21 Nov 2018 at 22:22, nacho <0800na...@gmail.com> wrote:
>>
>> do you know of some resources, tutorial or documentaton I can read to learn
>> how to use Iceberg?
>> I'm completely lost.
>> thanks
>> Nacho
>
>
> How familiar are you already with git?
>
> This seems to be the most recent video...
> https://www.youtube.com/watch?v=PK2yCu2rWCc
>
> Notes from the main repo...
> https://github.com/pharo-vcs/iceberg/tree/master/docs

Slides, rather than a video, but a bit more recent:

https://www.slideshare.net/esug/contributing-to-pharo-18


Cheers,
Alistair



Re: [Pharo-users] Issue with starting 32-bit Pharo under Linux

2018-11-17 Thread Alistair Grant
On Sun, 18 Nov 2018 at 04:55, horrido  wrote:
>
> I just discovered why! I have to run the bloody thing as root! Why the hell
> is that???

Just a guess: do you have write access to the image directory?

Cheers,
Alistair



Re: [Pharo-users] Pharo on Linux

2018-11-17 Thread Alistair Grant
Hi Richard,

You're mixing 32 bit and 64 bit installations.  I'd just use the
zero-conf install.  In an empty directory:

curl get.pharo.org/64/61+vm | bash

or

wget -O - get.pharo.org/64/61+vm | bash

HTH,
Alistair

On Sat, 17 Nov 2018 at 21:32, Richard Kenneth Eng
 wrote:
>
> I'm running Debian. At http://files.pharo.org, I download
>
> platform/Pharo6.0-64-linux.zip
> sources/PharoV60.sources.zip
> wget -O- get.pharo.org/60 | bash
>
> Then I try: ./pharo Pharo.image &
>
> I'm always getting "This interpreter (vers. 68021) cannot read image file 
> (vers. 6521)."
>
> What's wrong?
>



Re: [Pharo-users] [Pharo-dev] [ANN] Pharo v7.0.0-rc1 released!

2018-11-14 Thread Alistair Grant
Hi Hans,

On Wed, 14 Nov 2018 at 15:50, Baveco, Hans  wrote:
>
> On windows  7 the 32bits version opens with an error: “PrimitiveFailed: 
> primitive #fileDescriptorType: in File class failed.”
>
> When discarding the error and saving & quitting the image, subsequent 
> startups (via the launcher) do not display the gui anymore...
>
> Hans

This is a different, known issue.  Your VM is out of date.  If you're
using PharoLauncher I think you can just delete the VM directories and
start again (I don't use PharoLauncher, so someone else may correct
me).

Cheers,
Alistair



Re: [Pharo-users] [Pharo-dev] [ANN] Pharo v7.0.0-rc1 released!

2018-11-14 Thread Alistair Grant
Hi Vitor,

On Wed, 14 Nov 2018 at 14:37, Vitor Medina Cruz  wrote:
>
> Got instant red crossed welcome window on windows 7 64bits with the Pharo 7 
> 64 bits: "Error: Instances of SourceFileArray are not indexable". I will try 
> on a windows 10 version later.

Which VM are you using? (pharoconsole --version)

I've seen this just once on Ubuntu 16.04 (64 bit), but wasn't able to
reproduce it, and think it was a more recent VM than the current
stable version.

Thanks,
Alistair



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

2018-11-09 Thread Alistair Grant
Hi Peter,

On Fri, 9 Nov 2018 at 19:00, Alistair Grant  wrote:
>
> Hi Peter,
>
> On Fri, 9 Nov 2018 at 18:51, Peter Uhnak  wrote:
> >>
> >> but how do I find now the answer do I have to do something like   puzzle1  
> >> stepChanges detectIndex ?
> >
> >
> > How do you mean? It would be the same
> >
> > santaFloorOnBasement
> > "calculates which step take Santa to the basement"
> >
> > stepChanges := input collect: [ :c |
> > floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]).
> > floor
> > ].
> >
> > stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input 
> > yo' ].
> >
> >> then I see this error message :  Improper store to indexable object.
> >
> >
> > Because earlier you were comparing strings and not characters, I assumed 
> > your input was an array of strings like #('(' '(' '('). but you can fix 
> > that by changing `input collect:` -> `input asArray collect:` and `c = '('` 
> > -> `c = $(`.
>
> Using '(' instead of $( is indeed an error, but it isn't the cause of
> the Improper store error.

I was too quick to respond here, I didn't look at the #asArray.  Sorry!

But still suggest Roelof looks at the debugger...

> Roelof, I really suggest you trigger this error again, start the
> debugger and then take a look in the call stack (I'm assuming you're
> familiar with at least one other programming language, so should be
> able to figure out the debugger).

Cheers,
Alistair



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

2018-11-09 Thread Alistair Grant
Hi Peter,

On Fri, 9 Nov 2018 at 18:51, Peter Uhnak  wrote:
>>
>> but how do I find now the answer do I have to do something like   puzzle1  
>> stepChanges detectIndex ?
>
>
> How do you mean? It would be the same
>
> santaFloorOnBasement
> "calculates which step take Santa to the basement"
>
> stepChanges := input collect: [ :c |
> floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]).
> floor
> ].
>
> stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input 
> yo' ].
>
>> then I see this error message :  Improper store to indexable object.
>
>
> Because earlier you were comparing strings and not characters, I assumed your 
> input was an array of strings like #('(' '(' '('). but you can fix that by 
> changing `input collect:` -> `input asArray collect:` and `c = '('` -> `c = 
> $(`.

Using '(' instead of $( is indeed an error, but it isn't the cause of
the Improper store error.

Roelof, I really suggest you trigger this error again, start the
debugger and then take a look in the call stack (I'm assuming you're
familiar with at least one other programming language, so should be
able to figure out the debugger).

Cheers,
Alistair



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

2018-11-09 Thread Alistair Grant
On Fri, 9 Nov 2018 at 18:38, Gabriel Cotelli  wrote:
>
> It's bug in the collect: implementation used in String. I've opened 
> https://pharo.fogbugz.com/f/cases/22652/collect-over-Strings-is-broken

Strings store characters, not integers, so change your example to:

'aa' collect: [ :a | $1 ]

and you'll see that (I think) it is working as expected.

You could do:

'aa' collect: [ :a | 1 ] as: Array.

Roelof, revisit your example, taking the above in to account :-)

HTH,
Alistair



Re: [Pharo-users] git repos cloned into unexpected directory

2018-11-02 Thread Alistair Grant
Hi Arturo,

On Fri, 2 Nov 2018 at 12:49, Arturo Zambrano  wrote:
>
> Hi!
> I'm getting the following strange behavior using Iceberg in Pharo7 .
>
> My setup is like this:
> - Using Pharo Launcher
> - have several images
>
> I notice that when I clone a repository it is correctly downloaded into 
> pharo-local/icerberg of that image.
>
> When I load a baseline of that project, that fires the download of several 
> github repos, they are NOT stored in pharo-local/iceberg for the current 
> image. Instead,
> they stored in pharo-local of an old image. I even tried deleting the whole 
> old image directory (the one that pharo launcher creates). The result is the 
> same, all the dependencies are stored in that directory (something recreates 
> that).
>
> As a result several images are sharing a common iceberg location  for 
> dependencies ... I checked that I don't have enabled "Share repositories 
> between images".
>
> Is there some settings file shared between all the pharo launcher managed  
> images?
> Thanks!

Yes!  Take a look at:

StartupPreferencesLoader preferencesGeneralFolder

It might be worthwhile renaming the settings folder to another
directory so that you remove all your settings and then trying again.

Cheers,
Alistair



Re: [Pharo-users] Installing SmaCC

2018-10-17 Thread Alistair Grant
Hi Dimitris,

As someone currently learning to use Slang (i.e. not an expert), I've
added my 2c below...

On Wed, 17 Oct 2018 at 11:06, Dimitris Chloupis  wrote:
>
> Thierry you have done it !!! you just gave a very easy solution to my 
> problems.
>
> Yeap Slang is quite close to what I am thinking, unfortunately Clement told 
> me to stay away from it because the code is ugly and specially used for VM 
> only. If I remember also correctly it does not generate readable C code 
> either. But the idea as a concept is very close to what I imagine.

I've found the C code produced to be quite readable, but that is
probably influenced by the fact that I have read the slang first.


> As a matter of fact you mentioning Slang made  I have an epiphany that I dont 
> have to create a new syntax at all, instead I could use specific variables or 
> methods to provide type annotation. Thus like Slang I can use regular 
> Smalltalk code that avoids changing types but without the need for type 
> inference (although I am not excluding this either).
>
> So yes I am definetly want to move to the direction that Slang goes so I can 
> fully utilise the Pharo IDE and minise code that I have to write.
>
> So basically I am thinking write code as you always write in Pharo and either
> a) Have special dictionary variables in each method that provide static type 
> annotations for the arguments of the methods, its return type and local 
> variables

Slang uses method pragmas to define the variables types.  This seems
to work quite well.


> b) Have special methods that provide such dictionaries seperately.
>
> Or probably both. This way I can write 100% Smalltalk code and use a very 
> small compiler to read those dictionary variables for the type of the 
> variables and functions/structs (essentially a class will be output for a C 
> struct with pointers to functions for methods and variables for instance 
> variables). Why invent a whole new language when everything I need already 
> Pharo provides ?
> I could also use special variable dictionaries for all sort of things like 
> generation of header files, generation of CMake files for automatic building.
>
> Also I like to use the way UFFI is doing C function signatures by using 
> symbol arrays.
>
> So thank you all for inspiration it looks like all I need is Pharo AST 
> methods (which I can from the AST packages) and SmaCC.
> So yeap looks like Magnatar will be a new Slang afterall, I will keep you 
> posted.
>
> Also this also opens the possibility of autowrapping the generated c code 
> back to Pharo through UFFI, so one can use C code as if its Pharo code. I can 
> leverage the TalkFFI project that does this already. Seems all the pieces 
> have fallen in their place.
>
> Keep the suggestions and advice coming, you guys are inspirational :D

Do you intend that the Smalltalk code can be executed?  This will
likely increase the complexity quite a bit.  In the VM simulation we
end up creating a XSimulation subclass that provides the framework for
executing the smalltalk code, e.g simulating functions that are only
in C.

There is also the problem of platform differences.  Slang doesn't
really handle them well (pragmas can be used to indicated that methods
should only be compiled on certain platforms, and #ifdef type code can
be used, but it isn't enough).  It would be nice to have a class that
provides cross platform functionality, and then platform specific
classes as required.

HTH,
Alistair



Re: [Pharo-users] Dictionary and Date as keys

2018-10-16 Thread Alistair Grant
Hi Petr,

On Tue, 16 Oct 2018 at 21:25, Petr Fischer via Pharo-users
 wrote:
>
> My problem - use Dates as Dictionary keys - shortly:
>
> d1 := Date today translateToUTC.
> d2 := Date today.
>
> d1 = d2. (true!)

Which timezone are you in?

CEDT (UTC+0200) gives false for this.

Date is implemented primarily as a timespan, so days in different
timezones are considered different.  If you do:

| d1 d2 |

d1 := Date today translateTo: (TimeZone abbreviated: 'UTC') offset.
d2 := Date today translateTo: (TimeZone abbreviated: 'EST') offset.

{ d1 = d2.  d1 equals: d2 }


You can see the difference.

Of course, this doesn't help with using Date as a key in a dictionary.
Probably your best option is to look at Sven's excellent ZTimezone
package (although I haven't tested it in this scenario).

I can't find the repository right now (I think Sven moved it to github).  Sven?

Cheers,
Alistair



> d := Dictionary new.
> d at: d1 put: 1.
>
> d at: d1. (ok)
> d at: d2. (bad - key not found)
>
> ---
>
> pf
>



Re: [Pharo-users] GlorpSQLite Github release management

2018-10-11 Thread Alistair Grant
Hi Pierce,

On Fri, 12 Oct 2018 at 06:21, Pierce Ng  wrote:
>
> Hi all,
>
> So GlorpSQLite works on Pharo 5 and 6, but not yet on Pharo 7.

I've been using GlorpSQLite in Pharo 7 since development started.  It
is loaded from another package's baseline as:

spec
baseline: 'GlorpSQLite' with: [
spec repository: 'github://pharo-rdbms/glorp-sqlite3' ].

I have some patches for date and time handling which I load on top
(and should really submit as a patch), but I don't think these are
Pharo 7 related.


> Currently, I have the following:
>
>   https://github.com/PierceNg/glorp
>   https://github.com/PierceNg/glorp-sqlite3
>
> Which are forks of these:
>
>   https://github.com/pharo-rdbms/glorp
>   https://github.com/pharo-rdbms/glorp-sqlite3

I'll take a look.


> I'm thinking to create a release, say, v1.0, for the current known
> working GlorpSQLite combo for Pharo 5 and 6 in my repos, then, ...
> create a branch for Pharo 7? Then turn the branch into release v2.0 when
> ready? I do all of these actions in my repo, and through pull requests
> to upstream, Git will take care of synchronizing across the forks?

I'm not a git expert either, but I suspect the branches will need to
be created in the main repository.  The modifications can then be
applied to the appropriate branch as a PR.


> Does the above sound workable? Is there a better approach?
>
> Pierce, Git noob
>



Re: [Pharo-users] http://pharo.org/download | Pharo7 standalone?

2018-10-04 Thread Alistair Grant
Hi Hannes,

It depends a bit on the platform.  For linux 64 bit:

curl get.pharo.org/64/70+vm | bash

HTH,
Alistair

On Fri, 5 Oct 2018 at 01:28, H. Hirzel  wrote:
>
> Hello
>
> The Pharo download page http://pharo.org/download offers the Pharo
> launcher with various images and a Pharo6.1 standalone download.
>
> I would like to have a Pharo 7 standalone installation.
>
> How do I do that?
>
> Thank you for the answer in advance
>
> Hannes
>



Re: [Pharo-users] GTDocument how to

2018-09-29 Thread Alistair Grant
Hi Hilaire,

This looks like you have an old VM.  If you get the current stable VM
it should be fine.

The current Pharo 6 & 7 VMs are both dated 28 June 2018.

Cheers,
Alistair

On Sat, 29 Sep 2018 at 19:11, Hilaire  wrote:
>
> Nice!
>
> I got issue when installing GToolkit on P7. May be the VM is not up to
> the task (I took the one shipped with P6.1) but there are error message
> with stdio... See screenshot.
>
> Will try with a newer VM.
>
> Hilaire
>
>
> Le 29/09/2018 à 17:12, Juraj Kubelka via Pharo-users a écrit :
> > I was able to install both, DrGeo and GToolkit in Pharo 7.0 image:
>
> --
> Dr. Geo
> http://drgeo.eu
>



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

2018-09-27 Thread Alistair Grant
Hi Guille,

I wasn't aware this existed - thanks for letting us know!

Cheers,
Alistair


On Thu, 27 Sep 2018 at 15:41, Norbert Hartl  wrote:
>
> Super! Thanks
>
> Norbert
>
> Am 27.09.2018 um 11:26 schrieb Guillermo Polito :
>
> Hi all,
>
> I've moved the Artefact library to GitHub 
> (https://github.com/pharo-contributions/Artefact).
>
> I've also made some changes to it in the way and made a 1.7.0 version with:
>  - support for Pharo7 streams
>  - a baseline
>
> So, people using Artifact, you can contribute through pull requests ^^,
> Guille
>
> --
>
>
>
> Guille Polito
>
> Research Engineer
>
> Centre de Recherche en Informatique, Signal et Automatique de Lille
>
> CRIStAL - UMR 9189
>
> French National Center for Scientific Research - http://www.cnrs.fr
>
>
> Web: http://guillep.github.io
>
> Phone: +33 06 52 70 66 13



Re: [Pharo-users] Periodic long GC's when just coding in newer Pharo 7's?

2018-09-07 Thread Alistair Grant
Hi Tim,


On Fri, 7 Sep 2018 at 18:02, Tim Mackinnon  wrote:
>
> I thought I would mention this as its something I’ve only just started to 
> notice… when doing some brief coding sessions (as in, each day I unsuspend my 
> laptop and code for 30-40 minutes - to write some missing tests) - I have 
> started to notice I get a spinning beach ball in Pharo for 15+ seconds and 
> then it recovers. It’s usually once each day, and it does recover.
>
> It feels like its deciding to do a GC - but I’m not sure how to tell. It 
> could be nothing - but its not something I’ve noticed in Pharo 6.1 and seems 
> unique to Pharo 7 (which I’ve started to try using more recently).
>
> Its just happened now in build 1167 64bit on OSX (I believe I have the newer 
> vm - as I had to re-download them for pharo-launcher).

Hopefully someone who is a regular OSX user can comment on whether
they've seen similar behaviour.  I haven't seen this on linux.

One thing to try is the equivalent of (on linux):

kill -USR1 

That will ask the VM to dump it's current state to stdout / stderr (I
forget which).

Maybe try it while the system is responding so you can see the sort of
information that is provided, and then when you get the spinning beach
ball.

HTH,
Alistair



Re: [Pharo-users] Pharo 6 snap package

2018-08-24 Thread Alistair Grant
Hi Hannes,

On Fri, 24 Aug 2018 at 06:36, H. Hirzel  wrote:
>
> Hello Alistair
>
> Thank you for the detailed answer. I understand that at the moment
> going for a Pharo snap package does not seem to be useful.
>
> In particular as a Pharo installation may reside in a directory with
> everything included.
> So different Pharo installations may reside in different directories.

Yep.  Especially if using the in-development version of Pharo
(currently 7), I find it useful to pair images and VMs.


> I think where snap still might come is for solutions which require
> more than a particular Pharo installation.
>
> For example I could think of combining a particular Pharo version with
> a particular Jupyter notebook installation into a snap which could
> lead to a  web based 'Dynabook' solution.

That was one of the things that attracted me to snaps originally, I
use sqlite in my daily environment, so included it in the Pharo snap.


> I am also looking forward to Guille's answer.

+1.

Cheers,
Alistair


> Regards
> Hannes
>
> On 8/23/18, Alistair Grant  wrote:
> > Hi Hannes,
> >
> > On Wed, 22 Aug 2018 at 17:20, H. Hirzel  wrote:
> >>
> >> Hello
> >>
> >> Are there plans to do a Pharo 6.1  snap package in the upcoming
> >> months? (Ubuntu 18.04.1)
> >
> > I haven't been thinking about it really, because:
> >
> > - The big attraction for me was the ability to easily run 32 bit Pharo
> > on a 64 bit OS without installing all the dependencies.  But now that
> > 64 bit Pharo is stable that driver has largely gone.
> > - The sandboxing is quite limiting for a development environment, so
> > if you want to run commands on the localhost you end up doing
> > something like ssh'ing the command to localhost.
> > - The snap runtime environment is still quite immature - I've had to
> > deal with bugs in snapd, the gtk desktop interface, loading 32 bit
> > executables, etc.
> > - The snapcraft build environment is still evolving, so I have to keep
> > up with the changes.
> > - I was originally compiling the 32 and 64 bit VMs as part of the
> > build process, but that is problematic as the 32 and 64 bit libraries
> > tend to interfere with each other making the build process unstable.
> > - You can't run multiple versions of a snap on one system, e.g. we
> > can't have Pharo 6 and Pharo 7 installed simultaneously under the one
> > snap name (pharo).  I tried to register Pharo7 so pharo could be the
> > GA version (6), but never got a response.
> >
> > I was listening to an Ubuntu podcast just this week where one of the
> > hosts tried installing 4 packages via snaps and ended up going back to
> > debian packages for 3 of the packages due to problems, so it obviously
> > still isn't mature.
> >
> > I realise that every software package has its own issues, I'm sure
> > someone from the snap community could find parallel issues with Pharo,
> > but it wasn't where I wanted to be spending all my time.
> >
> > If someone wants to take it over, I'm more than happy to pass it on
> > (although it isn't building at the moment due to changes in
> > snapcraft).
> >
> > If there is enough interest I'll try and update it to run Pharo 6.1.
> >
> > If Guille is actively maintaining his package, maybe we should move to
> > that (I haven't looked at it).
> >
> > Cheers,
> > Alistair



Re: [Pharo-users] Pharo 6 snap package

2018-08-23 Thread Alistair Grant
Hi Hannes,

On Wed, 22 Aug 2018 at 17:20, H. Hirzel  wrote:
>
> Hello
>
> Are there plans to do a Pharo 6.1  snap package in the upcoming
> months? (Ubuntu 18.04.1)

I haven't been thinking about it really, because:

- The big attraction for me was the ability to easily run 32 bit Pharo
on a 64 bit OS without installing all the dependencies.  But now that
64 bit Pharo is stable that driver has largely gone.
- The sandboxing is quite limiting for a development environment, so
if you want to run commands on the localhost you end up doing
something like ssh'ing the command to localhost.
- The snap runtime environment is still quite immature - I've had to
deal with bugs in snapd, the gtk desktop interface, loading 32 bit
executables, etc.
- The snapcraft build environment is still evolving, so I have to keep
up with the changes.
- I was originally compiling the 32 and 64 bit VMs as part of the
build process, but that is problematic as the 32 and 64 bit libraries
tend to interfere with each other making the build process unstable.
- You can't run multiple versions of a snap on one system, e.g. we
can't have Pharo 6 and Pharo 7 installed simultaneously under the one
snap name (pharo).  I tried to register Pharo7 so pharo could be the
GA version (6), but never got a response.

I was listening to an Ubuntu podcast just this week where one of the
hosts tried installing 4 packages via snaps and ended up going back to
debian packages for 3 of the packages due to problems, so it obviously
still isn't mature.

I realise that every software package has its own issues, I'm sure
someone from the snap community could find parallel issues with Pharo,
but it wasn't where I wanted to be spending all my time.

If someone wants to take it over, I'm more than happy to pass it on
(although it isn't building at the moment due to changes in
snapcraft).

If there is enough interest I'll try and update it to run Pharo 6.1.

If Guille is actively maintaining his package, maybe we should move to
that (I haven't looked at it).

Cheers,
Alistair



Re: [Pharo-users] [Vm-dev] Pharo 6.1 installation problem on Ubuntu 18.04.1 Bionic Beaver

2018-08-22 Thread Alistair Grant
Hi Hannes,


On Wed, 22 Aug 2018 at 18:48, H. Hirzel  wrote:
>
>
> Hello
>
> I'd like to install Pharo 6.1 in a new  installation of
>
> Ubuntu 18.04.1 Bionic Beaver [1]
>
> I get a message
>
> ./pharo-ui
> Error. Could not determine platform's libc path for VM.
> Try forcing $PLATFORMLIBDIR in /home/user25/pharo6.1/pharo-vm/pharo,
> based on LIBC_SO.  [2]
>
> Ubuntu 18.04.1 Bionic Beaver is a new installation. The only added sw
> is the Python anaconda distribution.
> https://www.anaconda.com/download/#linux
>
> Suggestions how fix this issue are welcome.
>
> Regards
> Hannes
>
>
>
> [1] http://releases.ubuntu.com/18.04/
>
>
> [2] The installation sequence
>
> wget -O- get.pharo.org | bash
>
>
> ./pharo-ui
> Error. Could not determine platform's libc path for VM.
> Try forcing $PLATFORMLIBDIR in /home/user25/pharo6.1/pharo-vm/pharo,
> based on LIBC_SO.
> Please report what works to pharo [vm-dev] mail list.
>   LIBC_SO=
>   DISTRIB_ID=Ubuntu
>   DISTRIB_RELEASE=18.04
>   DISTRIB_CODENAME=bionic
>   DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
>   NAME="Ubuntu"
>   VERSION="18.04.1 LTS (Bionic Beaver)"
>   ID=ubuntu
>   ID_LIKE=debian
>   PRETTY_NAME="Ubuntu 18.04.1 LTS"
>   VERSION_ID="18.04"
>   VERSION_CODENAME=bionic
>   UBUNTU_CODENAME=bionic
>   UNAME=Linux Latitude2 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17
> 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
>   System seems to be 64 bit. You may need to (re)install the 32-bit libraries.

As it says, it looks like you don't have the 32 bit libraries
installed (I assume you're on 64 bit Ubuntu).

Do you really need 32 bit pharo?

How about:

curl get.pharo.org/64/61+vm | bash


HTH,
Alistair



Re: [Pharo-users] Pharo 7 file streams guideline

2018-07-24 Thread Alistair Grant
On Tue., 24 Jul. 2018, 10:13 Sven Van Caekenberghe,  wrote:

>
>
> > On 23 Jul 2018, at 12:07, Sven Van Caekenberghe  wrote:
> >
> > Stdio stdout and friends just return a binary stream, hence they need
> wrapping for encoding.
> >
> > Maybe
> >
> >  Stdio stdoutAsText
> >
> > might be an idea, but this is so uncommon that I am not sure this is a
> good idea.
>
> Given all remarks and comments (thanks BTW), I now think that
>
> - textual stdio streams are the more common case
> - binary stdio streams are the primitive ones that are seldom used
> - another encoding than UTF-8 seems uncommon
> - these are streams that exist and need no real opening/closing
>
> So,
>
>   Stdio stdout
>
> should return return a character write stream with UTF-8 encoding while
>
>   Stdio binaryStdout
>
> should be the lower level binary one.
> This would be more in line with the other streams.
> A non-UTF-8 encoding can be used as per Pavel's example.
>

+1

I didn't suggest this earlier because it isn't backward compatible.  But I
do think it is the better solution.


Cheers,
Alistair
(on phone)


Re: [Pharo-users] Pharo 7 file streams guideline

2018-07-23 Thread Alistair Grant
Hi Pavel & Sven,

Thanks for writing this, it is a great quick reference.


On Mon, 23 Jul 2018 at 12:08, Sven Van Caekenberghe  wrote:
>
>
>
> > On 23 Jul 2018, at 11:13, Ben Coman  wrote:
> >
> > I like all the new code examples until  "Write a UTF-8 text to STDOUT"
> > and I wonder "Stdio stdout  writeStreamDo: [ :stream | stream
> > nextPutAll: 'a ≠ b' ]"  would better fit the pattern of the other new
> > code.
> > (presuming "Stdio stdout" returns a FileReference, oherwise maybe
> > "Stdio stdoutRef" or "Stdio stdout asFileReference")
>
> Stdio stdout and friends just return a binary stream, hence they need 
> wrapping for encoding.
>
> Maybe
>
>   Stdio stdoutAsText
>
> might be an idea, but this is so uncommon that I am not sure this is a good 
> idea.

I've written this code enough times that I'd like to see it included. :-)

Maybe

Stdout utf8Stdout

(following the pattern of ByteArray>>utf8Decoded, String>>utf8Encoded)

?

Thanks again,
Alistair



[Pharo-users] EXIF / JPEG metadata

2018-06-24 Thread Alistair Grant
Hi Everyone,

As far as I can tell, JPEGReadWriter in Pharo 7 doesn't read (or
write) the image metadata, e.g. title, keywords, exposure time, etc.

Is anyone aware of a package that does?

Thanks!
Alistair



Re: [Pharo-users] Strange Result - OmniBase bug or Date feature?

2018-06-23 Thread Alistair Grant
Hi Peter,

On Sat, 23 Jun 2018 at 17:47, PBKResearch  wrote:
>
> Hello All
>
>
>
> I am experimenting with the version of OmniBase which Esteban Lorenzano 
> posted a few days ago. With corrections posted by Matias Moretto, who is 
> working on the same track, I have got the first five tests all green. On the 
> sixth test, OmniBaseTest>>#testEquality, I have run into a strange failure. I 
> don’t know whether it shows that OmniBase is not recovering data correctly, 
> or whether it is a feature of the way Date is implemented in Pharo. (I still 
> have Dolphin 6 on my machine, including OmniBase, and there the same test 
> passes.)
>
>
>
> The test simply constructs a collection of various types of object, stores 
> the whole collection on the database, retrieves it and compares each 
> retrieved element with the corresponding element of the original collection. 
> One element is obtained by evaluating ‘Date today’, and that is the one that 
> fails. The test failure description is: ‘Got 23 June 2018 instead of 23 June 
> 2018.’ Using the inspector, I can see that the retrieved date differs from 
> the original in that the instvar ‘start’ has a Julian Day Number which is one 
> greater, but seconds as zero instead of 82800 and an offset of zero instead 
> of 1:00:00. In fact 82800 seconds is 23 hours, so all these add up to the 
> same start time, just differently represented.
>
>
>
> To get round the failure, I changed the constructor of the test collection to 
> use ‘Date today printString’, which of course meant it worked perfectly. My 
> worry is whether in some other context the change of the innards of the 
> object might have an adverse effect. I don’t understand why the Date 
> constructor represents the start of today as 23 hours after 1 a.m. yesterday. 
> Is the change something OmniBase has done in storing and retrieving, or is it 
> due to the way the Date is reconstructed?

A Date in Pharo is a 24 hour period and thus the timezone is
important, e.g. the start of 23 Jun in London is not the same as 23
Jun in Melbourne.

If you want to compare the date using day / month / year and not as a
24 hour period, try using #equals: instead of #=.

HTH,
Alistair



Re: [Pharo-users] reading from a named pipe in Pharo

2018-05-06 Thread Alistair Grant
Hi Siemen & Mariano,

On 5 May 2018 at 16:26, Mariano Martinez Peck  wrote:
> Hi Siemen,
>
> You may want to check the pipe support code in OSSubprocess [1]. Note that
> the pipes should work outside of OSSubprocess. You can read the
> documentation as well as the unit tests for the pipes.
>
> Cheers,
>
> [1] https://github.com/marianopeck/OSSubprocess

OSSPipe seems to assume that is controlling both ends of the pipe,
while it may be that Siemen just wants to read from the pipe.  Anyway,
Mariano mentioned that pipes should work outside of OSSubprocess, and
I've made some modifications to FilePlugin which should facilitate
that, so thought I'd have a go.  This still doesn't completely meet
Siemen's requirements as it polls the stream, but...  I've attached a
little demo class, tested only on Ubuntu 16.04.  Be warned, I've never
used Unix pipes before, so feel free to critique the code:


NamedPipeEcho provides sample code showing how to read from a Unix
named pipe and echo the contents to stdout.

Interesting attributes of the sample code include:

- It is just a sample, it isn't intended to be production ready.
- It marks the pipe non-blocking so that multiple pipes can be
processed without the image blocking when reading.
- It's polling, rather than event driven.
- It doesn't have any external dependencies outside the core Pharo
image and standard Pharo VM.
- It defines a method that directly calls a primitive - I consider
this bad practice and would like to make the primitive generally
available through FilePlugin.


The simplest way to run this is in one terminal (bash shell):

$ mkfifo /dev/shm/pharopipe
$ pharo --headless Pharo.image eval "(NamedPipeEcho on:
'/dev/shm/pharopipe') run"

and in a second terminal (bash shell):

$ pharo --headless Pharo.image eval "NamedPipeEcho sampleWriteTo:
'/dev/shm/pharopipe'"

You should see:

Hello World
Line 2

in the first terminal, with a 15 second delay between the lines and exit.


There's also AsyncFile, which should make it event driven instead of
polled, but I haven't had a chance to look at that yet.

This is tested with:


Pharo7.0alpha
Build information:
Pharo-7.0+alpha.build.839.sha.675decd24230e0ef7d1579af07c2112c104c6d7b
(64 Bit)


5.0-20180416  Thu Apr 12 22:34:48 UTC 2018 gcc 4.8 [Production
Spur 64-bit VM]
CoInterpreter VMMaker.oscog-eem.2361 uuid:
7ca2f89a-de70-422f-b92b-54f91ac4e47b Apr 12 2018
StackToRegisterMappingCogit VMMaker.oscog-eem.2361 uuid:
7ca2f89a-de70-422f-b92b-54f91ac4e47b Apr 12 2018
VM: 20180416 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $
Date: Thu Apr 12 15:26:17 2018 -0700 $ CommitHash: 07c6dc3 $
Plugins: 20180416 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $
Linux travis-job-b95e67e4-9fb2-4d69-a59f-1fbf859b912c
4.4.0-101-generic #124~14.04.1-Ubuntu SMP Fri Nov 10 19:05:36 UTC 2017
x86_64 x86_64 x86_64 GNU/Linux
plugin path: 
/home/alistair/pharo7/Issue21692/vm/pharo-vm/lib/pharo/5.0-20180416
[default: 
/home/alistair/pharo7/Issue21692/vm/pharo-vm/lib/pharo/5.0-20180416/]


Earlier VMs probably won't work as #atEnd will always return true or
false (I forget which).

Cheers,
Alistair


AKG-PipePlay.st
Description: Binary data


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

2018-04-13 Thread Alistair Grant
On 13 April 2018 at 11:04, Sven Van Caekenberghe  wrote:
>
>
>> On 13 Apr 2018, at 08:43, p...@highoctane.be wrote:
>>
>> I consider Pharo 7 as a great piece of kit but unusable for my current work. 
>> There are many new things to learn in there. When is too much too much? 
>> Also, simplifications are breaking things in unexpected ways (like the 
>> #atEnd thing).
>
> Phil,
>
> Nothing fundamental will break with #atEnd.
>
> What you are reading in pharo-dev is a constructive discussion that (for me 
> at least) started with the desire to support one very special kind of stream 
> (stdin in C terms), something 99.99% of Pharo users have never seen, used or 
> heard of.


Completely agree (despite one of my later messages to Sven being
overly grumpy).  I've learnt a lot from this exchange.

Cheers,
Alistair


> Zn streams have worked well and as expected for Pharo versions going back to 
> 3, that won't change.



Re: [Pharo-users] IdentityDictionary reset

2018-04-09 Thread Alistair Grant
Hi Dario,

On 9 April 2018 at 10:00, Trussardi Dario Romano
 wrote:
> Ciao,
>
> in the Pharo 4.0 image i have a IdentityDictionary with ten items.
>
> Now when i reset the dictionary the system behaves as follows:
>
> Version A)  resetAllLocks
>
> locks keysAndValuesDo:[:k :v | locks 
> removeKey: k ifAbsent: [self halt]]
>
>
> Not all items are removed fro the dictionary.
>
>
> Version B) resetAllLocks
>
> locks keys do:[:k | locks removeKey: k 
> ifAbsent: [self halt]]
>
> All the items are always removed.
>
>
> Considerations about it?

The first version modifies the collection while iterating over it -
generally a bad thing to do.

The second version creates a new collection of keys and then uses it
to remove the items - much safer.

If you set a breakpoint in the methods and step into each message send
you'll be able to see the difference.

Cheers,
Alistair



Re: [Pharo-users] Reading data from a USB HID device

2018-03-31 Thread Alistair Grant
Hi Stef,

On 30 March 2018 at 13:13, Stephane Ducasse  wrote:
> Contact Julien Delplanque he was working on it some months ago.
>
> Stef

Thanks for the suggestion, I may do that.  I have made some progress:

- The package loads in 64 bits
- I can open and take control of the heart rate monitor and then
retrieve the reportDescriptor

I haven't yet succeeded in getting actual data back yet.  Requesting
data via the control pipe results in all zeros, attempting using the
Interrupt In pipe results in an I/O Error.


Thanks again,
Alistair


> On Fri, Mar 30, 2018 at 8:08 AM, Alistair Grant  wrote:
>> Hi Everyone,
>>
>> I've got a USB connected heart rate monitor that I'd like to access from
>> Pharo.
>>
>> I found libusb-pharo at https://github.com/tamerescrl/libusb-pharo which
>> appears to do exactly what I want.
>>
>> It was updated only 5 months ago, but doesn't load in Pharo 6.1 or 7,
>> failing with package UFFI-dev not found.
>>
>> Does anyone have a better idea, or know if there is a working version
>> available?  Otherwise I'll have a go at getting it working in Pharo 7.
>>
>> Thanks!
>> Alistair
>>
>



[Pharo-users] Reading data from a USB HID device

2018-03-29 Thread Alistair Grant
Hi Everyone,

I've got a USB connected heart rate monitor that I'd like to access from
Pharo.

I found libusb-pharo at https://github.com/tamerescrl/libusb-pharo which
appears to do exactly what I want.

It was updated only 5 months ago, but doesn't load in Pharo 6.1 or 7,
failing with package UFFI-dev not found.

Does anyone have a better idea, or know if there is a working version
available?  Otherwise I'll have a go at getting it working in Pharo 7.

Thanks!
Alistair



Re: [Pharo-users] Zoom x-axis in RTGrapher?

2018-03-29 Thread Alistair Grant
Hi Alexandre,

On 29 March 2018 at 15:07, Alexandre Bergel  wrote:
> Easy.
>
> You can add a reset button:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> v := RTView new.
> b := [ :someClasses |
>g := RTGrapher new.
>g view: v.
>ds := RTData new.
>ds points: someClasses.
>ds y: [ :cls | cls numberOfMethods ].
>ds x: [ :cls | cls numberOfLinesOfCode ].
>g add: ds.
>
>g addDecorator: (RTRangeSelector new callback: [ :es |
>| classesToZoomIn |
>
>classesToZoomIn := es collect: #model.
>v cleanAll.
>b value: classesToZoomIn
>]).
>g build.
> v addMenu: 'Reset' callback: [ v cleanAll. b value: RTShape 
> withAllSubclasses ].
> ].
>
> b value: RTShape withAllSubclasses.
> v
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Thanks!  All working now...

Cheers,
Alistair



Re: [Pharo-users] Zoom x-axis in RTGrapher?

2018-03-29 Thread Alistair Grant
Hi Alexandre,

Thanks! (more below)


On 28 March 2018 at 14:56, Alexandre Bergel  wrote:
> Hi Alistair!
>
> Yes, this is something we thought about some times ago.
>
> After updating Roassal, try this:
> -=-=-=-=-=-=-=-=-=-=-=-=
> v := RTView new.
> b := [ :someClasses |
> g := RTGrapher new.
> g view: v.
> ds := RTData new.
> ds points: someClasses.
> ds y: [ :cls | cls numberOfMethods ].
> ds x: [ :cls | cls numberOfLinesOfCode ].
> g add: ds.
>
> g addDecorator: (RTRangeSelector new callback: [:es |
> | classesToZoomIn |
> classesToZoomIn := es collect: #model.
> v cleanAll.
> b value: classesToZoomIn
> ]).
> g build.
> ].
>
> b value: RTShape withAllSubclasses.
> v
> -=-=-=-=-=-=-=-=-=-=-=-=
>
> Let me know how it goes.

Great, it's working fine!

If you select an empty portion of the graph an error is raised -
"Error: No dataset has been added?".

I solved this with the following change, which simply ignores empty
areas and notifies the user:


RTRangeSelector>>callbackWithSelectedElements
| selectedElements |
selectedElements := self elementsWithinTheSelection.
selectedElements ifEmpty: [
UIManager default inform: 'Empty region selected, ignoring'.
^self ].
self evaluateCallBackWithElements: selectedElements


That was a quick hack, so there could well be a better solution.

>From what I can see, there isn't a way to zoom back out or scroll left
and right.

I might modify RTRangeSelector so that a right click zooms out.  I'll
have to think about scrolling a bit more.


Thanks again!
Alistair


> Cheers,
> Alexandre
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>> On Mar 28, 2018, at 4:02 AM, Alistair Grant  wrote:
>>
>> Hi Everyone,
>>
>> I'm using RTGrapher to display a simple line graph where the x-axis
>> has values from roughly 0 to 500,000 and the y-axis from 0 to 20.
>>
>> What I'd like to be able to do is to zoom in just the x-axis, i.e.
>> instead of displaying the entire 0 to 500,000 range, be able to narrow
>> it down in stages, to, e.g. 430,000 to 431,000.  The y-axis would be
>> unchanged, i.e. still 0 to 20.  Ideally I could then scroll left and
>> right along the x-axis.
>>
>> I can create a Spec widget with buttons to redraw the graph, but was
>> wondering if there was a better way.
>>
>> Thanks,
>> Alistair
>>
>
>



[Pharo-users] Zoom x-axis in RTGrapher?

2018-03-28 Thread Alistair Grant
Hi Everyone,

I'm using RTGrapher to display a simple line graph where the x-axis
has values from roughly 0 to 500,000 and the y-axis from 0 to 20.

What I'd like to be able to do is to zoom in just the x-axis, i.e.
instead of displaying the entire 0 to 500,000 range, be able to narrow
it down in stages, to, e.g. 430,000 to 431,000.  The y-axis would be
unchanged, i.e. still 0 to 20.  Ideally I could then scroll left and
right along the x-axis.

I can create a Spec widget with buttons to redraw the graph, but was
wondering if there was a better way.

Thanks,
Alistair



Re: [Pharo-users] [ANN] Slides for a Lecture: MetaLinks

2018-03-27 Thread Alistair Grant
Great introduction.  I'd seen MetaLinks mentioned in emails, but
basically ignored them as I didn't know what they were.

Thanks, Marcus!

Cheers,
Alistair


On 27 March 2018 at 10:17, Marcus Denker  wrote:
> Hi,
>
> I did last week a short lecture at VUB Brussels. Topic: MetaLinks.
>
> Slideshare: https://www.slideshare.net/MarcusDenker/lecture-metalinks
> PDF: http://marcusdenker.de/talks/18LectureMetaLinks/MetaLinks.pdf
>
>
> Marcus



Re: [Pharo-users] Why should we not rely on #atEnd?

2018-03-26 Thread Alistair Grant
Hi Herby,

On 26 March 2018 at 18:51, Herbert Vojčík  wrote:
> Citing from
> https://pharo.fogbugz.com/f/cases/21577/Cannot-read-from-dev-urandom,
>
>   But we still shouldn't be relying on #atEnd so ... -- Alistair Grant
>
> Why should we not rely on #atEnd? I had the impression that it is one of the
> most fundamental stream APIs, alongside next, nextPut: and reset.
>
> Herby
>

The short answer is: because the underlying libraries we rely on say not
to.

For regular files, the VM compares the current file position to the
length of the file to determine whether the stream is at the end of the
file.

This works for files where the length is known in advance, but fails for
other files, e.g. /dev/urandom, which returns a size of 0, so #atEnd
currently and incorrectly returns true.

For stdio streams the VM falls back to using the C feof() function.  The
documentation states that it should only be used to determine if the end
of file was reached after reading past the end of the file.

A longer description is at:

https://stackoverflow.com/questions/12337614/how-feof-works-in-c:

I've proposed a patch to the VM that will result in feof() being used
for non-regular files like /dev/urandom, which would mean that #atEnd
answers correctly.  But #atEnd still shouldn't be used as a test while
looping over streams.


HTH,
Alistair



Re: [Pharo-users] Unable to execute example code from "The Spec UI Framework" Book

2018-03-21 Thread Alistair Grant
On 21 March 2018 at 08:37, dragoncity  wrote:
> I had already  defined & accepted defaultSpec , as per page 6.
>
> Attached is my CustomerSatisfaction.st file :  I assume Pharo will suck it
> back in !

You've defined this as an instance method, not a class method.

If what I've said doesn't make sense, let us know and we can point you
to a description (which I don't have handy).  One tip: Assuming you're
using Pharo 6, in the System Browser, roughly in the middle is a
"Class" button.  Pressing that will show you the class methods.

HTH,
Alistair



> On 21/03/18 17:55, Alistair Grant wrote:
>>
>> On 21 March 2018 at 03:12, dragoncity  wrote:
>>>
>>> Hello, I'm just getting into Pharo, and am trying to
>>> do the example 'tutorial' UI programs in chapter 2 of The Spec UI
>>> Framework
>>> book. I have  a special interest in end user GUI interfaces for programs.
>>> I
>>> enter the first example code as written and the methods are all accepted
>>> without errors. And yes, I did generate the accessors.
>>>
>>> However , on attempting to execute the code at the bottom of page 6 from
>>> the
>>> latest Spec UI Framework book,
>>>
>>>
>>> | ui |
>>>
>>> ui := CustomerSatisfaction newopenWithSpec.
>>>
>>> ui close.
>>>
>>>
>>>
>>> this error message appears, no UI image appears of course.
>>>
>>> "SubclassResponsibility:CustomerSatisfaction class had the subclass
>>> responsibility to implement #defaultSpec"
>>>
>>> ==
>>>
>>> Not only don't I understand the message, but it implies I have to write
>>> something called #defaultSpec !, which is not mentioned in the tutorial.
>>
>> CustomerSatisfaction is a subclass of ComposableModel
>> (ComposablePresenter in Pharo 7).  If you have a look at the
>> implementation of #defaultSpec in ComposableModel or
>> ComposablePresenter (depending on which version of Pharo you are
>> using) it says that it is up to subclasses to implement the method
>> (#subclassResponsibility).  Since  you haven't defined it (yet), the
>> call to #defaultSpec uses the inherited definition from
>> ComposableModel, which raises the error you are seeing.
>>
>> CustomerSatisfaction class>>defaultSpec is on page 6 of my version of
>> the booklet, dated Feb 6, 2107.
>>
>>
>> Cheers,
>> Alistair
>>
>>
>
> --
> Cheers,
> Brett
>



Re: [Pharo-users] Unable to execute example code from "The Spec UI Framework" Book

2018-03-20 Thread Alistair Grant
On 21 March 2018 at 03:12, dragoncity  wrote:
> Hello, I'm just getting into Pharo, and am trying to
> do the example 'tutorial' UI programs in chapter 2 of The Spec UI Framework
> book. I have  a special interest in end user GUI interfaces for programs. I
> enter the first example code as written and the methods are all accepted
> without errors. And yes, I did generate the accessors.
>
> However , on attempting to execute the code at the bottom of page 6 from the
> latest Spec UI Framework book,
>
>
> | ui |
>
> ui := CustomerSatisfaction newopenWithSpec.
>
> ui close.
>
>
>
> this error message appears, no UI image appears of course.
>
> "SubclassResponsibility:CustomerSatisfaction class had the subclass
> responsibility to implement #defaultSpec"
>
> ==
>
> Not only don't I understand the message, but it implies I have to write
> something called #defaultSpec !, which is not mentioned in the tutorial.

CustomerSatisfaction is a subclass of ComposableModel
(ComposablePresenter in Pharo 7).  If you have a look at the
implementation of #defaultSpec in ComposableModel or
ComposablePresenter (depending on which version of Pharo you are
using) it says that it is up to subclasses to implement the method
(#subclassResponsibility).  Since  you haven't defined it (yet), the
call to #defaultSpec uses the inherited definition from
ComposableModel, which raises the error you are seeing.

CustomerSatisfaction class>>defaultSpec is on page 6 of my version of
the booklet, dated Feb 6, 2107.


Cheers,
Alistair



Re: [Pharo-users] Issues with recent Pharos reading files

2018-03-20 Thread Alistair Grant
Hi Andrew,

On 20 March 2018 at 21:42, Andrew P. Black  wrote:
>
>> On 21 Mar 2018, at 03:15 , Sven Van Caekenberghe  wrote:
>>
>>
>>
>>> On 20 Mar 2018, at 14:36, Andrew P. Black  wrote:
>>>
>>> I’m having trouble  reading files with the most recent “stable” versions of 
>>> Pharo.
>>
>> OK, this is no answer to your issue, but Pharo 7 latest is far from stable, 
>> it is intentionally the development head.
>>
>> It is very good that you test it and help out, more eyes and all that, but 
>> using it is at your own risk, there are no promises about stability.
>
> I understand this.  The point of my post was to try and diagnose the issue 
> and help make Pharo 7 more stable.
>
> Does my diagnosis of a missing or outdated primitive look reasonable?

Not really :-)



>  If so, how do I check?

If you can successfully open World Menu -> Tools -> File Browser then
the primitive is working.


>  That is, where are is this primitive
>
>  errorCode >
>
> supposed to come from?I’m guessing that there should be a file with 
> ‘FilePlugin’ somewhere in its name somewhere in one of my VMs.  There isn’t — 
> although some older Cog vms from back in the day (I’m talking Pharo 1.4) have 
> something called
> ‘libAsynchFilePlugin.dylib’

Plugins can either be built-in or external.  FilePlugin is built-in.


> If this plugin is now essential to run Pharo, shouldn’t downloading the 
> launcher and using the launcher to grab a fresh image and launch it (after 
> checking for the appropriate VM) be all that is required to ensure that it is 
> installed?   If not, what other steps should I take?

The error handling in #lookupEntryIn:index: is less than ideal.  I'm
working on a replacement, so I don't think it is worthwhile spending a
lot of time on it.

This primitive returns a directory entry by index number.  Just taking
a couple of wild guesses:  One possibility is that the directory was
modified while you were iterating over the directory.  I'm also not
sure how it handles entries that you don't have permission to read.

But to help track down your issue, maybe temporarily replace the code with:


errorCode ifNotNil: [self halt: errorCode asString].
^ #badDirectoryPath


That should allow you to track down the issue a bit more.

P.S. If the primitive really is missing, errorCode will be #'not found'.


> I’m getting on a l-o-n-g flight in a few hours, and would really like to be 
> able to run Pharo ...
>
> Andrew

HTH,
Alistair



Re: [Pharo-users] How do I ask the FileSystem to resolve a relative path?

2018-03-12 Thread Alistair Grant
Hi Sven,

On 12 March 2018 at 19:38, Sven Van Caekenberghe  wrote:
> Hi Alistair,
>
>> On 12 Mar 2018, at 19:06, Alistair Grant  wrote:
>>
>> On 12 March 2018 at 10:03, Guillermo Polito  
>> wrote:
>>>
>>> Hi,
>>>
>>> do not forget also that there is an entire chapter on FileSystem in here:
>>>
>>> http://files.pharo.org/books-pdfs/deep-into-pharo/2013-DeepIntoPharo-EN.pdf
>>>
>>> And I particularly recommend everybody dealing with files to read about how 
>>> to manage encodings in here:
>>>
>>> http://files.pharo.org/books-pdfs/entreprise-pharo/2016-10-06-EnterprisePharo.pdf
>>
>>
>> Cool!  I wasn't aware of the section on character encoding, it's
>> probably the best introduction to character encoding I've read.
>
> Thanks.
>
>> There is one important mistake in the examples.  On page 46 it gives
>> the following code:
>>
>> 'encoding-test.txt' asFileReference writeStreamDo: [ :out |
>>(ZnCharacterWriteStream on: out binary encoding: #utf8)
>>nextPutAll: 'Hello'; space; nextPutAll: 'Ελλάδα'; crlf;
>> nextPutAll: 'Les élèves français'; crlf ].
>>
>>
>> This won't work reliably as #writeStreamDo: (and #readStreamDo:) use
>> MultiByteFileStreams, which are not binary by default.
>
> It does work, you missed the #binary message sent to out.

You're right, of course.  My apologies (I did miss the #binary).

Cheers,
Alistair


>> It really should be (in Pharo 7, I haven't checked pharo 6)
>> #binaryWriteStreamDo: and #binaryReadStreamDo:, i.e.:
>>
>> 'encoding-test.txt' asFileReference binaryWriteStreamDo: [ :out |
>>(ZnCharacterWriteStream on: out binary encoding: #utf8)
>>nextPutAll: 'Hello'; space; nextPutAll: 'Ελλάδα'; crlf;
>> nextPutAll: 'Les élèves français'; crlf ].
>
> This is indeed better (but I am not sure #binaryWriteStreamDo: was available 
> in the past). In this case, the #binary message sent to out should be dropped.
>
> Sven
>
>> Cheers,
>> Alistair
>>
>> (I know I should submit a PR for this, but I'm suffering a personal
>> interrupt stack overflow at the moment)



Re: [Pharo-users] How do I ask the FileSystem to resolve a relative path?

2018-03-12 Thread Alistair Grant
On 12 March 2018 at 10:03, Guillermo Polito  wrote:
>
> Hi,
>
> do not forget also that there is an entire chapter on FileSystem in here:
>
> http://files.pharo.org/books-pdfs/deep-into-pharo/2013-DeepIntoPharo-EN.pdf
>
> And I particularly recommend everybody dealing with files to read about how 
> to manage encodings in here:
>
> http://files.pharo.org/books-pdfs/entreprise-pharo/2016-10-06-EnterprisePharo.pdf


Cool!  I wasn't aware of the section on character encoding, it's
probably the best introduction to character encoding I've read.

There is one important mistake in the examples.  On page 46 it gives
the following code:

'encoding-test.txt' asFileReference writeStreamDo: [ :out |
(ZnCharacterWriteStream on: out binary encoding: #utf8)
nextPutAll: 'Hello'; space; nextPutAll: 'Ελλάδα'; crlf;
nextPutAll: 'Les élèves français'; crlf ].


This won't work reliably as #writeStreamDo: (and #readStreamDo:) use
MultiByteFileStreams, which are not binary by default.

It really should be (in Pharo 7, I haven't checked pharo 6)
#binaryWriteStreamDo: and #binaryReadStreamDo:, i.e.:

'encoding-test.txt' asFileReference binaryWriteStreamDo: [ :out |
(ZnCharacterWriteStream on: out binary encoding: #utf8)
nextPutAll: 'Hello'; space; nextPutAll: 'Ελλάδα'; crlf;
nextPutAll: 'Les élèves français'; crlf ].


Cheers,
Alistair

(I know I should submit a PR for this, but I'm suffering a personal
interrupt stack overflow at the moment)



Re: [Pharo-users] feenk log

2018-03-12 Thread Alistair Grant
On 11 March 2018 at 21:01, Tudor Girba  wrote:
> Hi,
>
> Here is an update of the work on Bloc, Brick and GT. As always, please do let 
> us know what you think.
>
> [snip/]
>
> - Andrei put together a beautiful description of a scenario in which an 
> application is molded interactively in the Playground & Inspector. The 
> subject is face recognition, and the resulting code is both functional and 
> explainable. This is intended as a tutorial material that shows what moldable 
> development means and how it changes the way we program:
> https://twitter.com/feenkcom/status/972907051448979458

The GToolkit has certainly influenced how I program - and this is a
great article that lays it out quite clearly.  If I'm developing a new
application the first few iterations of the UI are pretty much always
extensions to the inspector.

I also enjoyed Tudor's interview on No Fluff Just Stuff which
discusses a real world use of this:

- Podcast audio:
https://player.fm/series/no-fluff-just-stuff/changing-the-way-we-code-w-tudor-girba
- No Fluff Just Stuff: https://nofluffjuststuff.com/home/main

Thanks!
Alistair



Re: [Pharo-users] How do I ask the FileSystem to resolve a relative path?

2018-03-11 Thread Alistair Grant
Hi Hannes,

On 11 March 2018 at 17:49, H. Hirzel  wrote:
> The first solution given by Sven works fine.
>
> dir := FileSystem workingDirectory / '..' / 'public'.
> dir ensureCreateDirectory.
> (dir / 'myFile.txt') writeStreamDo: [ :out | out << 'Hello World!' ].
>
>
> The second version
>
> obj := (FileSystem workingDirectory / '..' / 'public' / 'testing'
> / 'test2.txt') ensureCreateFile.
> obj writeStream
>
> gives a #streamError in the class FileHandle. This is for Pharo 6.1

I don't get any error in 6.1 or 7.0.

Maybe supply a call stack?

In case you aren't familiar with this, the debugger has a little
hamburger menu button to the right of "Through" which has "Copy Stack
to Clipboard".

Cheers,
Alistair



Re: [Pharo-users] Bootstrap how to

2018-03-08 Thread Alistair Grant
Hi Hilaire,

Moving this to pharo-dev...


On Thu, Mar 08, 2018 at 11:34:55AM +0100, Hilaire wrote:
> I give again a try to bootstrap (after my last summer fail). Here how far I
> went:
>
> Do people really like git or pretend to because
> everyone is using it.

Maybe there's a better source management system out there, but for me
git is much better than any of the alternatives I've used (rcs, svn, vcs
and a couple I've forgotten (cms?)).


> 1. Fetched the repo https://github.com/pharo-project/pharo. I have to fetch
> a fresh one as updating my repo failed with the git command
> pull/fetch/merge/reset hard does not work. Incredible how simple thinks does
> not work simply with git.

I consider myself far from a git expert, so take the following with a
grain of salt...

You haven't given much detail, but when you have a clone think of the
branches that are upstream as being "read only" (typically master and
development).  They should only ever be modified by merging in the
branch from upstream.  If you're writing (committing) to your clone, it
should always be in a separate branch.

When updating, e.g. master, from upstream, get in to the habit of
enforcing fast-foward only e.g.:

git checkout master
git fetch --prune upstream
git merge --ff-only upstream/master
git push

It's more steps, but will ensure you don't get in to the problem you
describe above.  git pull will do a merge if necessary, making future
updates hard / impossible.



> 2. Followed instructions to build a bootstrap.
>
> BUILD_NUMBER=42 BOOTSTRAP_ARCH=32 sh ./bootstrap/scripts/bootstrap.sh

The script I've been using is:


#!/bin/bash

export JOB=bootstrap
export BOOTSTRAP_ARCH=32
export PHARO_VERSION=60
export BUILD_NUMBER=$(date "+%m%d")
./bootstrap/scripts/bootstrap.sh


It would be good to have a readme in the bootstrap directory that
provides basic instructions on what the key variables are and how to run
the bootstrap.


> The resulting image bootstrap-cache/bootstrap.image is built after 1 or 2
> hours. Its size is 3,4MB, when started there is only blank screen, I guess
> it is the expected outcome.

My 4 year old Dell XPS-13 (i7) takes about 30-40 minutes to do the build.



> 3. Followed instructions to load pharo environment:
>
> ??BUILD_NUMBER=42 BOOTSTRAP_ARCH=32 ./bootstrap/scripts/build.sh

This is called by bootstrap.sh, so it shouldn't be necessary for you to
call it directly.


> Several attempts were needed and the build.sh script is fragile and fail
> when at the repeated attempts, some cleaning were needed.
>
> I suggest two things :
>
> 1. you add -p to your mkdir commands (in build.sh and get-vm.sh
>scripts) as it make your script less fragile !
> 2. Also checking for the existence of the Pharo.source will avoid to
>have duplicted uncessary downloaded source file version.
>(Pharo.source1, Pharo.source2):
>
>if test ! -e PharoV60.sources
>  then
>  wget http://files.pharo.org/sources/PharoV60.sources
>fi
>
> Now the image is building, will see next.

I agree that it would be nice if it was possible to avoid downloading
the files each time, and also possible separate the process in to a
number of stages, and restart from a nominated stage.

Maybe the stages could be:

1. Download all requirements (stable vm (6.0), target vm (7.0),
bootstrapImage.zip and anything else I've forgotten).
2. The build steps in bootstrap.sh.
3. The build steps in build.sh

There could be a "clean" option that would be called as part of the CI
process to ensure that everything is always up to date.

Esteban and co.:  How open are you to refactoring the scripts to
support this?  Or is there something I don't understand that means it
doesn't make sense?


Cheers,
Alistair



Re: [Pharo-users] Web scrapping with Pharo Chrome

2018-02-16 Thread Alistair Grant
Hi Offray,

On 16 February 2018 at 19:08, Offray Vladimir Luna Cárdenas
 wrote:
> Hi Alistair,
>
>
> On 15/02/18 12:50, Alistair Grant wrote:
>> Hi Offray,
>>
>> On 14 February 2018 at 20:29, Offray Vladimir Luna Cárdenas
>>  wrote:
>>> Yes. Me too. Alistair, any starting points with this example? I will take
>>> from there and we could get visibility in the upcoming Open Data Day.
>> I'm not sure that I understand what you're after, but maybe the
>> following will help.
>>
>> This simply returns a collection of all the h4 headings that are in cells:
>>
>>
>> | rootNode divs cells cellTitleNodes cellTitles |
>>
>> rootNode := GoogleChrome get: 'http://mutabit.com/grafoscopio/index.en.html'.
>> divs := rootNode findAllTags: 'div'.
>> cells := divs select: [ :each | (' ' split: (each attributeAt:
>> 'class')) includes: 'mdl-cell' ].
>> cellTitleNodes := cells flatCollect: [ :each | each findAllTags: 'h4' ].
>> cellTitles := cellTitleNodes collect: [ :each | (each findAllStrings:
>> true) first nodeValue ].
>> { rootNode. divs. cells. cellTitleNodes. cellTitles }
>>
>
> Thanks. This was the starting point I was looking for.

Great.  The other place to look is at any examples you can find using
Soup (which can be loaded from the Catalog).  The API for Pharo-Chrome
is a subset of that provided by Soup.


>>> Of course, we're going to document everything and share back (I have already
>>> proposed some improvements in documentation via PR on the Git repo).
>> Thanks very much for improving the readme.  I've merged the PR.
>
> No problem. Thanks to you for starting the project.

Actually we need to thank Torsten: https://github.com/astares/Pharo-Chrome

Cheers,
Alistair



> Cheers,
>
> Offray
>



Re: [Pharo-users] Web scrapping with Pharo Chrome

2018-02-15 Thread Alistair Grant
Hi Offray,

On 14 February 2018 at 20:29, Offray Vladimir Luna Cárdenas
 wrote:
> Yes. Me too. Alistair, any starting points with this example? I will take
> from there and we could get visibility in the upcoming Open Data Day.

I'm not sure that I understand what you're after, but maybe the
following will help.

This simply returns a collection of all the h4 headings that are in cells:


| rootNode divs cells cellTitleNodes cellTitles |

rootNode := GoogleChrome get: 'http://mutabit.com/grafoscopio/index.en.html'.
divs := rootNode findAllTags: 'div'.
cells := divs select: [ :each | (' ' split: (each attributeAt:
'class')) includes: 'mdl-cell' ].
cellTitleNodes := cells flatCollect: [ :each | each findAllTags: 'h4' ].
cellTitles := cellTitleNodes collect: [ :each | (each findAllStrings:
true) first nodeValue ].
{ rootNode. divs. cells. cellTitleNodes. cellTitles }




> Of course, we're going to document everything and share back (I have already
> proposed some improvements in documentation via PR on the Git repo).

Thanks very much for improving the readme.  I've merged the PR.

Cheers,
Alistair


> Cheers,
>
> Offray
>
>
> On 14/02/18 14:13, Stephane Ducasse wrote:
>
> I would love to have a little how to and that we can turn it into a
> document.
>
> Stef
>
> On Wed, Feb 14, 2018 at 5:25 PM, Offray Vladimir Luna Cárdenas
>  wrote:
>>
>> Hi,
>>
>> I have been finally able to install and use properly Pharo Chrome. The
>> issues I reported in other thread, were caused by conflicts between
>> OSProcess and OSSubProcess on Linux. Now I'm able to launch Chrome, point it
>> to particular addresses and get some info from there.
>>
>> I would like to continue the conversation related with web scraping using
>> Pharo Chrome, which comes handy now that there is a lot of React and other
>> technologies making the web more and more opaque for digital citizenship and
>> data activism endeavors. So, as an starting example, I would like to scrap
>> the Grafoscopio's own page [1]. It makes use of Material Design Light [2].
>>
>> [1] http://mutabit.com/grafoscopio/index.en.html
>> [2] http://getmdl.io/
>>
>> An starting example would be fine to kickstart myself (from the ones I'm
>> reading, there is still something I don't get). Let's say I want to get all
>> cards in [1] , as shown in the screenshot below. I know the div class of
>> each one, and the div class where they are located. Which could be a minimal
>> example of a scraper, to start with?
>>
>> Thanks,
>>
>> Offray
>>
>>
>
>



Re: [Pharo-users] Generate equality

2018-02-08 Thread Alistair Grant
Hi Herby,

On 8 February 2018 at 03:10, Herbert Vojčík  wrote:
> 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.

The refactoring browser is already capable of generating #= and #hash:


| r |

r := RBGenerateEqualHashRefactoring
className: MyClass
variables: #(vars which should be used in equal and hash).
r execute


HTH,
Alistair



Re: [Pharo-users] is OSSubProcess working in Pharo 6.1?

2018-02-01 Thread Alistair Grant
Hi Guille,

On 1 February 2018 at 10:49, Guillermo Polito  wrote:
> Yeh, but loading master will load always a different version. But to have a
> reproducible build, we would like to load always the same version v0.2.5.


If you want a completely reproducible build, you can always specify
the commit id (if there isn't a tag), e.g.:


Metacello new
configuration: 'OSSubprocess';
repository: 'github://marianopeck/OSSubprocess:4c4e76d0/repository';
load.


(I'm not recommending this particular commit, I chose it at random
just to see if it loads, not if it works).

Cheers,
Alistair



> On Tue, Jan 30, 2018 at 11:47 PM, Alistair Grant 
> wrote:
>>
>> Hi Stef,
>>
>> On 30 January 2018 at 23:13, Stephane Ducasse 
>> wrote:
>> > Hi
>> >
>> > in pillar 70 we have
>> > baseline: spec
>> > 
>> > spec
>> > for: #common
>> > do: [ spec blessing: #baseline.
>> > spec repository: 'http://smalltalkhub.com/mc/Pier/Pillar/main/'.
>> > spec
>> > baseline: 'OSSubprocess'
>> > with: [ spec
>> > repository: 'github://marianopeck/OSSubprocess:v0.2.5/repository' ];
>> > baseline: 'Mustache'
>> > with: [ spec
>> > repository: 'github://noha/mustache:v1.0/repository' ];
>> > project: 'Cocoon'
>> >
>> > but travis reports this:
>> >
>> >
>> > Fetched -> OSSubprocess-cypress.1 ---
>> > github://marianopeck/OSSubprocess:v0.2.5/repository [1d56f81:v0.2.5]
>> > --- github://marianopeck/OSSubprocess:v0.2.5/repository
>> > Fetched -> OSSubprocess-Tests-cypress.1 ---
>> > github://marianopeck/OSSubprocess:v0.2.5/repository [1d56f81:v0.2.5]
>> > --- github://marianopeck/OSSubprocess:v0.2.5/repository
>> > ...RETRY
>> > ...RETRYMessageNotUnderstood: receiver of "withSqueakLineEndings" is nil
>> > UndefinedObject(Object)>>doesNotUnderstand: #withSqueakLineEndings
>> > MCFileTreeStCypressReader>>addClassAndMethodDefinitionsFromEntry:
>> >
>> > and I do not get why?
>> >
>> > Stef
>> >
>>
>> I use the following to load OSSubProcess in Pharo 7.0 32 bit:
>>
>> Metacello new
>> configuration: 'OSSubprocess';
>> repository: 'github://marianopeck/OSSubprocess:master/repository';
>> version: #stable;
>> load.
>>
>>
>> i.e. just replace the "v0.2.5" with "master".
>>
>> HTH,
>> Alistair
>>
>
>
>
> --
>
>
>
> Guille Polito
>
> Research Engineer
>
> Centre de Recherche en Informatique, Signal et Automatique de Lille
>
> CRIStAL - UMR 9189
>
> French National Center for Scientific Research - http://www.cnrs.fr
>
>
> Web: http://guillep.github.io
>
> Phone: +33 06 52 70 66 13



Re: [Pharo-users] is OSSubProcess working in Pharo 6.1?

2018-01-30 Thread Alistair Grant
Hi Stef,

On 30 January 2018 at 23:13, Stephane Ducasse  wrote:
> Hi
>
> in pillar 70 we have
> baseline: spec
> 
> spec
> for: #common
> do: [ spec blessing: #baseline.
> spec repository: 'http://smalltalkhub.com/mc/Pier/Pillar/main/'.
> spec
> baseline: 'OSSubprocess'
> with: [ spec
> repository: 'github://marianopeck/OSSubprocess:v0.2.5/repository' ];
> baseline: 'Mustache'
> with: [ spec
> repository: 'github://noha/mustache:v1.0/repository' ];
> project: 'Cocoon'
>
> but travis reports this:
>
>
> Fetched -> OSSubprocess-cypress.1 ---
> github://marianopeck/OSSubprocess:v0.2.5/repository [1d56f81:v0.2.5]
> --- github://marianopeck/OSSubprocess:v0.2.5/repository
> Fetched -> OSSubprocess-Tests-cypress.1 ---
> github://marianopeck/OSSubprocess:v0.2.5/repository [1d56f81:v0.2.5]
> --- github://marianopeck/OSSubprocess:v0.2.5/repository
> ...RETRY
> ...RETRYMessageNotUnderstood: receiver of "withSqueakLineEndings" is nil
> UndefinedObject(Object)>>doesNotUnderstand: #withSqueakLineEndings
> MCFileTreeStCypressReader>>addClassAndMethodDefinitionsFromEntry:
>
> and I do not get why?
>
> Stef
>

I use the following to load OSSubProcess in Pharo 7.0 32 bit:

Metacello new
configuration: 'OSSubprocess';
repository: 'github://marianopeck/OSSubprocess:master/repository';
version: #stable;
load.


i.e. just replace the "v0.2.5" with "master".

HTH,
Alistair



Re: [Pharo-users] Pharo 7 image cannot write changes message on startup

2018-01-21 Thread Alistair Grant
On 21 January 2018 at 15:14, Sanjay Minni  wrote:
> The message "... cannot write changes ... check that you have write
> permissions ..." is still there but I I install packages I can see .changes
> file increasing in size

Right.  This isn't a fix, it just opens the files after the initial
attempt fails.

Cheers,
Alistair



> regards
> Sanjay
>
>
> Alistair Grant wrote
>> Hi Sanjay,
>>
>> On 21 January 2018 at 12:10, Sanjay Minni <
>
>> sm@
>
>> > wrote:
>>> Hullo
>>>
>>> Can someone help with fixing this issue,
>>> I am unable to use Pharo 7 image on windows 10 till this is done
>>
>> I'm not regularly using Windows, but a workaround is to create a
>> startup file with:
>>
>> SourceFiles close; ensureOpen
>>
>> in it.
>>
>> Cheers,
>> Alistair
>
>
>
>
>
> -
> ---
> Regards, Sanjay
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>



Re: [Pharo-users] Pharo 7 image cannot write changes message on startup

2018-01-21 Thread Alistair Grant
Hi Sanjay,

On 21 January 2018 at 12:10, Sanjay Minni  wrote:
> Hullo
>
> Can someone help with fixing this issue,
> I am unable to use Pharo 7 image on windows 10 till this is done

I'm not regularly using Windows, but a workaround is to create a
startup file with:

SourceFiles close; ensureOpen

in it.

Cheers,
Alistair



Re: [Pharo-users] Working directory

2018-01-18 Thread Alistair Grant
Hi Stef,

On 18 January 2018 at 18:43, Stephane Ducasse  wrote:
> Tx alistair
>
> this is great that we made progress on this point.
> May be we should update the fileSystem chapter

Yep.  Can you point me to the source?  I will try and take a look.

I also think I'll add #workingDirectory: (be able to set the working
directory).  I know Rajula did the work, but it didn't make it in to
the PR for some reason.  Hopefully I can dig it up.

Cheers,
Alistair




> On Thu, Jan 18, 2018 at 9:51 AM, Alistair Grant  wrote:
>> Hi Hilaire & Denis,
>>
>> On 18 January 2018 at 09:38, Denis Kudriashov  wrote:
>>> Also notice that OS can give program very surprising working directory when
>>> you run it using UI tools.
>>> For example in MacOS drag image to the vm using Finder assigns root (/) as
>>> working directory.
>>>
>>>
>>> 2017-12-15 21:38 GMT+01:00 Hilaire :
>>>>
>>>> Oh, in a build for a DrGeo app based on P7, the working directory is one
>>>> level highter to the image folder.
>>>>
>>>> So in P7, there are two different results for the working directory: the
>>>> user home directory, and one level hight to image dir.
>>>>
>>>> What's the context? Where to look at?
>>
>> For Pharo 7:
>>
>> The working directory is C getcwd().  The differences you are seeing
>> will be the result of how Pharo is launched.  If you run it from the
>> command line, it will be the current directory of the shell.  I don't
>> use MacOS, but it sounds like dragging a file to an executable always
>> uses the root directory as cwd.
>>
>> The working directory is cached in DiskStore DefaultWorkingDirectory.
>> It's set at session startup to DiskStore
>> class>>defaultWorkingDirectory, which ultimately calls getcwd().
>>
>> HTH,
>> Alistair
>>
>



Re: [Pharo-users] [Pharo-dev] [ANN] Pharo TechTalk Dates

2018-01-18 Thread Alistair Grant
Hi Marcus,

Suggested topic:  Contributing to Pharo7.  :-)

Thanks!
Alistair


On 18 January 2018 at 14:52, Marcus Denker  wrote:
> Hi,
>
> Here are the next dates for the Pharo Techtalks.
> (for recording of the past ones, see: http://pharo.org/TechTalk )
>
>
> Jan 30: Pharo TechTalk: Genetic Algorithms
> https://association.pharo.org/event-2757884
>
> For the others we have no topic yet, but dates are pre-fixed to:
>
> Feb 15
> https://association.pharo.org/event-2797065
>
> March 22
> https://association.pharo.org/event-2797067
>
> April 12
> https://association.pharo.org/event-2797068
>
> May 17
> https://association.pharo.org/event-2797069
>
> June 14
> https://association.pharo.org/event-2797070
>
>
> - If you have ideas for topics, please tell us!
> - With no topic, we will use this slot for a general free discussion.
> - If you want to do a TechTalk about a topic but no date is good, we can
>   change the date!
>
> Marcus
>



  1   2   3   4   >