What is the idiomatic way to store data in pharo?
I am writing a simple "quote-of-the-day" object for pharo that stores both quotes and pictures. What is the "idiomatic" way of storing data in pharo? Do I connect to some sort mysql database or is there a better "smalltalk" way to do it? Forgive the naive question. - Steve
How about Voyage? https://github.com/pharo-nosql/voyage -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
is voyage the most common way to do it? On Mon, Jan 27, 2020 at 5:32 PM tbrunz <wild.ideas@gmail.com> wrote:
How about Voyage?
https://github.com/pharo-nosql/voyage
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
Hi Steve Some ways I would do it, given what you have described: 1. Store in the image itself. An ordered collection can be used to store the your MOTD objects and iterate over them with the #do:, #select:, etc methods. For images I would store them on the file system and use a URI from your objects to point to it. 2. SQLite (https://github.com/pharo-rdbms/Pharo-SQLite3). 3. If you wish to distribute this then maybe a central server the your client can pull the MOTD objects from. Something running Teapot talking to SQLite3 or even Postgres via Svenâs excellent P3 (https://github.com/svenvc/P3). 4. Something I was thinking of looking into more is John Aspinallâs ReStore for Pharo (https://github.com/rko281/ReStoreForPharo). Vince From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Steve Quezadas Sent: Tuesday, 28 January 2020 11:36 AM To: Any question about pharo is welcome <pharo-users@lists.pharo.org> Subject: Re: [Pharo-users] What is the idiomatic way to store data in pharo? EXTERNAL: Do not click links or open attachments if you do not recognize the sender. is voyage the most common way to do it? On Mon, Jan 27, 2020 at 5:32 PM tbrunz <wild.ideas@gmail.com<mailto:wild.ideas@gmail.com>> wrote: How about Voyage? https://github.com/pharo-nosql/voyage<https://urldefense.com/v3/__https:/github.com/pharo-nosql/voyage__;!!I_DbfM1H!Q1SDxNVH7jjxTC7F5EYTgwwveftJ-BRrgWd9bgTGBz7lyJYnv-jlevM8HRCcaWPLGVkM9_V-DQ$> -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html<https://urldefense.com/v3/__http:/forum.world.st/Pharo-Smalltalk-Users-f1310670.html__;!!I_DbfM1H!Q1SDxNVH7jjxTC7F5EYTgwwveftJ-BRrgWd9bgTGBz7lyJYnv-jlevM8HRCcaWPLGVnQjtiBuA$>
Steve Quezadas wrote
Do I connect to some sort mysql database or is there a better "smalltalk" way to do it?
The Pharo way is Fuel, it will let you persist a tree of object. The package is present in Pharo by default. Easy and fast. It is documented in one of the Pharo book. Another way is JSON but I don't know it. Sven can speak about it. Its advantage over Fuel, the file format is portable. Hilaire ----- http://drgeo.eu -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
Steve, You could try with NeoJSON[1] and serialize the image as bytecodes (or urls to pictures in the web). Is pretty simple and gives you a plain and portable representation of your Quote of the Day data. Grafoscopio, the prototype I made, uses NeoJSON to store its notebooks. It's also a pretty well written library that has Sven's quality mark and you can learn a lot from it. [1] https://github.com/svenvc/NeoJSON [2] https://mutabit.com/grafoscopio/en.html Cheers, Offray On 27/01/20 8:15 p. m., Steve Quezadas wrote:
I am writing a simple "quote-of-the-day" object for pharo that stores both quotes and pictures. What is the "idiomatic" way of storing data in pharo? Do I connect to some sort mysql database or is there a better "smalltalk" way to do it?
Forgive the naive question.
- Steve
participants (5)
-
HilaireFernandes -
Offray Vladimir Luna Cárdenas -
Steve Quezadas -
tbrunz -
Vince Refiti