OrderedCollections and File I/O

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

OrderedCollections and File I/O

J. P. L. Martín
Say I have an OrderedCollection which I want to save into a file and then recover from that file when I restart the application. How should I proceed? So far I've been doing a mess, saving the OrderedCollection on a file asString, since I'm then unable to recover it asOrderedCollection.

Another problem that I have is at the moment of showing items from that OrderedCollection on a MultiColumnListMorph where I get unwanted info from the printOn:

a Prestamo fechaPrevistaDevolucion: 20 January 2013 fechaPrestamo: 17 January 2013 id: ''1'' idSocio: ''2'' idEjemplarl: ''1'' fechaDevolucion: '''''

Where I want:

20 January 2013 17 January 2013 1 2 1 ''

Here you can find the source code:
https://github.com/arguser/Paradigmas-Final
Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Hannes Hirzel
On 1/23/13, J. P. L. Martín <[hidden email]> wrote:
> Say I have an OrderedCollection which I want to save into a file and then
> recover from that file when I restart the application. How should I
> proceed? So far I've been doing a mess, saving the OrderedCollection on a
> file asString, since I'm then unable to recover it asOrderedCollection.

Maybe you'll have a look at SandstoneDB

http://onsmalltalk.com/sandstonedb-simple-activerecord-style-persistence-in-squeak

I do not know where the most recent version for Pharo 1.4 is, but I'm
sure somebody else can answer that.

--Hannes


> Another problem that I have is at the moment of showing items from that
> OrderedCollection on a MultiColumnListMorph where I get unwanted info from
> the printOn:
>
> a Prestamo fechaPrevistaDevolucion: 20 January 2013 fechaPrestamo: 17
> January 2013 id: ''1'' idSocio: ''2'' idEjemplarl: ''1'' fechaDevolucion:
> '''''
>
> Where I want:
>
> 20 January 2013 17 January 2013 1 2 1 ''
>
> Here you can find the source code:
> https://github.com/arguser/Paradigmas-Final
>

Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Dennis Schetinin
In reply to this post by J. P. L. Martín


Best regards,
Dennis Schetinin

On Wednesday, 23 January 2013 г. at 8:24, J. P. L. Martín wrote:

Say I have an OrderedCollection which I want to save into a file and then recover from that file when I restart the application. How should I proceed? So far I've been doing a mess, saving the OrderedCollection on a file asString, since I'm then unable to recover it asOrderedCollection.

Another problem that I have is at the moment of showing items from that OrderedCollection on a MultiColumnListMorph where I get unwanted info from the printOn:

a Prestamo fechaPrevistaDevolucion: 20 January 2013 fechaPrestamo: 17 January 2013 id: ''1'' idSocio: ''2'' idEjemplarl: ''1'' fechaDevolucion: '''''

Where I want:

20 January 2013 17 January 2013 1 2 1 ''

Here you can find the source code:
https://github.com/arguser/Paradigmas-Final

Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

EstebanLM
yep, fuel... :)

On Jan 23, 2013, at 6:50 AM, Dennis Schetinin <[hidden email]> wrote:



Best regards,
Dennis Schetinin

On Wednesday, 23 January 2013 г. at 8:24, J. P. L. Martín wrote:

Say I have an OrderedCollection which I want to save into a file and then recover from that file when I restart the application. How should I proceed? So far I've been doing a mess, saving the OrderedCollection on a file asString, since I'm then unable to recover it asOrderedCollection.

Another problem that I have is at the moment of showing items from that OrderedCollection on a MultiColumnListMorph where I get unwanted info from the printOn:

a Prestamo fechaPrevistaDevolucion: 20 January 2013 fechaPrestamo: 17 January 2013 id: ''1'' idSocio: ''2'' idEjemplarl: ''1'' fechaDevolucion: '''''

Where I want:

20 January 2013 17 January 2013 1 2 1 ''

Here you can find the source code:
https://github.com/arguser/Paradigmas-Final


Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Sven Van Caekenberghe-2
In reply to this post by J. P. L. Martín

On 23 Jan 2013, at 05:24, J. P. L. Martín <[hidden email]> wrote:

> Say I have an OrderedCollection which I want to save into a file and then recover from that file when I restart the application. How should I proceed? So far I've been doing a mess, saving the OrderedCollection on a file asString, since I'm then unable to recover it asOrderedCollection.
>
> Another problem that I have is at the moment of showing items from that OrderedCollection on a MultiColumnListMorph where I get unwanted info from the printOn:
>
> a Prestamo fechaPrevistaDevolucion: 20 January 2013 fechaPrestamo: 17 January 2013 id: ''1'' idSocio: ''2'' idEjemplarl: ''1'' fechaDevolucion: '''''
>
> Where I want:
>
> 20 January 2013 17 January 2013 1 2 1 ''
>
> Here you can find the source code:
> https://github.com/arguser/Paradigmas-Final

Fuel is a fast binary serializer that can store almost anything.

If the collection is holding clean domain level objects, you could also use XML, JSON or STON.
These give you human readable textual representations.

Sven

Search for
        XML Support
        NeoJSON
        STON

--
Sven Van Caekenberghe
http://stfx.eu
Smalltalk is the Red Pill


Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Edgar De Cleene
In reply to this post by J. P. L. Martín



On 1/23/13 1:24 AM, "J. P. L. Martín" <[hidden email]> wrote:

> Say I have an OrderedCollection which I want to save into a file and then
> recover from that file when I restart the application. How should I proceed?
> So far I've been doing a mess, saving the OrderedCollection on a file
> asString, since I'm then unable to recover it asOrderedCollection.
>
> Another problem that I have is at the moment of showing items from that
> OrderedCollection on a MultiColumnListMorph where I get unwanted info from the
> printOn:
>
> a Prestamo fechaPrevistaDevolucion: 20 January 2013 fechaPrestamo: 17 January
> 2013 id: ''1'' idSocio: ''2'' idEjemplarl: ''1'' fechaDevolucion: '''''
>
> Where I want:
>
>  20 January 2013 17 January 2013 1 2 1 ''
>
> Here you can find the source code:
> https://github.com/arguser/Paradigmas-Final
File in the attached in Pharo 1.4, Squeak or Cuis and you have  a way of
save / load simple Objects into the three forks.

And if you speak Spanish, we have
http://ar.groups.yahoo.com/group/squeakRos/

Join us and ask any question.

Edgar


ObjectCompatibleENH.1.cs (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Marcus Denker-4

On Jan 23, 2013, at 10:21 AM, "Edgar J. De Cleene" <[hidden email]> wrote:

>>
>
> File in the attached in Pharo 1.4, Squeak or Cuis and you have  a way of
> save / load simple Objects into the three forks.
>
> And if you speak Spanish, we have
> http://ar.groups.yahoo.com/group/squeakRos/
>
> Join us and ask any question.
>
> Edgar
>
> <ObjectCompatibleENH.1.cs>

Keep in mind that ReferenceStream is deprecated in 2.0

The nice thing about Fuel is:

        -> Very much faster
        -> output more compact
        -> you can store *any* kind of objects.
            (even the one you are sure you can't, like the Context (stack frame))

Marcus

       
Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Nicolas Cellier
+1
in the context of Pharo, no doubt, Fuel is THE solution
Squeak has to support legacy ReferenceStream a bit longer, but even in
Squeak I would inquire about Fuel

2013/1/23 Marcus Denker <[hidden email]>:

>
> On Jan 23, 2013, at 10:21 AM, "Edgar J. De Cleene" <[hidden email]> wrote:
>
>>>
>>
>> File in the attached in Pharo 1.4, Squeak or Cuis and you have  a way of
>> save / load simple Objects into the three forks.
>>
>> And if you speak Spanish, we have
>> http://ar.groups.yahoo.com/group/squeakRos/
>>
>> Join us and ask any question.
>>
>> Edgar
>>
>> <ObjectCompatibleENH.1.cs>
>
> Keep in mind that ReferenceStream is deprecated in 2.0
>
> The nice thing about Fuel is:
>
>         -> Very much faster
>         -> output more compact
>         -> you can store *any* kind of objects.
>             (even the one you are sure you can't, like the Context (stack frame))
>
> Marcus
>
>

Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Edgar De Cleene
In reply to this post by Marcus Denker-4



On 1/23/13 6:25 AM, "Marcus Denker" <[hidden email]> wrote:

> Keep in mind that ReferenceStream is deprecated in 2.0
>
> The nice thing about Fuel is:
>
> -> Very much faster
> -> output more compact
> -> you can store *any* kind of objects.
>             (even the one you are sure you can't, like the Context (stack
> frame))
>
> Marcus

Yes , I know Fuel is a great advance, but he ask about simple thing.
And also I said Pharo 1.4 and not Pharo 2.0.

Thanks to Mariano and others , wish Fuel become Squeak citizen soon, for
Cuis guess should wait longer.

Edgar



Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Camillo Bruni-3
In reply to this post by Sven Van Caekenberghe-2
which reminds me, we should have a dumb default serializer method on Object:

Object new serializeTo: 'aFile' asFileReference

cause I never figure out which Fuel class to use for serialization :)

On 2013-01-23, at 08:54, Sven Van Caekenberghe <[hidden email]> wrote:

> On 23 Jan 2013, at 05:24, J. P. L. Martín <[hidden email]> wrote:
>
>> Say I have an OrderedCollection which I want to save into a file and then recover from that file when I restart the application. How should I proceed? So far I've been doing a mess, saving the OrderedCollection on a file asString, since I'm then unable to recover it asOrderedCollection.
>>
>> Another problem that I have is at the moment of showing items from that OrderedCollection on a MultiColumnListMorph where I get unwanted info from the printOn:
>>
>> a Prestamo fechaPrevistaDevolucion: 20 January 2013 fechaPrestamo: 17 January 2013 id: ''1'' idSocio: ''2'' idEjemplarl: ''1'' fechaDevolucion: '''''
>>
>> Where I want:
>>
>> 20 January 2013 17 January 2013 1 2 1 ''
>>
>> Here you can find the source code:
>> https://github.com/arguser/Paradigmas-Final
>
> Fuel is a fast binary serializer that can store almost anything.
>
> If the collection is holding clean domain level objects, you could also use XML, JSON or STON.
> These give you human readable textual representations.
>
> Sven
>
> Search for
> XML Support
> NeoJSON
> STON
>
> --
> Sven Van Caekenberghe
> http://stfx.eu
> Smalltalk is the Red Pill
>
>


Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Tudor Girba-2
In reply to this post by Edgar De Cleene
Fuel works in 1.4 just fine.

Doru


On Wednesday, January 23, 2013, Edgar J. De Cleene wrote:



On 1/23/13 6:25 AM, "Marcus Denker" <<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;marcus.denker@inria.fr&#39;)">marcus.denker@...> wrote:

> Keep in mind that ReferenceStream is deprecated in 2.0
>
> The nice thing about Fuel is:
>
> -> Very much faster
> -> output more compact
> -> you can store *any* kind of objects.
>             (even the one you are sure you can't, like the Context (stack
> frame))
>
> Marcus

Yes , I know Fuel is a great advance, but he ask about simple thing.
And also I said Pharo 1.4 and not Pharo 2.0.

Thanks to Mariano and others , wish Fuel become Squeak citizen soon, for
Cuis guess should wait longer.

Edgar





--

"Every thing has its own flow"

Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Mariano Martinez Peck
In reply to this post by Edgar De Cleene


On Wed, Jan 23, 2013 at 6:39 AM, Edgar J. De Cleene <[hidden email]> wrote:



On 1/23/13 6:25 AM, "Marcus Denker" <[hidden email]> wrote:

> Keep in mind that ReferenceStream is deprecated in 2.0
>
> The nice thing about Fuel is:
>
> -> Very much faster
> -> output more compact
> -> you can store *any* kind of objects.
>             (even the one you are sure you can't, like the Context (stack
> frame))
>
> Marcus

Yes , I know Fuel is a great advance, but he ask about simple thing.
And also I said Pharo 1.4 and not Pharo 2.0.

Thanks to Mariano and others , wish Fuel become Squeak citizen soon, for
Cuis guess should wait longer.


Supported and tested images: 
Pharo 1.1.1, 1.1.2, 1.2, 1.3, 1.4, 2.0 
Squeak 4.1, 4.2, 4.3, 4.4 
 
Edgar






--
Mariano
http://marianopeck.wordpress.com
Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Edgar De Cleene
In reply to this post by Tudor Girba-2
Re: [Pharo-project] OrderedCollections and File I/O


On 1/23/13 8:36 AM, "Tudor Girba" <[hidden email]> wrote:

Fuel works in 1.4 just fine.

Doru

Yes, never said some different.
And works on Squeal also, thanks to Mariano and others.

Edgar
Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

Edgar De Cleene
In reply to this post by Mariano Martinez Peck
Re: [Pharo-project] OrderedCollections and File I/O


On 1/23/13 8:47 AM, "Mariano Martinez Peck" <[hidden email]> wrote:


On Wed, Jan 23, 2013 at 6:39 AM, Edgar J. De Cleene <[hidden email]> wrote:



On 1/23/13 6:25 AM, "Marcus Denker" <[hidden email]> wrote:

> Keep in mind that ReferenceStream is deprecated in 2.0
>
> The nice thing about Fuel is:
>
> -> Very much faster
> -> output more compact
> -> you can store *any* kind of objects.
>             (even the one you are sure you can't, like the Context (stack
> frame))
>
> Marcus

Yes , I know Fuel is a great advance, but he ask about simple thing.
And also I said Pharo 1.4 and not Pharo 2.0.

Thanks to Mariano and others , wish Fuel become Squeak citizen soon, for
Cuis guess should wait longer.


Edgar see new release: http://forum.world.st/ANN-Fuel-1-8-1-td4661609.html
Supported and tested images: 
Pharo 1.1.1, 1.1.2, 1.2, 1.3, 1.4, 2.0 
Squeak 4.1, 4.2, 4.3, 4.4 
 
Edgar


Mariano, yo se eso.
Pareciera que por tratar de ayudar a un nuevo con dos lineas de codigo estoy desconociendo tu trabajo y el de todos los demas que estan trabajando con Fuel.
No hay una unica receta, mis amigos de Pharo.

Edgar
Reply | Threaded
Open this post in threaded view
|

Re: OrderedCollections and File I/O

J. P. L. Martín
Thank you all for your help, I've used Fuel to save my data and it was really easy to do.

Thanks!


On Wed, Jan 23, 2013 at 9:43 AM, Edgar J. De Cleene <[hidden email]> wrote:



On 1/23/13 8:47 AM, "Mariano Martinez Peck" <[hidden email]> wrote:


On Wed, Jan 23, 2013 at 6:39 AM, Edgar J. De Cleene <[hidden email]> wrote:



On 1/23/13 6:25 AM, "Marcus Denker" <[hidden email]> wrote:

> Keep in mind that ReferenceStream is deprecated in 2.0
>
> The nice thing about Fuel is:
>
> -> Very much faster
> -> output more compact
> -> you can store *any* kind of objects.
>             (even the one you are sure you can't, like the Context (stack
> frame))
>
> Marcus

Yes , I know Fuel is a great advance, but he ask about simple thing.
And also I said Pharo 1.4 and not Pharo 2.0.

Thanks to Mariano and others , wish Fuel become Squeak citizen soon, for
Cuis guess should wait longer.


Edgar see new release: http://forum.world.st/ANN-Fuel-1-8-1-td4661609.html
Supported and tested images: 
Pharo 1.1.1, 1.1.2, 1.2, 1.3, 1.4, 2.0 
Squeak 4.1, 4.2, 4.3, 4.4 
 
Edgar


Mariano, yo se eso.
Pareciera que por tratar de ayudar a un nuevo con dos lineas de codigo estoy desconociendo tu trabajo y el de todos los demas que estan trabajando con Fuel.
No hay una unica receta, mis amigos de Pharo.

Edgar