Couchbase lite data storing path - couchbase-lite

I am using couchbase lite for my Windows application, I want to know the place where Document created by code are going to be stored.

As of 2018 you can specify the location of a database when you connect to it.
According to the docs:
The DatabaseConfiguration.Database property Gets or sets the directory to use when creating or opening the data.
So when you create the Database object, the constructor
"Creates a database with a given name and database configuration. If the configuration is null then the default configuration will be used. If the database does not yet exist, it will be created."
var database = new Database("mydb", new DatabaseConfiguration(){Database="mylocation/dbname"});
This is rough code but you get the idea.
If you do not specify a directory path when you create a db then it goes in a default directory in your local user space, for Windows this is explained in this SO page

The location is determined by the JavaContext you pass when you create a new Manager object.
The default is a subdirectory named "cblite", or you can pass a String arg when you create the JavaContext instance.
If the path you supply is not absolute, the location is relative to the working directory of the application.

Related

Where to save application data in windows?

I am trying to make a windows application. In this application, some files get modified as a user add or delete an entry. I saved these files on the application folder itself.
But After making binary file I installed it, As I try to add a entry it get crashed.
So, I figured out the issue. The windows doesn't allow to modified files inside C:\Program Files.
So, I installed it in other drive and it works. It solved my issue temporarily but I want to know how other application works in windows.
Where do those applications save their data?
I am not talking about some data which get saved in "Documents" but something which is essential need to modified every time user makes change like theme, formates.
No user access is allowed to the "program folder", and that's for good: it is a system folder, and it should only be accessed for system related operations (like installing or uninstalling a program).
There are many places where "program data" can be stored depending on the situation, and QStandardPaths provides access to their paths, according to the category location. What you might be interested in are:
ConfigLocation: Returns a directory location where user-specific configuration files should be written. This may be either a generic value or application-specific, and the returned path is never empty.
AppDataLocation: Returns a directory location where persistent application data can be stored. This is an application-specific directory.
AppLocalDataLocation: As the previous one, but Windows specific.
AppConfigLocation: Returns a directory location where user-specific configuration files should be written. This is an application-specific directory, and the returned path is never empty.
Those paths (along with the others listed in the documentation) can be accessed using the following static methods:
standardLocations(locationType): returns a list of paths for the requested location type, in order of priority (the first is usually the preferred one);
writableLocation(locationType): returns the preferred path for which write access is allowed (usually the first of the standardLocations());
If you need to store the user configuration, you can use QStandardPaths.writableLocation(AppConfigLocation), while if you have some user-specific internal data that is used by the application (email database, document templates, etc) QStandardPaths.writableLocation(AppLocalDataLocation) should be a good choice.
In both cases, those paths may not exist, so you need to ensure that and eventually create them, possibly by using QDir(path):
dataPath = QtCore.QStandardPaths.writableLocation(AppLocalDataLocation)
dataPathDir = QtCore.QDir(dataPath)
if not dataPathDir.exists():
# create the directory (including parent directories if they don't exist);
# that the argument of mkpath is relative to the QDir's object path, so
# using '.' means that it will create the actual dataPath
dataPathDir.mkpath('.')
Note that for all of the above (especially the last 3) it's required that you correctly set both the organizationName and the applicationName.

JHipster: H2 console not loading correct database?

I generated a web application using JHipster and added a few entities via the jhipster import-jdl command (e.g. Title). I added an entity instance of Title manually via the GUI and the list now shows that new entry. When I connect to the H2 database as role admin I do not see a table regarding the added entity but obviously it should be there. The JDBC url is jdbc:h2:file:./target/h2db/db/myapp and the folder contains a myapp.trace.db and myapp.mv.db file. The myapp.mv.db file seems to hold the actual database due to its file size.
What am I missing? The database tells me that there is no such table:
I didn't change any default settings such as database location. Why does it not display the added tables when the application clearly has them?

Hyperledger Composer "FROM" query language

The documentation for Query language (https://hyperledger.github.io/composer/reference/query-language.html) mentions the keyword FROM.
Is there an example on how/when to use FROM?
The FROM keyword allows the query to reference resources stored in a custom registry. By default assets of a given type are stored in a registry named with the same name as the fully qualified type name. Using FROM allows the developer to override this default behaviour.
For example, an application developer could choose to store some car assets in a registry called ImportedCars, separate from other cars.

Dynamically updating config data codeigniter

I have created my custom config file to store information about site such as if it is online or offline like-vice.
For that I have created new file in config folder and stores default values in global $config[] array with my own index.
I want to update these config data dynamically with admins control eg. he can select to put site in offline mode.
For that I have used function
$this->config->set_item('config_array_index','value_to_set');
but, I don't know why it is not working for me ?
I am not able to see any update in my config file. Also I am autoloading my config file.
Am I missing something?
Setting a config item only applies to the current session - it does not overwrite your actually codeigniter files.
If you want to permanetly take a site offline, your'll need some sort of persistant storage, such as a value in a database that is checked/updated as needed
you can create an empty config file, within your config directory , and then append your data to it using a functionality like fwrite ( you can check for some other CI function to use ).
and add it to your autoload file .

ColdFusion error after hosting transfer

I recently moved a ColdFusion site from one domain to the other with no issue (practically) besides one which I am having some trouble figuring out. I am a LAMP developer / designer and CF is a bit foreign to me so pardon my ignorance.
The site is working properly except for the store component, I am getting the following error "The .cart.models.store name is not a valid component or interface name.Component and interface names cannot be empty and cannot start or end with a period.". The only piece of code that I have changed throughout this process has been the config.ini, I changed the vmap=SitenameDev to vmap= as the notes in this file recommneded to do if the directory housing the site was the webroot directory.
Any insight on this error or common issues when transferring will be greatly appreciated, as always.
JN
FYI, the config.ini is something specific to the app you're dealing not a ColdFusion convention of any sort. Most likely the "vmap" entry therein means "virtual mapping". Its value is probably being used to resolve a path to an object (i.e. [value of vmap] + ".cart.models.store". With it empty, you're getting an error because ColdFusion wants its paths to not start with a period, and is unable to resolve the location of the file its looking for to create an object.
So previously this path was "SitenameDev.cart.models.store". What you need to do is figure out what directory houses the "cart\models\store" hierarchy. Then in the ColdFusion administrator setup a mapping to its parent directory - that is an alias to a physical directory that ColdFusion recognizes. Then whatever alias you choose should be set as the "vmap" value in the config.ini file.

Resources