I have a vb.net application and in the startup folder I have an XML config file. I want to read the settings from this file, not from the user/app/ folder. Is there any way that i will define the application to read configuration from this file?
You really made a poor description of your problem;
You don't want to read a configuration file, you want to read an XML file. There are literally thousands of examples for that.
How to read an XML File
Related
how will I read Segment/index files which is stored inside a jar file using Apache Lucene. If files are kept in a folder then it works properly.But I have to read the file from a jar only.
There is no such functionality out of the box. To make this happen, you would need to implement o.a.l.store.Directory and feed it to the IndexReader.
Needless to say, performance for such a thing would suffer as effectively every change would have to be zipped/unzipped.
I am creating a Flowgear workflow that needs to process a raft of XML data.
I have the xml data contained in a set of .xml files (approximately 400 files) in a folder on my local machine hard-drive and I want to read them into a workflow, run an XSLT transform and then write out the resultant XML to another folder on the same local hard-drive.
How do I get the flowgear workflow to read these files?
It depends on the use case, the File Enumerator works exceptionally well to loop (as in for-each) through each file. Sometimes, one wants to get a list of files in a particular folder and check whether a file has been found or not. For this, I would recommend a c# script to get a list of files with code:
Directory.GetFiles(#"{FilePath}", "*.{extension}", SearchOption.TopDirectoryOnly);
Further on, use the File node to read, write, or delete files from a file directory.
NB! You will need to install a DropPoint on the PC/Server to allow access to the files. For more information regarding Drop Points, please click here
You can use a File Enumerator or File Watcher to read the files up. The difference is that a File Enumerator will enumerate all files in a folder once, the File Watcher will watch a folder indefinitely and provide new files to the workflow as they are copied into the folder.
You can then use the File node to write the files back the the file system.
I have a properties file located as below:
PROJECT.war/WEB-INF/lib/Utility.jar/myprops.properties
Is there a way to read the contents of this properties file?
All my attempts failed and I am able to read only till Utility.jar.
I have multiple console applications each one has an app.config file, this way is a little impractical because if I need to change the email server configuration I have to make the change in all the app.config files, I want to create a single configuration file or something similar so I can have all the configuration in a single place.
which is the best way to achive this? I was thinking in a xml file.
I have one way of doing it. First, you change your app.config file so that the appSettings is pulled from a separate file. Replace the entire appSettings section with the following :
<appSettings file="myappsettings.config"/>
Then you need to create the myappSettings.config file. You can create this new file anywhere. I keep it in the root of the Solution folder. Include everything that was in the appSettings section, including the opening and closing tags in the file.
Then, in each project, add the new myappsettings.config file as an existing item. It will link the new config file to your project and copy it to the project output at compile time.
When you need to change settings, just change the appSettings in myappsettings.config.
I want to create a .htaccess file in a specific directory. I'm using Notepad++ and their plug-in for FTP (NppFTP). I'm able to create any other files and see them in the folder but when I try to create a .htaccess I don't see that file in the directory. I get no errors, it is like nothing happened.
I tried to create this file using an FTP program and it showed the file and right away it disappeared. My guess it is because this is a special file used by the system and prefixed by a (.)
What is a way to edit that file?
This is probably because your ".htaccess" file is a hidden file and your system is set up to no display hidden files.
Have a look in your Notepad++ settings if there's an option to make hidden files visible/unhide.
In addition to that check the windows folder options for that option!
switch on showing hidden files in your ftp client