file-extension

File Extension to MIME Type Web Service?

拜拜、爱过 提交于 2019-12-02 19:35:01
Are there any web services which will allow me to provide a file extension and it would return a list of possible MIME types? For example: http://mimetype.com/getMime/doc Which could return: application/msword,application/docappl/text,application/vnd.msword,application/vnd.ms-word,application/winword,application/word,application/x-msw6,application/x-msword I don't want to use Urlmon.dll and I would prefer not having to keep my own list up-to-date. Thanks The only thing I could imagine would be parsing the list which comes with the apache server mime.types . The list is maintained by The Apache

Configure git to track only one file extension

血红的双手。 提交于 2019-12-02 17:12:44
I have one directory tree with many kind of different files. There are 300 directories on the parent directory. Each directory could have other sub directories. I only want to track *.cocci on all sub directories. Here is my .gitignore: * !*.cocci But it do not work, as the files on sub directories are not tracked. How can I tell git that I only want to track *.cocci on all sub directories? simont Read this question . You want: # Blacklist everything * # Whitelist all directories !*/ # Whitelist the file you're interested in. !*.cocci Note, this'll track only *.cocci files. Yours doesn't work

What is the difference between .m and .mat files in MATLAB

心已入冬 提交于 2019-12-02 15:46:04
When I traced my reference MATLAB script, I found files with the .mat extension. My questions are: What is the difference between .mat and .m files? How does one open files with the .mat extension? Files with a .m extension contain MATLAB code, either in the form of a script or a function . Files with a .mat extension contain MATLAB formatted data , and data can be loaded from or written to these files using the functions load and save , respectively. You can also access and change variables directly in MAT-files without loading them into memory using the function matfile . 来源: https:/

git grep by file extensions

六月ゝ 毕业季﹏ 提交于 2019-12-02 15:01:10
I know that, if I wanted to grep for a pattern only on files with certain extensions, I could do this: // searches recursively and matches case insensitively in only javascript files // for "res" from the current directory grep -iIr --include=*.js res ./ I've been trying to search for a way to do this via git grep as well (to take advantage of git grep's speed from the indexes it stores with its tree), but to no avail. I saw here that excluding certain file types is not possible. Yes, for example: git grep res -- '*.js' Try doing this : find . -type f -iname '*.js' -exec grep -i 'pattern' {} +

Associate a file extension with WPF application

半城伤御伤魂 提交于 2019-12-01 22:16:10
问题 I have a nice little assignment organizer that I want to add a backup option to. But I don't want it in an ordinary xml file or someother file because of the possibility of file corruption. So how can I make a file extension that the program knows and can save to and open with a .asog file extension? 回答1: Try this: How does Vista generate the icon for documents associated to my application? The accepted answer explains icons and file associations. It doesn't matter that your app uses WPF. The

Associate a file extension with WPF application

╄→гoц情女王★ 提交于 2019-12-01 22:12:22
I have a nice little assignment organizer that I want to add a backup option to. But I don't want it in an ordinary xml file or someother file because of the possibility of file corruption. So how can I make a file extension that the program knows and can save to and open with a .asog file extension? Cheeso Try this: How does Vista generate the icon for documents associated to my application? The accepted answer explains icons and file associations. It doesn't matter that your app uses WPF. The file associations don't care what GUI framework your app uses. v20100v If you want to associate a

How can I strip the file extension from a list full of filenames?

こ雲淡風輕ζ 提交于 2019-12-01 16:33:20
I am using the following to get a list with all the files inside a directory called tokens : import os accounts = next(os.walk("tokens/"))[2] Output: >>> print accounts ['.DS_Store', 'AmieZiel.py', 'BrookeGianunzio.py', 'FayPinkert.py', 'JoieTrevett.py', 'KaroleColinger.py', 'KatheleenCaban.py', 'LashondaRodger.py', 'LelaSchoenrock.py', 'LizetteWashko.py', 'NickoleHarteau.py'] I want to remove the extension .py from each item in this list. I managed to do it individually using os.path.splitext : >>> strip = os.path.splitext(accounts[1]) >>> print strip ('AmieZiel', '.py') >>> print strip[0]

How can I strip the file extension from a list full of filenames?

喜欢而已 提交于 2019-12-01 15:31:06
问题 I am using the following to get a list with all the files inside a directory called tokens : import os accounts = next(os.walk("tokens/"))[2] Output: >>> print accounts ['.DS_Store', 'AmieZiel.py', 'BrookeGianunzio.py', 'FayPinkert.py', 'JoieTrevett.py', 'KaroleColinger.py', 'KatheleenCaban.py', 'LashondaRodger.py', 'LelaSchoenrock.py', 'LizetteWashko.py', 'NickoleHarteau.py'] I want to remove the extension .py from each item in this list. I managed to do it individually using os.path

count number of files with a given extension in a directory - C++?

爱⌒轻易说出口 提交于 2019-12-01 10:19:26
问题 Is it possible in c++ to count the number of files with a given extension in a directory? I'm writing a program where it would be nice to do something like this (pseudo-code): if (file_extension == ".foo") num_files++; for (int i = 0; i < num_files; i++) // do something Obviously, this program is much more complex, but this should give you the general idea of what I'm trying to do. If this is not possible, just tell me. Thanks! 回答1: There is nothing in the C or C++ standards themselves about

Finding the preferred application for a given file extension via unix shell commands

时光毁灭记忆、已成空白 提交于 2019-12-01 10:11:18
this may not be strictly about programming, but if I find no ready-made solution it may become a programming task: On UNIX, what is a command-line method for determining the user-preferred application for a given filetype? My ideal solution here would be a command that stopped me having to do the following: okular foo.pdf And allowed me to do something like this, working with my set preferred applications: launch foo.pdf I found no answer by searching, and a DIY approach wouldn't work as, while I've been using Linux for a while, I have no clue of the internals that manage my preferred