MIME type for a directory

On Ubuntu, a directory mimetype is inode/directory If you run, on Ubuntu: $ mimetype /home/<your username> /home/<your username>: inode/directory There is a “text/directory” in the IANA standards (http://www.rfc-editor.org/rfc/rfc2425.txt and http://www.iana.org/assignments/media-types/text) but it was marked “deprecated”.

Iterate through folders, then subfolders and print filenames with path to text file

Charles’ answer is good, but can be improved upon to increase speed and efficiency. Each item produced by os.walk() (See docs) is a tuple of three items. Those items are: The working directory A list of strings naming any sub-directories present in the working directory A list of files present in the working directory Knowing … Read more

How to make g++ search for header files in a specific directory?

A/code.cpp #include <B/file.hpp> A/a/code2.cpp #include <B/file.hpp> Compile using: g++ -I /your/source/root /your/source/root/A/code.cpp g++ -I /your/source/root /your/source/root/A/a/code2.cpp Edit: You can use environment variables to change the path g++ looks for header files. From man page: Some additional environments variables affect the behavior of the preprocessor. CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH Each variable’s value is a list of … Read more

How do I find where ElasticSearch is installing my plugins?

To find your elasticsearch home directory & install plugin(s) follow these steps below. Locate your home directory ( Look for Settings -> Path -> Home for value ) $ curl “localhost:9200/_nodes/settings?pretty=true” Goto Location (Example settings.path.home value: /usr/local/Cellar/elasticsearch/1.5.0) $ cd /usr/local/Cellar/elasticsearch/1.5.0 Install Plugin (Example plugin: mobz/elasticsearch-head) $ bin/plugin -install mobz/elasticsearch-head

JavaFX FileChooser and DirectoryChooser

A FileChooser is available as part of the JavaFX API. Example usage from javadoc: FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(“Open Resource File”); fileChooser.getExtensionFilters().addAll( new ExtensionFilter(“Text Files”, “*.txt”), new ExtensionFilter(“Image Files”, “*.png”, “*.jpg”, “*.gif”), new ExtensionFilter(“Audio Files”, “*.wav”, “*.mp3”, “*.aac”), new ExtensionFilter(“All Files”, “*.*”)); File selectedFile = fileChooser.showOpenDialog(mainStage); if (selectedFile != null) { mainStage.display(selectedFile); } A … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)