save data in custom properties in a stack- or a text file?
Stephen Barncard
stephenREVOLUTION at barncard.com
Wed Aug 1 19:46:48 EDT 2007
there are so many ways and so many different solutions... all good.
No method is inherently 'easier'. You have to focus on what's best
for your user. Will this be used by many or just one person? Does it
need to travel with the app or does there need to be prefs for
multiple users?
Text Files
If you're on a Mac, there are even more solutions. On a recent
'quick app' binge for a friend, I came up with a solution for
configuration storage that still had to be editable by the user. And
stays with the app (for now).
So although it was created as a double clickable application,
option-clicking will reveal inside are more folders inside and those
folders are areas (where the rev binary and external stacks live)
where some data can be successfully written to by the app. In order
to not 'step on' the data I use the IDE and edit "inside" the
package, with the added benefit that I don't have to recompile the
standalone over and over and can test it immediately - and all the
paths are already in place.
Available by menu, the app calls an Applescript call "Reveal Folder"
and the client could take it from there and edit the little files
that my app needs for part of the input (already stamped with their
'creator' and 'type' tags by double clicking.I just saved having to
re-invent the wheel for a little used but needed feature in my quick
app. The files then get edited in TextEdit. And the little files
travel in the app with the client in her USB dongle.
specialfolderpath is good for multiple users at a workstation:
you can always call each platform's
specialfolderpath("preferences") and put a folder in there with your
app name and then put all sorts of files in there.
or if the user needs to get to the files sometimes specialfolderpath("docs")
or if it's part of a urgent workflow specialfolderpath("desktop")
Custom Props
Allow saving in a structured way, a hierarchy.
stack ----> card ------>property set----->property----> properties
lists inside of properties
It allows the clustering and associations one might get with files
and folders, but in a better way.
But all the statements I made about WHERE to save still applies to
stacks with custom properties as well as text files.
Text files, unless you use XML or some other method, are only one
dimensional, and one ends up using different kinds of delimiters to
keep the varied fields of data together in on file. Often faster to
develop.
sqb
>I know stacks are a nice way to save a lot of data because it can be
>organized by custom property and custom property set.
>
>But what about a simple list of data consisting of name, URL, and a
>couple other fields, that needs to be downloaded from a server-
>would you save the data in:
>
>A. a stack in custom properties?
>
>B. Or a text file?
>
>
>The information in this case will never get more complicated, though
>is remotely possible a data field or two might be added in the
>future. But the data will never evolve to be complex, it will always
>merely be a list of files.
>
>
>Here is my comparison:
>
>writing to/reading from: code must be written for both, text file a
>little easier
>
>entering/reading data manually: text file way easier
>
>encrypting: a tie
>
>adding data "fields": a tie, easy in either (you must think ahead)
>
>possible data corruption: a tie
>
>
>
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution
--
stephen barncard
s a n f r a n c i s c o
- - - - - - - - - - - -
More information about the use-livecode
mailing list