Thanks Mariano and Cyrill for your answers. The reason for trying to make STON lighter is to use it as a document format for interactive notebooks. When I saved the notebooks nodes from the graphical interface their content become Text instead of strings and it generated a lot of format information with #runs, TextColor, and other information that was not necessary for the notebook and made the format heavy. I had problems trying to detect were the conversion from String to Text was taking place, so I added an extra message before serializing the notebook in STON that takes any node content and convert it from Text to String. After that I ended with notebooks that were 100 to 200 times smaller as was properly reported with the amazing commit message [1] :-) [1] https://twitter.com/offrayLC/status/712834911120572416 The next step is to made STON DVCS friendly by removing long lines [2] [2] http://forum.world.st/Citizen-example-for-manipulating-a-bibtex-file-tp47842... Cheers, Offray On 04/03/16 16:22, Mariano Martinez Peck wrote:
Not sure which is the reason of making it lighter, but you may also want to use a compressing stream so that the resulting stream is much smaller.
On Thu, Mar 3, 2016 at 2:03 PM, Cyril Ferlicot <cyril.ferlicot@gmail.com <mailto:cyril.ferlicot@gmail.com>> wrote:
HI,
There is a method in the class side of Object to override. This method return all the instVar name that need to be serialized. You can override it to store only the text.
For example:
Text class >>stonAllInstVarNames "Override to encode my instances using a custom set of instance variables or to define their order."
^ self allInstVarNames \ #runs
On Thu, Mar 3, 2016 at 5:55 PM, Offray Vladimir Luna Cárdenas <offray.luna@mutabit.com <mailto:offray.luna@mutabit.com>> wrote: > Hi, > > I'm using STON as my notebook storage file format for grafoscopio[1]. One > example of such notebooks is at [2], but they grow large easily. That's > because STON serialize a lot of information of each node. A snipped of such > info is something like [3], showed at the end of this mail. I remember that > someone told me about a way to store only the #string part of the Text node, > without any #runs or #values information in STON. How can this be done? > > Thanks, > > Offray > > Extra links and info: > > [1] http://mutabit.com/grafoscopio/index.en.html > [2] > http://mutabit.com/repos.fossil/grafoscopio/doc/tip/Docs/Es/Tutoriales/tutor... > > =[3][STON code sniped]======= > > GrafoscopioNode { > #header : 'Lección > 1: Bienvenida', > #headers : > OrderedCollection [ ], > #key : '', > #body : Text { > #string : > '\"Hola!, Soy el profesor Stef. Debes querer que te ayude a aprender > \rPharo. Asà que vamos a la primera lección: aprender a ejecutar código. > \rPara ello hay varias opciones:\r - Opción 1: Selecciona el texto debajo, > o coloca el cursor luego del punto, dale clic derecho y selecciona \'do it > (d)\'\r - Opción 2: Haz click en el botón con el Ãcono de play que aparece > justo cerca a la esquina superior\r derecha de este > panel\"\n\nPharoTutorial openPharoZenWorkspace \"no se qpoeadñl > aldskfjlasdf\"\r', > #runs : > RunArray { > > #runs : [ > > 421, > > 2, > > 13, > > 1, > > 21, > > 1, > > 1, > > 26, > > 1, > > 1, > > 1 > ], > > #values : [ > > [ > > TextColor { > > #color : Color { > > #rgb : 451328430, > > #alpha : 255 > > } > > }, > > TextFontChange { > > #fontNumber : 1 > > } > > ], > > [ > > TextColor { > > #color : Color { > > #rgb : 0, > > #cachedDepth : 32, > > #cachedBitPattern : Bitmap [ > > 4278190080 > > ], > > #alpha : 255 > > } > > }, > > @18 > > ], > > [ > > TextColor { > > #color : Color { > > #rgb : 512, > > #alpha : 255 > > } > > }, > > RubTextClassLink { > > #className : #PharoTutorial > > }, > > RubTextClassLink { > > #className : #PharoTutorial > > }, > > RubTextClassLink { > > #className : #PharoTutorial > > }, > > RubTextClassLink { > > #className : #PharoTutorial > > > > ================== >
-- Cheers Cyril Ferlicot
-- Mariano http://marianopeck.wordpress.com