pathname

jq: convert array to object indexed by filename?

好久不见. 提交于 2019-12-12 23:17:18
问题 Using jq how can I convert an array into object indexed by filename, or read multiple files into one object indexed by their filename? e.g. jq -s 'map(select(.roles[]? | contains ("mysql")))' -C dir/file1.json dir/file2.json This gives me the data I want, but I need to know which file they came from. So instead of [ { "roles": ["mysql"] }, { "roles": ["mysql", "php"] } ] for output, I want: { "file1": { "roles": ["mysql"] }, "file2": { "roles": ["mysql", "php"] } } I do want the ".json" file

How to search for files with a wildcard in Common Lisp?

爱⌒轻易说出口 提交于 2019-12-12 09:44:33
问题 I am not satisfied to find files matching a string like this: (remove-if-not (lambda (it) (search "wildcard" (namestring it))) (uiop:directory-files "./")) ;; I'll ignore case with str:contains? ;; https://github.com/vindarel/cl-str How would one search for files with unix-style wildcards ? If it is not built-in, I'd enjoy a solution with uiop. Maybe there is with Osicat or cl-fad (with which it doesn't seem so, the documentation oftentimes says "non-wild pathname"). Bonus if it is possible

c# How to get the file path from 'Open With'?

不羁的心 提交于 2019-12-11 07:54:52
问题 I'm making a text editor and I'm trying to make a code to get the file path of a file when it's open in a application using 'Open With'. Details : 'Open With' is an option when you right click on a file. The file then becomes a shortcut to the application. I have tried to use Process , but I couldn't seem to get the path from a file process. Question : In c#, how do you get the file path of a file when using 'Open With'? EDIT : Application path is C:\Users\Mayhem\Documents Text file path is C

Play sound file from within VBScript when msgbox appears

两盒软妹~` 提交于 2019-12-06 11:02:31
I am trying to play a sound file from within a VBScript when a certain msgbox appears. The only problem is that I will be sending this elsewhere and the person who receives it won't have the same pathname as the audio file that I want to play. I was thinking about putting all of the sound files that I want to use in the same folder as the script and then sending that folder, but I don't know how to make sure the sound file will play. So I guess the biggest question is how to generalize the pathname so that anyone can hear the file from within the script from any machine. Here is my code so far

Question about pathname encoding

三世轮回 提交于 2019-12-06 06:43:49
问题 What have I done to get such a strange encoding in this path-name? In my file manager (Dolphin) the path-name looks good. #!/usr/local/bin/perl use warnings; use 5.014; use utf8; use open qw( :encoding(UTF-8) :std ); use File::Find; use Devel::Peek; use Encode qw(decode); my $string; find( sub { $string = $File::Find::name }, 'Delibes, Léo' ); $string =~ s|Delibes,\ ||; $string =~ s|\..*\z||; my ( $s1, $s2 ) = split m|/|, $string, 2; say Dump $s1; say Dump $s2; # SV = PV(0x824b50) at 0x9346d8

How to search for files with a wildcard in Common Lisp?

余生颓废 提交于 2019-12-05 16:55:33
I am not satisfied to find files matching a string like this: (remove-if-not (lambda (it) (search "wildcard" (namestring it))) (uiop:directory-files "./")) ;; I'll ignore case with str:contains? ;; https://github.com/vindarel/cl-str How would one search for files with unix-style wildcards ? If it is not built-in, I'd enjoy a solution with uiop . Maybe there is with Osicat or cl-fad (with which it doesn't seem so, the documentation oftentimes says "non-wild pathname"). Bonus if it is possible to use the double wildcard to traverse directories recursively ( ./**/*.jpg ). edit : I have tried

Question about pathname encoding

妖精的绣舞 提交于 2019-12-04 10:29:16
What have I done to get such a strange encoding in this path-name? In my file manager (Dolphin) the path-name looks good. #!/usr/local/bin/perl use warnings; use 5.014; use utf8; use open qw( :encoding(UTF-8) :std ); use File::Find; use Devel::Peek; use Encode qw(decode); my $string; find( sub { $string = $File::Find::name }, 'Delibes, Léo' ); $string =~ s|Delibes,\ ||; $string =~ s|\..*\z||; my ( $s1, $s2 ) = split m|/|, $string, 2; say Dump $s1; say Dump $s2; # SV = PV(0x824b50) at 0x9346d8 # REFCNT = 1 # FLAGS = (PADMY,POK,pPOK,UTF8) # PV = 0x93da30 "L\303\251o"\0 [UTF8 "L\x{e9}o"] # CUR =

How to obtain a pathname or dentry or struct file from a given inode?

一曲冷凌霜 提交于 2019-12-01 23:18:09
问题 I need to know how to obtain a pathname or dentry or struct file from a given inode. I was using file_open to obtain struct file from a pathname but but always gave kernel panic. I need a way to compare an inode from my list of inodes with a inode from a pathname or compare all inodes in the disk to find corresponding pathnames, and then compare with my list of inodes. 回答1: This sample code will work well in Linux kernel version 2.6.xx struct dentry *sample_dentry = NULL; struct inode *tmp

How to obtain a pathname or dentry or struct file from a given inode?

人盡茶涼 提交于 2019-12-01 21:23:51
I need to know how to obtain a pathname or dentry or struct file from a given inode. I was using file_open to obtain struct file from a pathname but but always gave kernel panic. I need a way to compare an inode from my list of inodes with a inode from a pathname or compare all inodes in the disk to find corresponding pathnames, and then compare with my list of inodes. This sample code will work well in Linux kernel version 2.6.xx struct dentry *sample_dentry = NULL; struct inode *tmp_inode = &inode_need_to_get; struct list_head *tmp_list = NULL; list_for_each(tmp_list, &(tmp_inode->i_dentry))

Getting a mp3 file to play using javafx

a 夏天 提交于 2019-11-30 13:26:49
I have spent hours today looking up how to get some form of audio in eclipse and have had trouble every step of the way. Currently I have something that should work but I get an error: Exception in thread "main" java.lang.IllegalArgumentException: expected file name as argument at com.sun.javafx.css.parser.Css2Bin.main(Css2Bin.java:44) I have basically copied this from someone who had it working. I would like to say that the FX lib is added where it should be. I know this isn't fancy but I was just trying the basics. package b; import java.io.File; import javafx.scene.media.Media; import