pharo-users@lists.pharo.org

Any question about pharo is welcome

View all threads

Problem with Dictionary and Associations

P
peter@pbkresearch.co.uk
Thu, Feb 11, 2021 7:58 PM

David

Glad to have helped, but it was really Sven who diagnosed why the file was messed up.

Peter

From: David Pennington david@totallyobjects.com
Sent: 11 February 2021 19:38
To: Any question about pharo is welcome pharo-users@lists.pharo.org
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Hi there Peter

I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work.

I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy.

I have yet to look at deleting the old file before writing but I am sure that this will make it superb.

Many thanks for your help in this.

David

TotallyObjects

http://www.totallyobjects.com

Your suggestion worked perfectly - I truncate the file and it parses

On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk > <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk > wrote:

David
I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil.

I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:,  and see what exactly it does with the junk in your .dat file.

HTH

Peter Kenny

-----Original Message-----
From: David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com >
Sent: 11 February 2021 16:46
To: Any question about pharo is welcome <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org >
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key.

If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=)

David

On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu > wrote:

I can parse the file data you provided:

STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}'

"a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )"

(BTW, this is STON not JSON).

What I do see in the input is junk after the last }

That can happen when you overwrite an existing file with shorter content. You should truncate such a file.

From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work.

On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com > wrote:

I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand.

<stack.rtf><20210225 01><screenshot.png>

On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu > wrote:

Hi David,

On 10 Feb 2021, at 19:18, David@totallyobjects.com mailto:David@totallyobjects.com  wrote:

I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents.

Fistly, any ideas why this has changed and secondly, any ideas how to fix it?

David
Totally Objects

Sent from my Huawei tablet

I am afraid I need more information.

Could you create a reproducible case ?
Do you have a stack trace ?

In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand).

Sven

David Glad to have helped, but it was really Sven who diagnosed why the file was messed up. Peter From: David Pennington <david@totallyobjects.com> Sent: 11 February 2021 19:38 To: Any question about pharo is welcome <pharo-users@lists.pharo.org> Subject: [Pharo-users] Re: Problem with Dictionary and Associations Hi there Peter I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work. I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy. I have yet to look at deleting the old file before writing but I am sure that this will make it superb. Many thanks for your help in this. David TotallyObjects http://www.totallyobjects.com Your suggestion worked perfectly - I truncate the file and it parses On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk> > <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk> > wrote: David I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil. I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:, and see what exactly it does with the junk in your .dat file. HTH Peter Kenny -----Original Message----- From: David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com> > Sent: 11 February 2021 16:46 To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org> > Subject: [Pharo-users] Re: Problem with Dictionary and Associations Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key. If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=) David On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu> > wrote: I can parse the file data you provided: STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}' "a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )" (BTW, this is STON not JSON). What I do see in the input is junk after the last } That can happen when you overwrite an existing file with shorter content. You should truncate such a file. From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work. On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com> > wrote: I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand. <stack.rtf><20210225 01><screenshot.png> On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu> > wrote: Hi David, On 10 Feb 2021, at 19:18, David@totallyobjects.com <mailto:David@totallyobjects.com> wrote: I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents. Fistly, any ideas why this has changed and secondly, any ideas how to fix it? David Totally Objects Sent from my Huawei tablet I am afraid I need more information. Could you create a reproducible case ? Do you have a stack trace ? In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand). Sven
SD
Stéphane Ducasse
Sat, Feb 13, 2021 11:09 AM

Hi david

Two points:
- I would love to have a little success story about your application
= one paragraph what is does + one paragraph how technology is cool :)

- if you need we have a native VM for M1 (the stackVM).

S.

On 11 Feb 2021, at 20:38, David Pennington david@totallyobjects.com wrote:

Hi there Peter

I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work.

I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy.

I have yet to look at deleting the old file before writing but I am sure that this will make it superb.

Many thanks for your help in this.

David
TotallyObjects
http://www.totallyobjects http://www.totallyobjects/.com

Your suggestion worked perfectly - I truncate the file and it parses

On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> wrote:

David
I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil.

I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:,  and see what exactly it does with the junk in your .dat file.

HTH

Peter Kenny

-----Original Message-----
From: David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com>
Sent: 11 February 2021 16:46
To: Any question about pharo is welcome <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org>
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key.

If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=)

David

On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

I can parse the file data you provided:

STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}'

"a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )"

(BTW, this is STON not JSON).

What I do see in the input is junk after the last }

That can happen when you overwrite an existing file with shorter content. You should truncate such a file.

From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work.

On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand.

<stack.rtf><20210225 01><screenshot.png>

On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

Hi David,

On 10 Feb 2021, at 19:18, David@totallyobjects.com mailto:David@totallyobjects.com wrote:

I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents.

Fistly, any ideas why this has changed and secondly, any ideas how to fix it?

David
Totally Objects

Sent from my Huawei tablet

I am afraid I need more information.

Could you create a reproducible case ?
Do you have a stack trace ?

In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand).

Sven


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

Hi david Two points: - I would love to have a little success story about your application = one paragraph what is does + one paragraph how technology is cool :) - if you need we have a native VM for M1 (the stackVM). S. > On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com> wrote: > > Hi there Peter > > I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work. > > I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy. > > I have yet to look at deleting the old file before writing but I am sure that this will make it superb. > > Many thanks for your help in this. > > David > TotallyObjects > http://www.totallyobjects <http://www.totallyobjects/>.com > > Your suggestion worked perfectly - I truncate the file and it parses > >> On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> wrote: >> >> David >> I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil. >> >> I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:, and see what exactly it does with the junk in your .dat file. >> >> HTH >> >> Peter Kenny >> >> >> -----Original Message----- >> From: David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> >> Sent: 11 February 2021 16:46 >> To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> >> Subject: [Pharo-users] Re: Problem with Dictionary and Associations >> >> Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key. >> >> If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=) >> >> David >> >>> On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>> >>> I can parse the file data you provided: >>> >>> STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}' >>> >>> "a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )" >>> >>> (BTW, this is STON not JSON). >>> >>> What I do see in the input is junk after the last } >>> >>> That can happen when you overwrite an existing file with shorter content. You should truncate such a file. >>> >>> From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work. >>> >>>> On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>> >>>> I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand. >>>> >>>> <stack.rtf><20210225 01><screenshot.png> >>>> >>>>> On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>> >>>>> Hi David, >>>>> >>>>>> On 10 Feb 2021, at 19:18, David@totallyobjects.com <mailto:David@totallyobjects.com> wrote: >>>>>> >>>>>> I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents. >>>>>> >>>>>> Fistly, any ideas why this has changed and secondly, any ideas how to fix it? >>>>>> >>>>>> David >>>>>> Totally Objects >>>>>> >>>>>> Sent from my Huawei tablet >>>>> >>>>> I am afraid I need more information. >>>>> >>>>> Could you create a reproducible case ? >>>>> Do you have a stack trace ? >>>>> >>>>> In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand). >>>>> >>>>> Sven >>>> > -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
DP
David Pennington
Sat, Feb 13, 2021 12:40 PM

OK, here goes.

My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use.

TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac.

Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format)  that recur monthly so that a monthly budget can be managed.  It is written in Pharo 8.0.

I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space.

David Pennington
Totally Objects
(Http://www.totallyobjects.com http://www.totallyobjects.com/)

On 13 Feb 2021, at 11:09, Stéphane Ducasse stephane.ducasse@inria.fr wrote:

Hi david

Two points:
- I would love to have a little success story about your application
= one paragraph what is does + one paragraph how technology is cool :)

- if you need we have a native VM for M1 (the stackVM).

S.

On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

Hi there Peter

I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work.

I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy.

I have yet to look at deleting the old file before writing but I am sure that this will make it superb.

Many thanks for your help in this.

David
TotallyObjects
http://www.totallyobjects http://www.totallyobjects/.com

Your suggestion worked perfectly - I truncate the file and it parses

On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> wrote:

David
I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil.

I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:,  and see what exactly it does with the junk in your .dat file.

HTH

Peter Kenny

-----Original Message-----
From: David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com>
Sent: 11 February 2021 16:46
To: Any question about pharo is welcome <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org>
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key.

If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=)

David

On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

I can parse the file data you provided:

STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}'

"a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )"

(BTW, this is STON not JSON).

What I do see in the input is junk after the last }

That can happen when you overwrite an existing file with shorter content. You should truncate such a file.

From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work.

On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand.

<stack.rtf><20210225 01><screenshot.png>

On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

Hi David,

On 10 Feb 2021, at 19:18, David@totallyobjects.com mailto:David@totallyobjects.com wrote:

I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents.

Fistly, any ideas why this has changed and secondly, any ideas how to fix it?

David
Totally Objects

Sent from my Huawei tablet

I am afraid I need more information.

Could you create a reproducible case ?
Do you have a stack trace ?

In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand).

Sven


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

OK, here goes. My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use. TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac. Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format) that recur monthly so that a monthly budget can be managed. It is written in Pharo 8.0. I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space. David Pennington Totally Objects (Http://www.totallyobjects.com <http://www.totallyobjects.com/>) > On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: > > Hi david > > Two points: > - I would love to have a little success story about your application > = one paragraph what is does + one paragraph how technology is cool :) > > - if you need we have a native VM for M1 (the stackVM). > > S. > >> On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >> >> Hi there Peter >> >> I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work. >> >> I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy. >> >> I have yet to look at deleting the old file before writing but I am sure that this will make it superb. >> >> Many thanks for your help in this. >> >> David >> TotallyObjects >> http://www.totallyobjects <http://www.totallyobjects/>.com >> >> Your suggestion worked perfectly - I truncate the file and it parses >> >>> On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> wrote: >>> >>> David >>> I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil. >>> >>> I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:, and see what exactly it does with the junk in your .dat file. >>> >>> HTH >>> >>> Peter Kenny >>> >>> >>> -----Original Message----- >>> From: David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> >>> Sent: 11 February 2021 16:46 >>> To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> >>> Subject: [Pharo-users] Re: Problem with Dictionary and Associations >>> >>> Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key. >>> >>> If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=) >>> >>> David >>> >>>> On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>> >>>> I can parse the file data you provided: >>>> >>>> STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}' >>>> >>>> "a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )" >>>> >>>> (BTW, this is STON not JSON). >>>> >>>> What I do see in the input is junk after the last } >>>> >>>> That can happen when you overwrite an existing file with shorter content. You should truncate such a file. >>>> >>>> From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work. >>>> >>>>> On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>>> >>>>> I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand. >>>>> >>>>> <stack.rtf><20210225 01><screenshot.png> >>>>> >>>>>> On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>> >>>>>> Hi David, >>>>>> >>>>>>> On 10 Feb 2021, at 19:18, David@totallyobjects.com <mailto:David@totallyobjects.com> wrote: >>>>>>> >>>>>>> I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents. >>>>>>> >>>>>>> Fistly, any ideas why this has changed and secondly, any ideas how to fix it? >>>>>>> >>>>>>> David >>>>>>> Totally Objects >>>>>>> >>>>>>> Sent from my Huawei tablet >>>>>> >>>>>> I am afraid I need more information. >>>>>> >>>>>> Could you create a reproducible case ? >>>>>> Do you have a stack trace ? >>>>>> >>>>>> In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand). >>>>>> >>>>>> Sven >>>>> >> > > -------------------------------------------- > Stéphane Ducasse > http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> > 03 59 35 87 52 > Assistant: Aurore Dalle > FAX 03 59 57 78 50 > TEL 03 59 35 86 16 > S. Ducasse - Inria > 40, avenue Halley, > Parc Scientifique de la Haute Borne, Bât.A, Park Plaza > Villeneuve d'Ascq 59650 > France >
SD
Stéphane Ducasse
Sat, Feb 13, 2021 4:20 PM

Thanks david.
Do you have a visual?
Preferably in Pharo?

S.

On 13 Feb 2021, at 13:40, David Pennington david@totallyobjects.com wrote:

OK, here goes.

My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use.

TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac.

Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format)  that recur monthly so that a monthly budget can be managed.  It is written in Pharo 8.0.

I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space.

David Pennington
Totally Objects
(Http://www.totallyobjects.com http://www.totallyobjects.com/)

On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr mailto:stephane.ducasse@inria.fr> wrote:

Hi david

Two points:
- I would love to have a little success story about your application
= one paragraph what is does + one paragraph how technology is cool :)

- if you need we have a native VM for M1 (the stackVM).

S.

On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

Hi there Peter

I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work.

I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy.

I have yet to look at deleting the old file before writing but I am sure that this will make it superb.

Many thanks for your help in this.

David
TotallyObjects
http://www.totallyobjects http://www.totallyobjects/.com

Your suggestion worked perfectly - I truncate the file and it parses

On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> wrote:

David
I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil.

I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:,  and see what exactly it does with the junk in your .dat file.

HTH

Peter Kenny

-----Original Message-----
From: David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com>
Sent: 11 February 2021 16:46
To: Any question about pharo is welcome <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org>
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key.

If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=)

David

On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

I can parse the file data you provided:

STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}'

"a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )"

(BTW, this is STON not JSON).

What I do see in the input is junk after the last }

That can happen when you overwrite an existing file with shorter content. You should truncate such a file.

From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work.

On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand.

<stack.rtf><20210225 01><screenshot.png>

On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

Hi David,

On 10 Feb 2021, at 19:18, David@totallyobjects.com mailto:David@totallyobjects.com wrote:

I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents.

Fistly, any ideas why this has changed and secondly, any ideas how to fix it?

David
Totally Objects

Sent from my Huawei tablet

I am afraid I need more information.

Could you create a reproducible case ?
Do you have a stack trace ?

In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand).

Sven


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


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

Thanks david. Do you have a visual? Preferably in Pharo? S. > On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com> wrote: > > OK, here goes. > > My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use. > > TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac. > > Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format) that recur monthly so that a monthly budget can be managed. It is written in Pharo 8.0. > > I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space. > > David Pennington > Totally Objects > (Http://www.totallyobjects.com <http://www.totallyobjects.com/>) > >> On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: >> >> Hi david >> >> Two points: >> - I would love to have a little success story about your application >> = one paragraph what is does + one paragraph how technology is cool :) >> >> - if you need we have a native VM for M1 (the stackVM). >> >> S. >> >>> On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>> >>> Hi there Peter >>> >>> I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work. >>> >>> I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy. >>> >>> I have yet to look at deleting the old file before writing but I am sure that this will make it superb. >>> >>> Many thanks for your help in this. >>> >>> David >>> TotallyObjects >>> http://www.totallyobjects <http://www.totallyobjects/>.com >>> >>> Your suggestion worked perfectly - I truncate the file and it parses >>> >>>> On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> wrote: >>>> >>>> David >>>> I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil. >>>> >>>> I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:, and see what exactly it does with the junk in your .dat file. >>>> >>>> HTH >>>> >>>> Peter Kenny >>>> >>>> >>>> -----Original Message----- >>>> From: David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> >>>> Sent: 11 February 2021 16:46 >>>> To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> >>>> Subject: [Pharo-users] Re: Problem with Dictionary and Associations >>>> >>>> Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key. >>>> >>>> If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=) >>>> >>>> David >>>> >>>>> On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>> >>>>> I can parse the file data you provided: >>>>> >>>>> STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}' >>>>> >>>>> "a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )" >>>>> >>>>> (BTW, this is STON not JSON). >>>>> >>>>> What I do see in the input is junk after the last } >>>>> >>>>> That can happen when you overwrite an existing file with shorter content. You should truncate such a file. >>>>> >>>>> From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work. >>>>> >>>>>> On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>>>> >>>>>> I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand. >>>>>> >>>>>> <stack.rtf><20210225 01><screenshot.png> >>>>>> >>>>>>> On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>>> >>>>>>> Hi David, >>>>>>> >>>>>>>> On 10 Feb 2021, at 19:18, David@totallyobjects.com <mailto:David@totallyobjects.com> wrote: >>>>>>>> >>>>>>>> I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents. >>>>>>>> >>>>>>>> Fistly, any ideas why this has changed and secondly, any ideas how to fix it? >>>>>>>> >>>>>>>> David >>>>>>>> Totally Objects >>>>>>>> >>>>>>>> Sent from my Huawei tablet >>>>>>> >>>>>>> I am afraid I need more information. >>>>>>> >>>>>>> Could you create a reproducible case ? >>>>>>> Do you have a stack trace ? >>>>>>> >>>>>>> In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand). >>>>>>> >>>>>>> Sven >>>>>> >>> >> >> -------------------------------------------- >> Stéphane Ducasse >> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> >> 03 59 35 87 52 >> Assistant: Aurore Dalle >> FAX 03 59 57 78 50 >> TEL 03 59 35 86 16 >> S. Ducasse - Inria >> 40, avenue Halley, >> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >> Villeneuve d'Ascq 59650 >> France >> > -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
DP
David Pennington
Sat, Feb 13, 2021 4:28 PM

Firstly, I didn’t explain that all the visuals are written in Seaside and, currently, the pages are just there to deliver the output.

Secondly, as it is our bank account, I don’t really think that it would be appropriate. Let me mock up some stuff and see how I go.

David

On 13 Feb 2021, at 16:20, Stéphane Ducasse stephane.ducasse@inria.fr wrote:

Thanks david.
Do you have a visual?
Preferably in Pharo?

S.

On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

OK, here goes.

My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use.

TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac.

Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format)  that recur monthly so that a monthly budget can be managed.  It is written in Pharo 8.0.

I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space.

David Pennington
Totally Objects
(Http://www.totallyobjects.com http://www.totallyobjects.com/)

On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr mailto:stephane.ducasse@inria.fr> wrote:

Hi david

Two points:
- I would love to have a little success story about your application
= one paragraph what is does + one paragraph how technology is cool :)

- if you need we have a native VM for M1 (the stackVM).

S.

On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

Hi there Peter

I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work.

I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy.

I have yet to look at deleting the old file before writing but I am sure that this will make it superb.

Many thanks for your help in this.

David
TotallyObjects
http://www.totallyobjects http://www.totallyobjects/.com

Your suggestion worked perfectly - I truncate the file and it parses

On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> wrote:

David
I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil.

I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:,  and see what exactly it does with the junk in your .dat file.

HTH

Peter Kenny

-----Original Message-----
From: David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com>
Sent: 11 February 2021 16:46
To: Any question about pharo is welcome <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org>
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key.

If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=)

David

On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

I can parse the file data you provided:

STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}'

"a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )"

(BTW, this is STON not JSON).

What I do see in the input is junk after the last }

That can happen when you overwrite an existing file with shorter content. You should truncate such a file.

From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work.

On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand.

<stack.rtf><20210225 01><screenshot.png>

On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

Hi David,

On 10 Feb 2021, at 19:18, David@totallyobjects.com mailto:David@totallyobjects.com wrote:

I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents.

Fistly, any ideas why this has changed and secondly, any ideas how to fix it?

David
Totally Objects

Sent from my Huawei tablet

I am afraid I need more information.

Could you create a reproducible case ?
Do you have a stack trace ?

In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand).

Sven


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


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

Firstly, I didn’t explain that all the visuals are written in Seaside and, currently, the pages are just there to deliver the output. Secondly, as it is our bank account, I don’t really think that it would be appropriate. Let me mock up some stuff and see how I go. David > On 13 Feb 2021, at 16:20, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: > > Thanks david. > Do you have a visual? > Preferably in Pharo? > > S. > >> On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >> >> OK, here goes. >> >> My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use. >> >> TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac. >> >> Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format) that recur monthly so that a monthly budget can be managed. It is written in Pharo 8.0. >> >> I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space. >> >> David Pennington >> Totally Objects >> (Http://www.totallyobjects.com <http://www.totallyobjects.com/>) >> >>> On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: >>> >>> Hi david >>> >>> Two points: >>> - I would love to have a little success story about your application >>> = one paragraph what is does + one paragraph how technology is cool :) >>> >>> - if you need we have a native VM for M1 (the stackVM). >>> >>> S. >>> >>>> On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>> >>>> Hi there Peter >>>> >>>> I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work. >>>> >>>> I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy. >>>> >>>> I have yet to look at deleting the old file before writing but I am sure that this will make it superb. >>>> >>>> Many thanks for your help in this. >>>> >>>> David >>>> TotallyObjects >>>> http://www.totallyobjects <http://www.totallyobjects/>.com >>>> >>>> Your suggestion worked perfectly - I truncate the file and it parses >>>> >>>>> On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> wrote: >>>>> >>>>> David >>>>> I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil. >>>>> >>>>> I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:, and see what exactly it does with the junk in your .dat file. >>>>> >>>>> HTH >>>>> >>>>> Peter Kenny >>>>> >>>>> >>>>> -----Original Message----- >>>>> From: David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> >>>>> Sent: 11 February 2021 16:46 >>>>> To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> >>>>> Subject: [Pharo-users] Re: Problem with Dictionary and Associations >>>>> >>>>> Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key. >>>>> >>>>> If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=) >>>>> >>>>> David >>>>> >>>>>> On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>> >>>>>> I can parse the file data you provided: >>>>>> >>>>>> STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}' >>>>>> >>>>>> "a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )" >>>>>> >>>>>> (BTW, this is STON not JSON). >>>>>> >>>>>> What I do see in the input is junk after the last } >>>>>> >>>>>> That can happen when you overwrite an existing file with shorter content. You should truncate such a file. >>>>>> >>>>>> From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work. >>>>>> >>>>>>> On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>>>>> >>>>>>> I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand. >>>>>>> >>>>>>> <stack.rtf><20210225 01><screenshot.png> >>>>>>> >>>>>>>> On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>>>> >>>>>>>> Hi David, >>>>>>>> >>>>>>>>> On 10 Feb 2021, at 19:18, David@totallyobjects.com <mailto:David@totallyobjects.com> wrote: >>>>>>>>> >>>>>>>>> I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents. >>>>>>>>> >>>>>>>>> Fistly, any ideas why this has changed and secondly, any ideas how to fix it? >>>>>>>>> >>>>>>>>> David >>>>>>>>> Totally Objects >>>>>>>>> >>>>>>>>> Sent from my Huawei tablet >>>>>>>> >>>>>>>> I am afraid I need more information. >>>>>>>> >>>>>>>> Could you create a reproducible case ? >>>>>>>> Do you have a stack trace ? >>>>>>>> >>>>>>>> In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand). >>>>>>>> >>>>>>>> Sven >>>>>>> >>>> >>> >>> -------------------------------------------- >>> Stéphane Ducasse >>> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> >>> 03 59 35 87 52 >>> Assistant: Aurore Dalle >>> FAX 03 59 57 78 50 >>> TEL 03 59 35 86 16 >>> S. Ducasse - Inria >>> 40, avenue Halley, >>> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >>> Villeneuve d'Ascq 59650 >>> France >>> >> > > -------------------------------------------- > Stéphane Ducasse > http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> > 03 59 35 87 52 > Assistant: Aurore Dalle > FAX 03 59 57 78 50 > TEL 03 59 35 86 16 > S. Ducasse - Inria > 40, avenue Halley, > Parc Scientifique de la Haute Borne, Bât.A, Park Plaza > Villeneuve d'Ascq 59650 > France >
SD
Stéphane Ducasse
Sat, Feb 13, 2021 4:35 PM

Hi david
I will massage a bit your text because I would not like to insult people around me and give false impression. :)
I want a text for the world
http://www.pharo.org/success

For your information when Pharo will get as a tenth of the many paid engineers of the other systems I will compare.
Esteban, Pablo and Guillermo are talented engineers. And so far the consortium is able to pay one and half engineer and Inria
is supporting the rest.

Pharo is not like we would like it to be. Pharo is as we can make it with the limited
resources we have. And so far I think that we are doing super good. You see like the first ARM64 bits based JIT
and the first VM for M1 machine.

BTW for the new mac machines, we can give you access to a VM that is going faster than the Rosetta one.

S.

On 13 Feb 2021, at 13:40, David Pennington david@totallyobjects.com wrote:

OK, here goes.

My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use.

TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac.

Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format)  that recur monthly so that a monthly budget can be managed.  It is written in Pharo 8.0.

I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space.

On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr mailto:stephane.ducasse@inria.fr> wrote:

Hi david

Two points:
- I would love to have a little success story about your application
= one paragraph what is does + one paragraph how technology is cool :)

- if you need we have a native VM for M1 (the stackVM).

S.

On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

Hi there Peter

I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work.

I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy.

I have yet to look at deleting the old file before writing but I am sure that this will make it superb.

Many thanks for your help in this.

David
TotallyObjects
http://www.totallyobjects http://www.totallyobjects/.com

Your suggestion worked perfectly - I truncate the file and it parses

On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> wrote:

David
I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil.

I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:,  and see what exactly it does with the junk in your .dat file.

HTH

Peter Kenny

-----Original Message-----
From: David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com>
Sent: 11 February 2021 16:46
To: Any question about pharo is welcome <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org>
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key.

If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=)

David

On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

I can parse the file data you provided:

STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}'

"a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )"

(BTW, this is STON not JSON).

What I do see in the input is junk after the last }

That can happen when you overwrite an existing file with shorter content. You should truncate such a file.

From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work.

On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand.

<stack.rtf><20210225 01><screenshot.png>

On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

Hi David,

On 10 Feb 2021, at 19:18, David@totallyobjects.com mailto:David@totallyobjects.com wrote:

I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents.

Fistly, any ideas why this has changed and secondly, any ideas how to fix it?

David
Totally Objects

Sent from my Huawei tablet

I am afraid I need more information.

Could you create a reproducible case ?
Do you have a stack trace ?

In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand).

Sven


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


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

Hi david I will massage a bit your text because I would not like to insult people around me and give false impression. :) I want a text for the world http://www.pharo.org/success For your information when Pharo will get as a tenth of the many paid engineers of the other systems I will compare. Esteban, Pablo and Guillermo are talented engineers. And so far the consortium is able to pay one and half engineer and Inria is supporting the rest. Pharo is not like we would like it to be. Pharo is as we can make it with the limited resources we have. And so far I think that we are doing super good. You see like the first ARM64 bits based JIT and the first VM for M1 machine. BTW for the new mac machines, we can give you access to a VM that is going faster than the Rosetta one. S. > On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com> wrote: > > OK, here goes. > > My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use. > > TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac. > > Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format) that recur monthly so that a monthly budget can be managed. It is written in Pharo 8.0. > > I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space. > > David Pennington > Totally Objects > (Http://www.totallyobjects.com <http://www.totallyobjects.com/>) > >> On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: >> >> Hi david >> >> Two points: >> - I would love to have a little success story about your application >> = one paragraph what is does + one paragraph how technology is cool :) >> >> - if you need we have a native VM for M1 (the stackVM). >> >> S. >> >>> On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>> >>> Hi there Peter >>> >>> I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work. >>> >>> I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy. >>> >>> I have yet to look at deleting the old file before writing but I am sure that this will make it superb. >>> >>> Many thanks for your help in this. >>> >>> David >>> TotallyObjects >>> http://www.totallyobjects <http://www.totallyobjects/>.com >>> >>> Your suggestion worked perfectly - I truncate the file and it parses >>> >>>> On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> wrote: >>>> >>>> David >>>> I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil. >>>> >>>> I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:, and see what exactly it does with the junk in your .dat file. >>>> >>>> HTH >>>> >>>> Peter Kenny >>>> >>>> >>>> -----Original Message----- >>>> From: David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> >>>> Sent: 11 February 2021 16:46 >>>> To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> >>>> Subject: [Pharo-users] Re: Problem with Dictionary and Associations >>>> >>>> Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key. >>>> >>>> If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=) >>>> >>>> David >>>> >>>>> On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>> >>>>> I can parse the file data you provided: >>>>> >>>>> STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}' >>>>> >>>>> "a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )" >>>>> >>>>> (BTW, this is STON not JSON). >>>>> >>>>> What I do see in the input is junk after the last } >>>>> >>>>> That can happen when you overwrite an existing file with shorter content. You should truncate such a file. >>>>> >>>>> From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work. >>>>> >>>>>> On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>>>> >>>>>> I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand. >>>>>> >>>>>> <stack.rtf><20210225 01><screenshot.png> >>>>>> >>>>>>> On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>>> >>>>>>> Hi David, >>>>>>> >>>>>>>> On 10 Feb 2021, at 19:18, David@totallyobjects.com <mailto:David@totallyobjects.com> wrote: >>>>>>>> >>>>>>>> I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents. >>>>>>>> >>>>>>>> Fistly, any ideas why this has changed and secondly, any ideas how to fix it? >>>>>>>> >>>>>>>> David >>>>>>>> Totally Objects >>>>>>>> >>>>>>>> Sent from my Huawei tablet >>>>>>> >>>>>>> I am afraid I need more information. >>>>>>> >>>>>>> Could you create a reproducible case ? >>>>>>> Do you have a stack trace ? >>>>>>> >>>>>>> In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand). >>>>>>> >>>>>>> Sven >>>>>> >>> >> >> -------------------------------------------- >> Stéphane Ducasse >> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> >> 03 59 35 87 52 >> Assistant: Aurore Dalle >> FAX 03 59 57 78 50 >> TEL 03 59 35 86 16 >> S. Ducasse - Inria >> 40, avenue Halley, >> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >> Villeneuve d'Ascq 59650 >> France >> > -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
SD
Stéphane Ducasse
Sat, Feb 13, 2021 4:36 PM

Ok this is not mandatory.
So do not lose time with it.

S.

On 13 Feb 2021, at 17:28, David Pennington david@totallyobjects.com wrote:

Firstly, I didn’t explain that all the visuals are written in Seaside and, currently, the pages are just there to deliver the output.

Secondly, as it is our bank account, I don’t really think that it would be appropriate. Let me mock up some stuff and see how I go.

David

On 13 Feb 2021, at 16:20, Stéphane Ducasse <stephane.ducasse@inria.fr mailto:stephane.ducasse@inria.fr> wrote:

Thanks david.
Do you have a visual?
Preferably in Pharo?

S.

On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

OK, here goes.

My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use.

TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac.

Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format)  that recur monthly so that a monthly budget can be managed.  It is written in Pharo 8.0.

I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space.

David Pennington
Totally Objects
(Http://www.totallyobjects.com http://www.totallyobjects.com/)

On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr mailto:stephane.ducasse@inria.fr> wrote:

Hi david

Two points:
- I would love to have a little success story about your application
= one paragraph what is does + one paragraph how technology is cool :)

- if you need we have a native VM for M1 (the stackVM).

S.

On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

Hi there Peter

I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work.

I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy.

I have yet to look at deleting the old file before writing but I am sure that this will make it superb.

Many thanks for your help in this.

David
TotallyObjects
http://www.totallyobjects http://www.totallyobjects/.com

Your suggestion worked perfectly - I truncate the file and it parses

On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> wrote:

David
I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil.

I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:,  and see what exactly it does with the junk in your .dat file.

HTH

Peter Kenny

-----Original Message-----
From: David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com>
Sent: 11 February 2021 16:46
To: Any question about pharo is welcome <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org>
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key.

If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=)

David

On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

I can parse the file data you provided:

STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}'

"a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )"

(BTW, this is STON not JSON).

What I do see in the input is junk after the last }

That can happen when you overwrite an existing file with shorter content. You should truncate such a file.

From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work.

On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand.

<stack.rtf><20210225 01><screenshot.png>

On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

Hi David,

On 10 Feb 2021, at 19:18, David@totallyobjects.com mailto:David@totallyobjects.com wrote:

I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents.

Fistly, any ideas why this has changed and secondly, any ideas how to fix it?

David
Totally Objects

Sent from my Huawei tablet

I am afraid I need more information.

Could you create a reproducible case ?
Do you have a stack trace ?

In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand).

Sven


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


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


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

Ok this is not mandatory. So do not lose time with it. S. > On 13 Feb 2021, at 17:28, David Pennington <david@totallyobjects.com> wrote: > > Firstly, I didn’t explain that all the visuals are written in Seaside and, currently, the pages are just there to deliver the output. > > Secondly, as it is our bank account, I don’t really think that it would be appropriate. Let me mock up some stuff and see how I go. > > David > >> On 13 Feb 2021, at 16:20, Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: >> >> Thanks david. >> Do you have a visual? >> Preferably in Pharo? >> >> S. >> >>> On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>> >>> OK, here goes. >>> >>> My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use. >>> >>> TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac. >>> >>> Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format) that recur monthly so that a monthly budget can be managed. It is written in Pharo 8.0. >>> >>> I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space. >>> >>> David Pennington >>> Totally Objects >>> (Http://www.totallyobjects.com <http://www.totallyobjects.com/>) >>> >>>> On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: >>>> >>>> Hi david >>>> >>>> Two points: >>>> - I would love to have a little success story about your application >>>> = one paragraph what is does + one paragraph how technology is cool :) >>>> >>>> - if you need we have a native VM for M1 (the stackVM). >>>> >>>> S. >>>> >>>>> On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>>> >>>>> Hi there Peter >>>>> >>>>> I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work. >>>>> >>>>> I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy. >>>>> >>>>> I have yet to look at deleting the old file before writing but I am sure that this will make it superb. >>>>> >>>>> Many thanks for your help in this. >>>>> >>>>> David >>>>> TotallyObjects >>>>> http://www.totallyobjects <http://www.totallyobjects/>.com >>>>> >>>>> Your suggestion worked perfectly - I truncate the file and it parses >>>>> >>>>>> On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> wrote: >>>>>> >>>>>> David >>>>>> I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil. >>>>>> >>>>>> I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:, and see what exactly it does with the junk in your .dat file. >>>>>> >>>>>> HTH >>>>>> >>>>>> Peter Kenny >>>>>> >>>>>> >>>>>> -----Original Message----- >>>>>> From: David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> >>>>>> Sent: 11 February 2021 16:46 >>>>>> To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> >>>>>> Subject: [Pharo-users] Re: Problem with Dictionary and Associations >>>>>> >>>>>> Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key. >>>>>> >>>>>> If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=) >>>>>> >>>>>> David >>>>>> >>>>>>> On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>>> >>>>>>> I can parse the file data you provided: >>>>>>> >>>>>>> STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}' >>>>>>> >>>>>>> "a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )" >>>>>>> >>>>>>> (BTW, this is STON not JSON). >>>>>>> >>>>>>> What I do see in the input is junk after the last } >>>>>>> >>>>>>> That can happen when you overwrite an existing file with shorter content. You should truncate such a file. >>>>>>> >>>>>>> From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work. >>>>>>> >>>>>>>> On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>>>>>> >>>>>>>> I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand. >>>>>>>> >>>>>>>> <stack.rtf><20210225 01><screenshot.png> >>>>>>>> >>>>>>>>> On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>>>>> >>>>>>>>> Hi David, >>>>>>>>> >>>>>>>>>> On 10 Feb 2021, at 19:18, David@totallyobjects.com <mailto:David@totallyobjects.com> wrote: >>>>>>>>>> >>>>>>>>>> I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents. >>>>>>>>>> >>>>>>>>>> Fistly, any ideas why this has changed and secondly, any ideas how to fix it? >>>>>>>>>> >>>>>>>>>> David >>>>>>>>>> Totally Objects >>>>>>>>>> >>>>>>>>>> Sent from my Huawei tablet >>>>>>>>> >>>>>>>>> I am afraid I need more information. >>>>>>>>> >>>>>>>>> Could you create a reproducible case ? >>>>>>>>> Do you have a stack trace ? >>>>>>>>> >>>>>>>>> In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand). >>>>>>>>> >>>>>>>>> Sven >>>>>>>> >>>>> >>>> >>>> -------------------------------------------- >>>> Stéphane Ducasse >>>> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> >>>> 03 59 35 87 52 >>>> Assistant: Aurore Dalle >>>> FAX 03 59 57 78 50 >>>> TEL 03 59 35 86 16 >>>> S. Ducasse - Inria >>>> 40, avenue Halley, >>>> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >>>> Villeneuve d'Ascq 59650 >>>> France >>>> >>> >> >> -------------------------------------------- >> Stéphane Ducasse >> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> >> 03 59 35 87 52 >> Assistant: Aurore Dalle >> FAX 03 59 57 78 50 >> TEL 03 59 35 86 16 >> S. Ducasse - Inria >> 40, avenue Halley, >> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >> Villeneuve d'Ascq 59650 >> France >> > -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
DP
David Pennington
Sat, Feb 13, 2021 7:00 PM

Sorry, I meant to be factual not critical.

I am very pleased with Pharo and, now that I can see how it works, I am getting on really well with it.

I understand about resources as I have worked on my own for 20 years and have no-one to assist me. Never mind, Smalltalk is such a great language.

Please let me see the new VM and I will run some tests against it. I am impressed with performance as it is so a native VM should be fantastic.

David

On 13 Feb 2021, at 16:35, Stéphane Ducasse stephane.ducasse@inria.fr wrote:

Hi david
I will massage a bit your text because I would not like to insult people around me and give false impression. :)
I want a text for the world
http://www.pharo.org/success http://www.pharo.org/success

For your information when Pharo will get as a tenth of the many paid engineers of the other systems I will compare.
Esteban, Pablo and Guillermo are talented engineers. And so far the consortium is able to pay one and half engineer and Inria
is supporting the rest.

Pharo is not like we would like it to be. Pharo is as we can make it with the limited
resources we have. And so far I think that we are doing super good. You see like the first ARM64 bits based JIT
and the first VM for M1 machine.

BTW for the new mac machines, we can give you access to a VM that is going faster than the Rosetta one.

S.

On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

OK, here goes.

My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use.

TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac.

Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format)  that recur monthly so that a monthly budget can be managed.  It is written in Pharo 8.0.

I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space.

On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr mailto:stephane.ducasse@inria.fr> wrote:

Hi david

Two points:
- I would love to have a little success story about your application
= one paragraph what is does + one paragraph how technology is cool :)

- if you need we have a native VM for M1 (the stackVM).

S.

On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

Hi there Peter

I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work.

I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy.

I have yet to look at deleting the old file before writing but I am sure that this will make it superb.

Many thanks for your help in this.

David
TotallyObjects
http://www.totallyobjects http://www.totallyobjects/.com

Your suggestion worked perfectly - I truncate the file and it parses

On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> wrote:

David
I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil.

I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:,  and see what exactly it does with the junk in your .dat file.

HTH

Peter Kenny

-----Original Message-----
From: David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com>
Sent: 11 February 2021 16:46
To: Any question about pharo is welcome <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org>
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key.

If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=)

David

On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

I can parse the file data you provided:

STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}'

"a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )"

(BTW, this is STON not JSON).

What I do see in the input is junk after the last }

That can happen when you overwrite an existing file with shorter content. You should truncate such a file.

From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work.

On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand.

<stack.rtf><20210225 01><screenshot.png>

On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

Hi David,

On 10 Feb 2021, at 19:18, David@totallyobjects.com mailto:David@totallyobjects.com wrote:

I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents.

Fistly, any ideas why this has changed and secondly, any ideas how to fix it?

David
Totally Objects

Sent from my Huawei tablet

I am afraid I need more information.

Could you create a reproducible case ?
Do you have a stack trace ?

In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand).

Sven


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


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

Sorry, I meant to be factual not critical. I am very pleased with Pharo and, now that I can see how it works, I am getting on really well with it. I understand about resources as I have worked on my own for 20 years and have no-one to assist me. Never mind, Smalltalk is such a great language. Please let me see the new VM and I will run some tests against it. I am impressed with performance as it is so a native VM should be fantastic. David > On 13 Feb 2021, at 16:35, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: > > Hi david > I will massage a bit your text because I would not like to insult people around me and give false impression. :) > I want a text for the world > http://www.pharo.org/success <http://www.pharo.org/success> > > For your information when Pharo will get as a tenth of the many paid engineers of the other systems I will compare. > Esteban, Pablo and Guillermo are talented engineers. And so far the consortium is able to pay one and half engineer and Inria > is supporting the rest. > > Pharo is not like we would like it to be. Pharo is as we can make it with the limited > resources we have. And so far I think that we are doing super good. You see like the first ARM64 bits based JIT > and the first VM for M1 machine. > > BTW for the new mac machines, we can give you access to a VM that is going faster than the Rosetta one. > > S. > > > >> On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >> >> OK, here goes. >> >> My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use. >> >> TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac. >> >> Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format) that recur monthly so that a monthly budget can be managed. It is written in Pharo 8.0. >> >> I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space. > > > >> >> David Pennington >> Totally Objects >> (Http://www.totallyobjects.com <http://www.totallyobjects.com/>) >> >>> On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: >>> >>> Hi david >>> >>> Two points: >>> - I would love to have a little success story about your application >>> = one paragraph what is does + one paragraph how technology is cool :) >>> >>> - if you need we have a native VM for M1 (the stackVM). >>> >>> S. >>> >>>> On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>> >>>> Hi there Peter >>>> >>>> I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work. >>>> >>>> I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy. >>>> >>>> I have yet to look at deleting the old file before writing but I am sure that this will make it superb. >>>> >>>> Many thanks for your help in this. >>>> >>>> David >>>> TotallyObjects >>>> http://www.totallyobjects <http://www.totallyobjects/>.com >>>> >>>> Your suggestion worked perfectly - I truncate the file and it parses >>>> >>>>> On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> wrote: >>>>> >>>>> David >>>>> I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil. >>>>> >>>>> I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:, and see what exactly it does with the junk in your .dat file. >>>>> >>>>> HTH >>>>> >>>>> Peter Kenny >>>>> >>>>> >>>>> -----Original Message----- >>>>> From: David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> >>>>> Sent: 11 February 2021 16:46 >>>>> To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> >>>>> Subject: [Pharo-users] Re: Problem with Dictionary and Associations >>>>> >>>>> Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key. >>>>> >>>>> If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=) >>>>> >>>>> David >>>>> >>>>>> On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>> >>>>>> I can parse the file data you provided: >>>>>> >>>>>> STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}' >>>>>> >>>>>> "a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )" >>>>>> >>>>>> (BTW, this is STON not JSON). >>>>>> >>>>>> What I do see in the input is junk after the last } >>>>>> >>>>>> That can happen when you overwrite an existing file with shorter content. You should truncate such a file. >>>>>> >>>>>> From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work. >>>>>> >>>>>>> On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>>>>> >>>>>>> I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand. >>>>>>> >>>>>>> <stack.rtf><20210225 01><screenshot.png> >>>>>>> >>>>>>>> On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>>>> >>>>>>>> Hi David, >>>>>>>> >>>>>>>>> On 10 Feb 2021, at 19:18, David@totallyobjects.com <mailto:David@totallyobjects.com> wrote: >>>>>>>>> >>>>>>>>> I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents. >>>>>>>>> >>>>>>>>> Fistly, any ideas why this has changed and secondly, any ideas how to fix it? >>>>>>>>> >>>>>>>>> David >>>>>>>>> Totally Objects >>>>>>>>> >>>>>>>>> Sent from my Huawei tablet >>>>>>>> >>>>>>>> I am afraid I need more information. >>>>>>>> >>>>>>>> Could you create a reproducible case ? >>>>>>>> Do you have a stack trace ? >>>>>>>> >>>>>>>> In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand). >>>>>>>> >>>>>>>> Sven >>>>>>> >>>> >>> >>> -------------------------------------------- >>> Stéphane Ducasse >>> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> >>> 03 59 35 87 52 >>> Assistant: Aurore Dalle >>> FAX 03 59 57 78 50 >>> TEL 03 59 35 86 16 >>> S. Ducasse - Inria >>> 40, avenue Halley, >>> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >>> Villeneuve d'Ascq 59650 >>> France >>> >> > > -------------------------------------------- > Stéphane Ducasse > http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> > 03 59 35 87 52 > Assistant: Aurore Dalle > FAX 03 59 57 78 50 > TEL 03 59 35 86 16 > S. Ducasse - Inria > 40, avenue Halley, > Parc Scientifique de la Haute Borne, Bât.A, Park Plaza > Villeneuve d'Ascq 59650 > France >
SD
Stéphane Ducasse
Sun, Feb 14, 2021 1:35 PM

Sorry, I meant to be factual not critical.

I have no problem with facts but then we should measure them.

I am very pleased with Pharo and, now that I can see how it works, I am getting on really well with it.

You see Pharo has the best integration with git.
This is not just a file out and commit but something a lot more elaborated that help us a lot.
Because we have in fact two working copies with Smalltalk and Git.

I understand about resources as I have worked on my own for 20 years and have no-one to assist me. Never mind, Smalltalk is such a great language.

:)
Our goal is to make sure that people can make business with Pharo.
So do not hesitate to let us know what you need.
It does not mean that we will drop everything but
it is always important
as a community there is no competition between people.

Please let me see the new VM and I will run some tests against it. I am impressed with performance as it is so a native VM should be fantastic.

I will sync monday with the team to see what we can do.
Because this is 10 days that we are waiting to get an answer to know how we can access the jenkins integration server and connect our new machines
COVID is bad for team.
One member of our team is working for the COVID app of the government.

S.

David

On 13 Feb 2021, at 16:35, Stéphane Ducasse <stephane.ducasse@inria.fr mailto:stephane.ducasse@inria.fr> wrote:

Hi david
I will massage a bit your text because I would not like to insult people around me and give false impression. :)
I want a text for the world
http://www.pharo.org/success http://www.pharo.org/success

For your information when Pharo will get as a tenth of the many paid engineers of the other systems I will compare.
Esteban, Pablo and Guillermo are talented engineers. And so far the consortium is able to pay one and half engineer and Inria
is supporting the rest.

Pharo is not like we would like it to be. Pharo is as we can make it with the limited
resources we have. And so far I think that we are doing super good. You see like the first ARM64 bits based JIT
and the first VM for M1 machine.

BTW for the new mac machines, we can give you access to a VM that is going faster than the Rosetta one.

S.

On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

OK, here goes.

My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use.

TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac.

Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format)  that recur monthly so that a monthly budget can be managed.  It is written in Pharo 8.0.

I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space.

On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr mailto:stephane.ducasse@inria.fr> wrote:

Hi david

Two points:
- I would love to have a little success story about your application
= one paragraph what is does + one paragraph how technology is cool :)

- if you need we have a native VM for M1 (the stackVM).

S.

On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

Hi there Peter

I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work.

I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy.

I have yet to look at deleting the old file before writing but I am sure that this will make it superb.

Many thanks for your help in this.

David
TotallyObjects
http://www.totallyobjects http://www.totallyobjects/.com

Your suggestion worked perfectly - I truncate the file and it parses

On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> <peter@pbkresearch.co.uk mailto:peter@pbkresearch.co.uk> wrote:

David
I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil.

I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:,  and see what exactly it does with the junk in your .dat file.

HTH

Peter Kenny

-----Original Message-----
From: David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com>
Sent: 11 February 2021 16:46
To: Any question about pharo is welcome <pharo-users@lists.pharo.org mailto:pharo-users@lists.pharo.org>
Subject: [Pharo-users] Re: Problem with Dictionary and Associations

Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key.

If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=)

David

On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

I can parse the file data you provided:

STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}'

"a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )"

(BTW, this is STON not JSON).

What I do see in the input is junk after the last }

That can happen when you overwrite an existing file with shorter content. You should truncate such a file.

From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work.

On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com mailto:david@totallyobjects.com> wrote:

I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand.

<stack.rtf><20210225 01><screenshot.png>

On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu mailto:sven@stfx.eu> wrote:

Hi David,

On 10 Feb 2021, at 19:18, David@totallyobjects.com mailto:David@totallyobjects.com wrote:

I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents.

Fistly, any ideas why this has changed and secondly, any ideas how to fix it?

David
Totally Objects

Sent from my Huawei tablet

I am afraid I need more information.

Could you create a reproducible case ?
Do you have a stack trace ?

In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand).

Sven


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


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


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

> Sorry, I meant to be factual not critical. I have no problem with facts but then we should measure them. > I am very pleased with Pharo and, now that I can see how it works, I am getting on really well with it. You see Pharo has the best integration with git. This is not just a file out and commit but something a lot more elaborated that help us a lot. Because we have in fact two working copies with Smalltalk and Git. > I understand about resources as I have worked on my own for 20 years and have no-one to assist me. Never mind, Smalltalk is such a great language. :) Our goal is to make sure that people can make business with Pharo. So do not hesitate to let us know what you need. It does not mean that we will drop everything but it is always important as a community there is no competition between people. > > Please let me see the new VM and I will run some tests against it. I am impressed with performance as it is so a native VM should be fantastic. I will sync monday with the team to see what we can do. Because this is 10 days that we are waiting to get an answer to know how we can access the jenkins integration server and connect our new machines COVID is bad for team. One member of our team is working for the COVID app of the government. S. > > David > >> On 13 Feb 2021, at 16:35, Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: >> >> Hi david >> I will massage a bit your text because I would not like to insult people around me and give false impression. :) >> I want a text for the world >> http://www.pharo.org/success <http://www.pharo.org/success> >> >> For your information when Pharo will get as a tenth of the many paid engineers of the other systems I will compare. >> Esteban, Pablo and Guillermo are talented engineers. And so far the consortium is able to pay one and half engineer and Inria >> is supporting the rest. >> >> Pharo is not like we would like it to be. Pharo is as we can make it with the limited >> resources we have. And so far I think that we are doing super good. You see like the first ARM64 bits based JIT >> and the first VM for M1 machine. >> >> BTW for the new mac machines, we can give you access to a VM that is going faster than the Rosetta one. >> >> S. >> >> >> >>> On 13 Feb 2021, at 13:40, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>> >>> OK, here goes. >>> >>> My finishing project formy Open University degree (started in 1974 and finished in 2017!) was a routing program for freight cars on US model railways - written in VAST Smalltalk with a Seaside front end and a Riak back end. Riak is a multi-user, fail over resilient Key/Value (K/V) database. I used it on a Linux server as I couldn’t get it going under MacOS. However, now I have finished my degree, I have disposed of the server so, for my new project I didn’t have a database. I had built my own K/V database some years ago to run the management and web software for a scale model shop that I owned at that time so I decided that I would recreate that database for my current use. >>> >>> TinkKV is my Smalltalk K/V. It relies on the OS for saving and retrieving objects which are saved using STON (Smalltalk Object Notation) format. Simple, there are two levels of bucket - 1) ‘Bucket’ and 2) ’SubBucket’. There can be multiple buckets which can contain multiple sub buckets. In my application, items are stored under two keys - FAOEntry (the basic entry object) which is the primary bucket, and multiple sub buckets keyed by the category of each object. It is a single user, local machine DB which is extremely fast - retrieves 189 records in 0.18 seconds on an M1 Mac. >>> >>> Family Accounts is a simple home accounts management package that will evolve over the coming month but basically imports transactions from a NatWest Sage Accounts format download and inserts them into the database. Each object can be categorised for budget control and each budget can be displayed. The program can import a set of regular items (in CSV format) that recur monthly so that a monthly budget can be managed. It is written in Pharo 8.0. >>> >>> I have been writing Smalltalk since 1990 when I started with Digitalk Visual Smalltalk but since about 1996 I have been using IBM/Instantiations VisualAge (VAST). I started the program, knowing nothing about Pharo, around the 15th January so it has taken just about a month of 1 -2 hours a day firstly to get to grips with Pharo and then to write the DB and Program. I have found Pharo quite difficult to come to grips with as, in comparison to VAST, it seems to be written for academics rather than business apps. However, once I got my head around how it was all put together, I found it an easy transition and great fun to use. I had expected to continue with VAST under Parallels but found that neither Parallels (well partially) or Windows 10 currently works successfully on an M1 MacBookAir. I did try to get hold of VisualWorks but didn’t get any response to my request for a download for some reason. I have written a good few frameworks for VAST so, now that my program is running successfully, I will have a look and see if I can port anything else. Watch this space. >> >> >> >>> >>> David Pennington >>> Totally Objects >>> (Http://www.totallyobjects.com <http://www.totallyobjects.com/>) >>> >>>> On 13 Feb 2021, at 11:09, Stéphane Ducasse <stephane.ducasse@inria.fr <mailto:stephane.ducasse@inria.fr>> wrote: >>>> >>>> Hi david >>>> >>>> Two points: >>>> - I would love to have a little success story about your application >>>> = one paragraph what is does + one paragraph how technology is cool :) >>>> >>>> - if you need we have a native VM for M1 (the stackVM). >>>> >>>> S. >>>> >>>>> On 11 Feb 2021, at 20:38, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>>> >>>>> Hi there Peter >>>>> >>>>> I have been writing Smalltalk since 1990 first with Digitalk and then IBM/Instantiations VAST. However, I am a newbie with Pharo having only used it for the last 3 weeks so I am pleased to have got my first Seaside app working successfully - it’s a home banking management app that imports from Sage compatible CSV files supplied by NatWest. This is the only real difficulty so I am very pleased with the work. >>>>> >>>>> I use my own brand key/value database that saves objects out to the disk. With my new M1 MacBookAir, I am getting read and write values around .3 second for 125 records so I am very happy. >>>>> >>>>> I have yet to look at deleting the old file before writing but I am sure that this will make it superb. >>>>> >>>>> Many thanks for your help in this. >>>>> >>>>> David >>>>> TotallyObjects >>>>> http://www.totallyobjects <http://www.totallyobjects/>.com >>>>> >>>>> Your suggestion worked perfectly - I truncate the file and it parses >>>>> >>>>>> On 11 Feb 2021, at 17:07, <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> <peter@pbkresearch.co.uk <mailto:peter@pbkresearch.co.uk>> wrote: >>>>>> >>>>>> David >>>>>> I think you are misreading the debugger display. The bit you are missing is the last few characters in the evaluation display, after the closing parenthesis. They should not be there if it is displaying a dictionary. Evidently the variable 'aDict' is in fact an association whose key is the dictionary and whose value is nil. >>>>>> >>>>>> I can't see where it goes from there, but I think you need to look more closely at the preceding line, FAOEntry>>getEntryObjectFrom:, and see what exactly it does with the junk in your .dat file. >>>>>> >>>>>> HTH >>>>>> >>>>>> Peter Kenny >>>>>> >>>>>> >>>>>> -----Original Message----- >>>>>> From: David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> >>>>>> Sent: 11 February 2021 16:46 >>>>>> To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> >>>>>> Subject: [Pharo-users] Re: Problem with Dictionary and Associations >>>>>> >>>>>> Thank you for that but it doesn’t resolve my problem. Why does the stack move to an Association when doing the access to the dictionary? It is the Association indexing that fails as it won’t allow #entryAmount as a key. >>>>>> >>>>>> If I inspect the following code (STON fromString: result ) in the line ^ self makeObject: (STON fromString: result ) I get an Association. Why don’t I get a Dictionary. I did two days ago when all of this was working perfectly and we were happily matching the Pharo Seaside display to our bank account :=) >>>>>> >>>>>> David >>>>>> >>>>>>> On 11 Feb 2021, at 16:39, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>>> >>>>>>> I can parse the file data you provided: >>>>>>> >>>>>>> STON fromString: '{#entryName:''Housekeeping'',#entryDate:Date[''2021-02-25Z''],#transactionID:''2021022501'',#entryAmount:-400/1s8,#entryCategory:''Housekeeping'',#entryDescription:''Housekeeping'',#match:nil}ousekeeping'',#match:nil}' >>>>>>> >>>>>>> "a Dictionary(#entryAmount->-400.00000000s8 #entryCategory->'Housekeeping' #entryDate->25 February 2021 #entryDescription->'Housekeeping' #entryName->'Housekeeping' #match->nil #transactionID->'2021022501' )" >>>>>>> >>>>>>> (BTW, this is STON not JSON). >>>>>>> >>>>>>> What I do see in the input is junk after the last } >>>>>>> >>>>>>> That can happen when you overwrite an existing file with shorter content. You should truncate such a file. >>>>>>> >>>>>>> From your screenshot I can see nothing wrong, #entryAmount seems an existing key in aDict, that should just work. >>>>>>> >>>>>>>> On 11 Feb 2021, at 16:33, David Pennington <david@totallyobjects.com <mailto:david@totallyobjects.com>> wrote: >>>>>>>> >>>>>>>> I attach a couple of screen shots and a file containing the item that I am trying to open. What else can I supply? This has been working for a couple of weeks and suddenly doesn’t work. I save the JSON and then load it back again. I enclose a file with the JSON as contents. As you can see from the screenshot, the debugger shows it as a dictionary but the execution path takes it to an Association which is what I don’t understand. >>>>>>>> >>>>>>>> <stack.rtf><20210225 01><screenshot.png> >>>>>>>> >>>>>>>>> On 10 Feb 2021, at 19:17, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote: >>>>>>>>> >>>>>>>>> Hi David, >>>>>>>>> >>>>>>>>>> On 10 Feb 2021, at 19:18, David@totallyobjects.com <mailto:David@totallyobjects.com> wrote: >>>>>>>>>> >>>>>>>>>> I am using STON to objects out to disk. Up to two days ago, I was reading them in as Dictionaries and converting to objects from there. All of a sudden yesterday morning, I got an error saying that the association is only indexable with integers. Even so, I don't seem to be able to access the contents. >>>>>>>>>> >>>>>>>>>> Fistly, any ideas why this has changed and secondly, any ideas how to fix it? >>>>>>>>>> >>>>>>>>>> David >>>>>>>>>> Totally Objects >>>>>>>>>> >>>>>>>>>> Sent from my Huawei tablet >>>>>>>>> >>>>>>>>> I am afraid I need more information. >>>>>>>>> >>>>>>>>> Could you create a reproducible case ? >>>>>>>>> Do you have a stack trace ? >>>>>>>>> >>>>>>>>> In any case, STON is a text format, that can be edited (in most cases, shared or circular references being hard to edit by hand). >>>>>>>>> >>>>>>>>> Sven >>>>>>>> >>>>> >>>> >>>> -------------------------------------------- >>>> Stéphane Ducasse >>>> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> >>>> 03 59 35 87 52 >>>> Assistant: Aurore Dalle >>>> FAX 03 59 57 78 50 >>>> TEL 03 59 35 86 16 >>>> S. Ducasse - Inria >>>> 40, avenue Halley, >>>> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >>>> Villeneuve d'Ascq 59650 >>>> France >>>> >>> >> >> -------------------------------------------- >> Stéphane Ducasse >> http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> >> 03 59 35 87 52 >> Assistant: Aurore Dalle >> FAX 03 59 57 78 50 >> TEL 03 59 35 86 16 >> S. Ducasse - Inria >> 40, avenue Halley, >> Parc Scientifique de la Haute Borne, Bât.A, Park Plaza >> Villeneuve d'Ascq 59650 >> France >> > -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
SD
Stéphane Ducasse
Tue, Feb 16, 2021 7:44 PM

Hello David,

We just sent an update and a blog post to get the new VM and install it.
So let us know. I think that Pharo will be a lot snappier because Rosetta is slowing Pharo a lot.

S

PS: we have access to our building one day a week and this is an exception because
normally we should be 100% at home.

Hello happy Pharoers

Today we could access our building where the M1 machine is and Pablo packaged it
so that you can test the first version.

Pablo wrote a little blog post for you.

https://thepharo.dev/2021/02/16/first-apple-m1-pharo-version/

Let us since we do not have the M1 at hand and waiting to be able to make it accessible from
our build farm… but we are not responsible for it and we were waiting….
But the crew was fixing other VM glitches. So we will be ready soon to focus on the Jit version.

S

Hello David, We just sent an update and a blog post to get the new VM and install it. So let us know. I think that Pharo will be a lot snappier because Rosetta is slowing Pharo a lot. S PS: we have access to our building one day a week and this is an exception because normally we should be 100% at home. > Hello happy Pharoers > > Today we could access our building where the M1 machine is and Pablo packaged it > so that you can test the first version. > > Pablo wrote a little blog post for you. > > https://thepharo.dev/2021/02/16/first-apple-m1-pharo-version/ > > Let us since we do not have the M1 at hand and waiting to be able to make it accessible from > our build farm… but we are not responsible for it and we were waiting…. > But the crew was fixing other VM glitches. So we will be ready soon to focus on the Jit version. > > > S