iOS-Download sqlite file from server and overwrite previous one - ios

I'm new to the downloading process in iOS .. I would like to know how to download a file (.sqlite file) from server and overwrite the previous one which is already in the bundle.
Do I have to copy the old sqlite file to the app documents folder so that I can overwrite it? And if I copy it to the documents folder can anyone access it or is it protected?

Anything stored in the application bundle is read-only, so yes you will have to copy your .sqlite file into the Documents/ directory first. Then when you download a new version, you can overwrite the original version in the Documents/ directory.
And the Documents/ directory is part of the iOS application sandbox, so only your application will be able to read/write from/to here.

Related

Prepros 6 SFTP directory uploaded to wrong path

I have a directory upload issue in Prepros 6.1.1, with SFTP only.
This may be related to that question: Folders uploading in Prepros
The file upload is OK, but Prepros will create directories in the wrong path!
Example
I want to upload new-directory/new-file to /home/myuser/www/:
If new-directory exists on the server ; no problem, the file is uploaded in there.
If I upload a new file in a new directory ;
Prepros will create the directory in /home/myuser/home/myuser/www/new-directory,
then try to upload the file to /home/myuser/www/new-directory which doesn't exists…
Does anyone have found a workaround?
How is your FTP config?
Open FTP Settings and on Remote Path yout insert all the path to the directory you want. For example:
I want to upload a file to my test folder, then, on the remote path field, i will insert
/public_html/test/
This way all the files will be uploaded to this directory

In iOS app ,can i copy bundle resources to sandbox's tmp directory with XCode?

i want to copy some files to the app's tmp directory when the xcode package the app , so when the user install the app , the files is be put in the tmp directory already , but in xcode 's copy bundle resources , the files can't be copied to the tmp directy , is there anyway to achive this?
From your question, I understand that you're trying to make several files be put in the tmp directory at app install time.
Unfortunately, that is not possible. The iOS creates 3 containers upon an app installation as mentioned here.
Bundle Container: This is where the app gets installed
Data Container: Creates 3 separate folders where the app can store data
iCloud Container: Where iCloud specific data can be saved
Workaround
You can simply check every time the app launches to see if it's the first time the app launches and manually copy the files to your destination. You can use a Boolean in your app's NSUserDefaults to check whether the app was installed before.

Neo4j 3.0.1, proper way to restore backup by copying binary files (graph.db)

I am running neo4j v.3.0.1 and I want to restore an old backup (of another version of neo4j) by moving the old graph.db directory.
In my neo4j.conf I have:
# Paths of directories in the installation.
dbms.directories.data=/var/lib/neo4j/data
# Enable this to be able to upgrade a store from an older version.
dbms.allow_format_migration=true
If copy graph.db in /var/lib/neo4j/data, the restore does not work, but a new folder called graph.db is automatically created in /var/lib/neo4j/databases after I start the service.
If I copy the backup folder directly in /var/lib/neo4j/data/databases, the restore is successful. I do not understand why, since I set dbms.directories.data=/var/lib/neo4j/data
Am I doing something wrong?
The databases is implicitly appended to the dbms.directories.data path. That is a change in 3.0.

Cordova Write To WWW Directory (iOS)

I am trying to write a file to a directory within the WWW directory of my Cordova app.
Here is the situation:
My program saves an image to the temporary directory
I want the program to move the image from the temporary directory to the WWW directory, so that the file does not get deleted every time the app is initialized.
Is this possible?
Thanks.
No that's not possible. The WWW is sandboxed and therefore, you can't write anything inside of this folder. If you want to save a file you need to use the DOCUMENTS path and rely on the Cordova file plugin (PERSISTENT is the keyword)
https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md
You can also check the folder permissions here:
https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md#ios-file-system-layout
As you can see, www is read-only (not r/w)

Download and Open Compressed SQLite3 Database on Heroku

I have a script file for parsing through a SQLite database. I now need to create a CRON job that will download and unzip said database from a third-party (already hosting as SQLITE). I understand this can be done using WGET and UNZIP, but given Heroku's read only file system, is this possible entirely in memory? Thanks.
Heroku's file system is read-only but you can use the tmp and log directory from within your application folder.
From Heroku's doc:
There are two directories that are writeable: ./tmp and ./log (under your application root). If you wish to drop a file temporarily for the duration of the request, you can write to a filename like #{RAILS_ROOT}/tmp/myfile_#{Process.pid}. There is no guarantee that this file will be there on subsequent requests (although it might be), so this should not be used for any kind of permanent storage.

Resources