I want to programmatically read the contents of the /etc directory. If possible please reply with the code to achieve this.
/etc directory is a usual directory. Work with it as you usually do with any other one.
This is a simple application of opendir() and readdir() functions in C/C++ or their equivalents in Python, Perl or PHP. You will be able to see only files you have access to. It would help if you could explain what you want to accomplish.
The files in /etc are just ordinary files - you read them as you would any other files.
Understanding them on the other hand is more difficult - each file can have its own syntax, let alone attaching any meaning to the options within.
There is no special API for accessing the files in /etc.
Related
I'm doing a package manager for Pure Data externals in which the user may have the option to upload the created package in a repository.
Unfortunately, I was not able to find a good example from which i can develop a file uploader in tcl.
Can someone help me with an easy to understand code?
Something simple that only needs the file (given by path), url, name and password from the user.
Take a look at these Tcl Wiki pages about upload.
I'd like to set some specific options in idea.vmoptions and idea.properties for IntelliJ IDEA 14, but I don't have access to those files in C:\Program Files\... (yes, that's Windows, don't troll ;)
Is there a folder in %UserProfile% or an environment variable I could set to read those files (both vmoptions and properties!) from elsewhere?
Please don't suggest to copy the whole IDEA folder elsewhere, there's a reason why I can't access it. I would be interested in a Linux solution too, the same would most likely work on Windows.
My Research
For Mac there're specific instructions at Increasing Memory Heap, but for Linux and Windows it's just filename which are trivial to find out anyway.
I also found IntelliJ IDEA files locations, but it says can be modified in IDEA_HOME\bin\idea.properties which doesn't help since I can't access that file, but want to change properties in it.
Update: Simple Answer
Create IDEA_PROPERTIES and IDEA_VM_OPTIONS environment variables and point them to the files you want, restart IDE, done.
Also see documentation for more (and maybe report that it lacks any mention of IDEA_PROPERTIES).
You can use %USERPROFILE%\.IntelliJIdea14\idea%BITS%.exe.vmoptions on Windows as custom options file. I tried it and it works.
Another way that I haven't tried, but I think should work, is to copy idea.bat and edit it to use the file you need.
I have designed an app for MacOSX. Its function is to manipulate PDf files.
First the user would import files "in" the app.
After manipulating the files, the files are saved and kept in the library.
Actually, it is exactly the concept of Library of iTunes. You have files inside and you don't bother where they are located. It is better if the user do not have to select any folder in the system.
My question is : Where do I write my files on the disk?
I know I have to write it in a specific place but I can't figure out where. I tried in the App Bundle but I read somewhere we can not with sandboxing and indeed it didn't work.
I know I can write my preferences in my NSUserDefaults. Can I write any files there?
You can store the files in the application support directory. Use NSFileManager to locate it as described here: URLsForDirectory
And read the sandbox documentation for further details.
I have a few sketches I'd like to distribute together. All of them use a custom library which resides in the same folder. The current directory structure is totally flat. All .ino files are in a single folder, right next to the .cpp and .h files for the library. This makes it easy to distribute and update.
This would work perfectly, except that each time I open one of the sketches to upload, the Arduino IDE forces me to move it into a subfolder, then it can't find the custom library. Is there any way to disable this behavior, or can anyone suggest a workaround? Thanks!
I tried at first to do all flat and found it never ending battle. Rather than always working around that, I work with it. My example.
Where I have my local repo in some arbitrary location, then have symbolic links in the ./arduino/library/. directory pointing to them appropriate directories in the repo. In the example I have symbolic links for both SdFat and SFEMP3shield in the ./library/. directory. I use windows so rather than links (or the ln -s command) I use "hard junctions".
Note the libraries use a directory structure of ./ardunio/library/foo/example/bar/bar.ino. So I actually do all my projects in the ./example/bar/bar.ino sketch. Also its worth noting that I use an external editor (like notepad++).
This way my repo can have more or less of what I specify it to.
i want to edit my nagios cgi files but the keep opening as bin files. Does anyone know how to edit them or has anyone edited it before (nagios).
The reason i want to edit it is i want one of the pages to show columns instead of three, i checked the css but its not there.
Regards
Nagios config files are compiled into bin files. If you want to edit them you need to download the source, edit that, and compile again. Suggesting to the developers that the number, order, and type of columns seen be read from a config file might prove useful for the future.