I am trying to store 3d models in the .obj format into a database. I am using a mongodb database. How do approach this problem? do I convert it to binary or something?
Any help will be much appreciated.
Thanks
You do not store entire model in the database (mongodb or any other).
You just store the link to the .obj file on your server.
Similar thing as with the images, you just store url to them, not the entire object.
ID Name Url
0 dragon /models/dragon.obj
1 sponza /models/sponza_scene.obj
2 rabbit /models/rabbit.obj
...
If you for some reason need to store data directly into the database, take a look at this SO question.
Related
I have deep learning models (tensorflow in hdf5 format), which I want to upload to a PostgreSQL database.
A single model may be up to 500 MBs, and the models need to be updated and uploaded/downloaded from the database frequently (e.g., once every 30 mins).
I'm a begineer to PostgreSQL, so any information/receipes to start with would be appreciated.
Relation DB is a wrong tool for this. Store the link to an S3 bucket for example. Or your own private cloud if the model is private.
Storing large binary data in an relational DB is possible but unwise. Also, you have to eventually copy your model from the DB to the disk for TensorFlow to load anyway. Why not store your model directly on the disk?
I generated barcode and i need to save it in mysql database. I know there are 2 ways of storing it. 1. Insert image with the data type blob and another is we can achieve it by setting the path of the png file... My question is. Is there any other way to store barcode details in mysql database other than the above mentioned?
I'm using my app to import some PDF files.
But I'm trying to insert my PDF file int my database. I'm using Core Data. Is it possible to do this ? If it is, how can I do it ? Which kind of types I have to use (NSData, NSDocument, ... ?)
Thanks you so much! :)
To store a PDF (or really any big data blob):
Use the Core Data "binary" type for the attribute, which corresponds to NSData.
In your Core Data model, turn on "Allows External Storage" for the attribute so that Core Data can store the data outside of the persistent store.
It's often better to just write the PDF to a file, and store the filename in your persistent store instead of the whole file.
Usually for large files, i.e large images or pdf files, what you should save in core data is simply a reference to the file, and store the pdf in NSCachesDirectory or in a permanent directory, depending on your needs.
Hope that helps.
Currently I am working with the project in which I need to parse complex XML, which contains multilevel details (Name & Paths for PDFs, PNGs, etc) at each node.
I need to store all the data in local memory of iPhone/iPad.
Should I create classes for each of those details and make appropriate tables in SQLite or store the data as BLOB and retrieve all the data all the time?
Any Suggestions, thoughts are most welcome...
EDIT:
I am storing Files in DocumentsDirectory and path to SQLite database. Question is to create well defined database tables or to store data in BLOB form.
Pros and Cons for both approach would be much appreciated. Thanks.
in my opinion you should simply use BLOB : when you startup your app load you'r xml into an object all changes will be made to that object so you can win the time to rewrite back to disk
on exit application save all to disk..
Using of BLOB is not a good process .Store all pdf and images in Document directory..store that path only in DB...
Does anyone have any advice on using a datastore with mapkit to provide a database of locations (Restaurants) that are query-able by location?
I would like to use Core data but importing the information into it seems like a project in itself. If anyone has good advice on converting an existing sqlite/cvs file to a coredata sqlite file that would be appreciated.
Is old-fashioned sqlite better than using core data for the task, or is it a case that I should create a web service for the job?
I would like to be able to query the locations based on the map zoom also.
Thanks if you have any advice on the matter.
If you write your object model correctly, you can just point it at an existing sqLite database and it will read it as if core data generated it in the first place.
For example, suppose you have an existing sqlite db of people with columns like firstName, lastName, phone# etc. You just create a core data model with a entity with attributes of firstName, lastName, phone# etc. Spell them the same and make sure they have the right type and then point the NSPersistentStoreCoordinator at the existing database. It will read it in fine.
Core data is always the way to go for any larger data management task. It makes everything so much easier once you learn it.
Edit01:
Never mind the above. I was thinking of Enterprise Objects. Core data won't easily import most existing SQL.
Instead, I would export the sqlite to csv and then use something like cCSVParse to convert to plist. Then you can read it in easily to an array or dictionary and use that to populate the core data db.
That will work easily for db's that don't depend on complex relationships. I think the future benefits of having core data will eventually easily pay for the few man hours spent converting.