This question is somewhat related to this.
I want to have document storage along with some complex metadata. I am not using sharepoint. I have a very simple directory structure that goes 2 levels deep. (One folder and documents underneath). I want to store metadata associated with each file....tags, popularity (# of times accessed), creator name, etc...
What is the best way to achieve this? I am leaning towards the relational database with the link to the file but I have to think this problem has been solved before.
Your approach sounds just fine to me. Just store the folder and filename as one of the columns values and all the other metadata in other columns.
Do you have any concerns about this approach? Or perhaps a specific part of this approach that you're not sure of how to implement?
Related
For example, there is an entity "book" with the attributes "title" and "description".
There are plenty books stored in the database. The information is stored in english. Now I'd like to publish this app in e.g. 10 different countries (10 different languages).
Is there any way to handle this with NSLocalized* or is it necessary to extend the database, that every stored entity must be created for each language?
I think when doing this with a Localizable file, it gets unbelievable huge and chaotic.
What is the best practice for this?
My first question is will this data change during the life of the app? If the answer is yes, then you will encounter issues with NSLocalized because you would have to update the app to include translated strings.
Otherwise, maintaining 10 different databases is a recipe for disaster. A few quick searches can cover this in agonizing detail.
Assuming then that the data will be static with each release, I would recommend that you take a different approach and create a single books.plist file that contains your data. This gives you the benefit of being able to localize the file, without the need to maintain a separate strings file to feed into your localization calls. Using this approach requires just one source of truth and supports your localization needs. Additionally, if you support copying it into the users documents directory, it can also be updated over time as your list evolves.
I want to organize my game files in the best way possible. Right now i'm organizing my data in three folders: /Document/Save/Stages , /Document/Save/Entites , /Document/Save/GameData. I'm using NSCoding and FileManager to store all data in these folders.
For performance, what's the best way to organize the saved files: Multiple folders, witch one with they own data or one single folder with all data?
Thx.
OBS: My english is't very good. Sorry for any mistakes
Not really a question with a set answer.
My preferred way is to have 1 singleton game data class with NSCoding to handle all the saving. Depends how much data you have and what needs to be saved. I dont think performance should be that different, its properly more of a choice of how you like to organise it.
If you like multiple folders than go for it.
Hi I would like to have some suggestion about the internazionalization of my app:
let's consider the app uses a DB to retrieve a set of question to propose to the user. Such questions should be translated in different languages.
I have considered two approaches:
One DB with the Table "Question". The table contains a column for each language I would like to support. (I dislike this approach since in the case i want to add in future new languages i should modify something already working)
More DB schema. Each DB schema is dedicated to a language seem better approach
Do you have any experience about the best solution to adopt?
do you have any other solution to suggest?
Thank you and kind regards
If you really want to keep the questions in a DB, I would recommend only storing keys used by NSLocalizedString macro, and the actual translations in dedicated localisation files (.string) - as #Adam Richardson suggested. This way you can update the individual translations (or add new ones) without touching the DB itself.
Hi due to a deeper research i have found this topic How to represent a localized string type in Core Data? i'm going to adopt the tecnique suggested as a solution.
kind regards
Nicolò
On the iOS filesystem, is there a way to optimize file access performance by using a tiered directory structure vs. a flat directory structure?
Specifically, my app has Objects that each contain a number of images and data files. A user could create thousands of these Objects and I need to optimize access to one image for ~100 arbitrary Objects at a time.
In this situation, how should I organize files on the filesystem? Would a tiered directory structure be faster than a flat one? And if so, how should I structure the tiered system (i.e. how many tiers, and how many subdirectories / files per tier)?
THANKS!
Well first of all you might as well try it with a flat structure to see if it is slow or not. Perhaps apple has put in code to optimize how files are found and you don't even need to worry about this. You can probably build out the whole app and just test how quickly it loads and see if that meets your requirements.
If you need to speed it up I would suggest trying to make some sort of structure based on the name of the file. You could have a folder which has all of the items beginning with the letter 'a' or 'b' and so on and so forth. This would split it into 26 folders which should significantly decrease the amount of items in each. Depending on how you name the files you might want a different scheme so that each of the folders had a similar amount of items in it
If you are using Core Data, you could always just enable the Allows External Storage option in the attribute of your model and let the system decide where it should go.
That would be a decent first step to see if the performance is ok.
MS's OneNote uses a data hierarchy that is essentially a simple tree, even though the info is displayed via a tabbed interface rather than a treeview. You begin with "notebooks," which can have "sections," which have "pages." I'm trying to model this. In my case, a page would be linked to the contents of a RichEdit.
My problem is not that I can't figure out a way to do this. My problem is that I am unsure which of several possibilities will ultimately be simplest. That's where I am hoping you will come in.
I could, for example, use a regular [MyBase] database. A Page dataset would have fields for its name, and the RichEdit data. Pages would be nested inside Sections, and Sections would be nested inside Notebooks.
If I thought about it for awhile, it seems like this is something that could be modeled with simple stringLists as well, especially if each element in the list included comma separate values for an ID and position in the hierarchy, as well as notebook/section/page name.
But then this also seems like something that might be well suited for XML ... if I were to learn more about XML :-)
What do you more experienced folks think?
Thanks, as always ...
Whether you go with a database or XML, try putting your data access routines in a datamodule. Let your GUI unit(s) make calls to public methods of the datamodule, and ensure that those calls do not depend on how your data are stored. That way, you can start with one approach, and switch to the other just by editing your datamodule.
One thing you could try would be to use a structured storage system. The concept is simple, you work with a datafile much like you would a disk and folders...thing is that the folders and files are all under your exclusive control. The only issue is that it doesn't exactly scale well to multiple users, but then neither does XML. (a good structured storage library is available on gabr's blog)
For a "multi-user" system, your best option will be to implement using tables. You can probably get a good start at things using Microsoft Access and ADO, which migrates to MS Sql Server very easily. From your brief description, I would expect you to have three tables, NOTEBOOKS, SECTIONS, PAGES. The Pages would have a Foreign key relationship (detail/master) to Sections and sections would have a Foreign key relationship with Notebooks.
If you are storing it in a file system, why not use.... folders? That's what OneNote does. A "notebook" and a "section group" are simply regular file system folders. The only other level is a section which is the .one file. There is a very limited hierarchy in there (it's just pages, any of which can be marked as subpages but these are not really linked in any way to a parent.)
Inside the .one file you can use XML to represent your pages, though this is not what OneNote does. OneNote uses a binary file format in order to facilitate fast edits, object-level synchronization, multi-user access, and compact storage.
If you look around for info about "random access files" you can get an idea for how to do this. But try to avoid using XML if you think it can get large because it will become cumbersome to make edits. You'd need to load the entire XML file, make changes in-memory, then write the whole thing back out again.
I think it depends on how you want to save the data. If you plant to use a database for shared access, speed and large amounts of data: just normalize the data and create the structure you proposed.
If you want the user to save data locally on a filesystem, I do think that XML will be a good solution because it allows you to store the data in a structured file.
So... how do you want the user to store and use the data?
I think at your data like a tree.
node {
id
parent_id
content
type
}
nodes with paren_id = 0 are notebook.
type is optional but could be useful.
content on page and notebook will give you a page/notebook description for free :D
I will use a simple table on sqlite or MyBase or whatever.
I think a little db is better than Xml because xml force you to load all data in memory.