Erlang - Standard location of mnesia database - erlang

Is there a standard place to put the mnesia database within erlang? At the moment I am putting it in the priv directory.

By default, Mnesia will create the schema in a subdirectory called Mnesia.<node name> of the current directory of the emulator process.
If that's not what you want, all you need to do is set Mnesia's dir application variable with something like
application:set_env(mnesia, dir, "/path/to/db").
As for where to place the database: that depends on your deployment scenario. Since application
variables can also be set using release config files or command line arguments, you can delay that
decision until you ship (or install on your own servers). For use in production, a standard directory like /var/lib/<your application>/mnesia-<node name>(on unix) should do.
For playing around, i'd recommend using a dedicated directory under the code root (NOT the priv directory) and setting that location within your application's startup section.
In my pet projects, i often use code such as
Root = filename:absname_join(filename:dirname(?FILE), ".."),
application:set_env(mnesia, dir, filename:join(Root, "db")).
for exactly that purpose.

As far as I know, when you create the schema every node creates a schema directory in its root directory.
Therefore, I guess that can be considered the default location.
If, for some reason, you have to include a schema together with your application, well, I guess the priv folder should be fine, since it is supposed to be used for application specific files and it's easily accessible via the code:priv_dir/1 function.

Related

How to prevent local msmpi installation from loading system wide msmpi.dll

I'm writing a console app for windows that sets up an environment and launches (popen) various hpc-apps using msmpi mpiexec.exe.
I have an msmpi installation installed locally to the application I'm writing. All works fine and parallel processing is OK.
However, as soon as I happen to have a system installation of msmpi as well (as installed by e.g. msmpisetup.exe), my applications stubbornly loads the Windows/system32/msmpi.dll instead of the msmpi.dll that I point at using PATH. Since the system msmpi.dll is of a different version, my apps does not run.
The PATH env.var. is set within my app, and it is apparently inherited correctly by the child processes, including mpiexec.
The only remedy I've found is to either (1) Rename system32/msmpi.dll or (2) place a copy of "my" msmpi.dll into every folder in which I have a parallel executable. Both remedies are... not nice.
How can I prevent my apps from selecting the system32/msmpi.dll and use the instance that's in the PATH instead??
Thank you for any advice.
N
The standard DLL search order in Windows is documented to be
The directory from which the application loaded.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The current directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.
If you want your application to check a specific location first before using the system locations, you can call SetDllDirectory in the parent application before letting it execute other binaries that require a particular DLL.

Unrecognized property 'CommType' in connection string using Advantage Data Provider with Entity Framework

I'm trying to set CommType in connection string for Advantage DataBase Server using Entity Framework 5 and Advantage Data Provider in a .NET Web Application.
Connection string is in properties.config file.
I trie to use ads.ini but I don't know where to put it (I try in wwwroot/site/bin but nothing happened)
I need to set this parameters:
RETRY_ADS_CONNECTS = 5
PACKET_SIZE=512
USE_TCP_IP = 1
I can do this whiteout errors, but not using properties.config file.
AdsConnection conn = new AdsConnection("data source=\\\\SERVER1\\DATA; ServerType=remote;TableType=CDX;CommType = TCP_IP");
Any clue about how to solve this? Using ADS.INI or properties.config file, same for me.
Thank you!
Gaston Brave.
You can use the ADS.INI file for this purpose. Where it needs to be located (or how to tell Advantage where to find it) depends on the OS you're using.
From the Advantage Help file topic ADS.INI:
Windows
In order for the ads.ini file to be used, it must be located in the application directory, the Windows directory, the Windows System directory, or the client's search path.
In addition, if an environment variable exists with the name adsini_path, that path will be used to locate the ads.ini file. This can be helpful when you do not want to modify the application’s search path, but still need the ads.ini file to exist in a directory multiple users have rights to (for example on Windows Vista installations). An application can often set the environment variable at run-time before calling any Advantage functions, which avoids the need to set a per-workstation environment variable.
Linux
In order for the ads.ini file to be used, it must be located in the application directory, a directory specified in an environment variable named ADSPATH, in the users home directory, or in the /etc directory. If located in the users home directory the ads.ini file should be named .ads.ini (note the initial "dot").

Custom houdini module path

I need to store Houdini *.hda files on a network share.
This folder needs to be sourced by all users.
Usually, for those kind of requests, I use an environment variable in ~/houdini17.0/houdini.env like for exemple:
HOUDINI_TEMP_DIR="/my/custom/temp/path"
But the issue is that I can find a solution for hda/otls files.
Adding it to HOUDINI_PATH="${HOUDINI_PATH};/my/custom/hda/path" or HOUDINI_OTLSCAN_PATH doesn't work and worst, it seems to break other links since a few other houdini nodes aren't available anymore.
Can someone point me to the right environnement variables?
Try using $HSITE and/or $JOB environment variables. Houdini will scan sub folders of the paths defined by $HSITE and $JOB for all relevant files and folders so you don't need to set a bunch of different env vars. You can mirror the folder structure found in C:\Users\username\Documents\houdini16.5
Obviously replace the Houdini version with yours. Also note that $HSITE needs to point the the folder that contains the houdini16.5 folder not the folder itself. This way you can support multiple houdini versions with a single env var.
http://www.sidefx.com/docs/houdini/basics/config.html
For example if $HSITE= //myNetworkShare/Houdini
You would need this folder structure:
//myNetworkShare/Houdini
/Houdini16.5
/otls
/scripts
/python2.7libs
/.....
Note you can only give $HSITE a single path.

Neo4j Load CSV without Local Admin privileges

I'm trying to evaluate Neo4j-Community-3.2.2 and my IT department installed the product for me in an area where I have no permissions. All I have seem to have is a running Service and the client interface through the browser. I have an immediate problem with LOAD CSV, but I anticipate others.
My current problem is that LOAD CSV seems to limit me to the Import folder under the database, which is in a protected location. I cannot copy files to the Neo4j import directory. I need to point the location to a folder I own.
I read in a different post that this is a security measure. So .. IF there is no way to address another folder, is there a configuration option that would let me work around. I can engage my IT department to edit / replace a config file, I think.
It would be best to implement a configuration setting to point to an entirely different Neo4j root. Any advice?
dbms.directories.import
Sets the root directory for file URLs used with the Cypher LOAD CSV
clause. This must be set to a single directory, restricting access to
only those files within that directory and its subdirectories.
So just point the full path to the directory in the neo4j.conf where you can place the files:
dbms.directories.import = /path/to/csv/import/directory
Note that the user under which the neo4j is started must have permission to read files from this directory.

Where to put data for an Erlang release to run

I used rebar to create a release for my Erlang application.
My application need to read data from a file. Normally, it is located in the directory where I start erl.
But when it comes to release, I don't know where can I put the data so as the application can access it. I tried to put the file in both rel/myrelease/bin and rel/myrelease/release/myverison but the log always show:
{{badmatch,{error,enoent}},
As explained in the application design principles documentation, normally you put application data into the application's priv directory, and your application code uses the code:priv_dir/1 function to locate its priv directory at runtime in order to find its data files.

Resources