dir

PHP __DIR__ evaluated runtime (late binding)?

烈酒焚心 提交于 2019-12-09 06:07:40
问题 Is it somehow possible to get the location of PHP file, evaluated at runtime? I am seeking something similar to the magic constant __DIR__ , but evaluated at runtime, as a late binding. Similar difference with self and static : __DIR__ ~ self ??? ~ static My goal is defining a method in an abstract class, using __DIR__ which would be evaluated respectively for each heir class. Example: abstract class Parent { protected function getDir() { // return __DIR__; // does not work return <<I need

Windows command line search for exact extension with dir

强颜欢笑 提交于 2019-12-09 04:35:59
问题 When I do a search: dir /b /s *.txt I get all files/folders with the extension .txt . But I also get them when they have an extension like .txtx . How can I search for the exact extension? 回答1: you can try this dir /s /b *.txt | findstr /v .txt. or dir /s /b *.txt | findstr /e .txt or dir /b *.txt | findstr .txt$ 回答2: I can't figure out why it behaves like this, but this works: dir /b /s .txt | findstr /e .txt . Ugly but works. 来源: https://stackoverflow.com/questions/2423935/windows-command

error moving file with shutil

北战南征 提交于 2019-12-08 10:21:39
问题 I am trying to create a simple function that finds files that begin with a certain string and then move them to a new directory but I keep getting the following kinds of errors from shutil "IOError: [Errno 2] No such file or directory: '18-1.pdf'", even though the file exists. import os import shutil def mv_files(current_dir,start): # start of file name start = str(start) # new directory ro move files in to new_dir = current_dir + "/chap_"+ start for _file in os.listdir(current_dir): # if

BDE administrator net dir

与世无争的帅哥 提交于 2019-12-08 05:11:47
问题 I am learning BDE adminstrator and I was wondering if there was a way to write a script/command(that i can run by double clicking) to add the net dir to a certain directory path ? I looked through the windows registry editor, and tried to find the net dir but it was not there. 回答1: The NET DIR setting is stored in the BDS configuration file. This file, by default, is named IDAPI.CFG and is stored in %PROGRAMFILES%\Borland\Borland Shared\BDE\IDAPI.CFG . It can be changed to a different name

cephfs kernel client针对dir的inode操作

删除回忆录丶 提交于 2019-12-07 14:02:24
cephfs kernel client针对dir的inode操作 const struct inode_operations ceph_dir_iops = { .lookup = ceph_lookup, .permission = ceph_permission, .getattr = ceph_getattr, .setattr = ceph_setattr, .setxattr = generic_setxattr, .getxattr = generic_getxattr, .listxattr = ceph_listxattr, .removexattr = generic_removexattr, .get_acl = ceph_get_acl, .set_acl = ceph_set_acl, .mknod = ceph_mknod, .symlink = ceph_symlink, .mkdir = ceph_mkdir, .link = ceph_link, .unlink = ceph_unlink, .rmdir = ceph_unlink, .rename = ceph_rename, .create = ceph_create, .atomic_open = ceph_atomic_open, }; ceph_lookup(struct inode

how to get the size of a dir programatically in linux?

匆匆过客 提交于 2019-12-07 04:13:50
问题 I want to get the exact size of a particular dir in linux through a C program. I tried using statfs(path,struct statfs &) but it doesn't give exact size. I also tried with stat() but it returns size as 4096 for any dir ! Please suggest me the way through which I can get the exact size of dir just like we get after "du -sh dirPath" command. Also I dont wanna use du through system(). Thanks in advance. 回答1: Typical Solution If you want the size of a directory, similar in fashion to du, create a

cephfs kernel client针对dir的file_operations操作

╄→尐↘猪︶ㄣ 提交于 2019-12-06 23:13:23
cephfs kernel client针对dir的file_operations操作 const struct file_operations ceph_dir_fops = { .read = ceph_read_dir, .iterate = ceph_readdir, .llseek = ceph_dir_llseek, .open = ceph_open, .release = ceph_release, .unlocked_ioctl = ceph_ioctl, .fsync = ceph_fsync, }; ceph_read_dir(struct file *file, char __user *buf, size_t size, loff_t *ppos) 只有在mount时带有参数-o dirstat时该函数才有效 |__调用ceph_test_mount_opt()函数检查mount options中是否包含DIRSTAT,若不包含则直接返回 |__若struct ceph_file_info中的dir_info为空 |__调用kmalloc()函数为dir_info分配空间 |__使用snprintf()函数向dir_info的内存空间进行格式化输出 |__调用copy_to_user()函数将dir_info中的内容复制到用户态空间buf中 ceph

BDE administrator net dir

元气小坏坏 提交于 2019-12-06 15:48:47
I am learning BDE adminstrator and I was wondering if there was a way to write a script/command(that i can run by double clicking) to add the net dir to a certain directory path ? I looked through the windows registry editor, and tried to find the net dir but it was not there. The NET DIR setting is stored in the BDS configuration file. This file, by default, is named IDAPI.CFG and is stored in %PROGRAMFILES%\Borland\Borland Shared\BDE\IDAPI.CFG . It can be changed to a different name and location by changing the registry at HKEY_LOCAL_MACHINE/Software/Borland/Database Engine/CONFIGFILE01 .

wordpress multisite remove /sites/{ID}/ automatic upload url

家住魔仙堡 提交于 2019-12-06 11:10:01
when using wp multisites it gets messed up pretty fast. Is there any solution available removing the automatic /sites/{id}/ folder structure? I'm able to adjust the site-upload-dir within site-settings but it always adds " /sites/{id}/ " to the uploaded file through the media-manager. Is there any snippet available removing/disabling these extra folder structure? First I ended up changing the core in wp-includes/functions.php in order to disable the addition: if ( defined( 'MULTISITE' ) ) $ms_dir = '/sites/' . get_current_blog_id(); else $ms_dir = '/' . get_current_blog_id(); And one line

JSF render dir=“rtl” when language is arabic

旧街凉风 提交于 2019-12-06 09:41:52
I want to render the text direction rtl (Right-To-Left) in an inputText when the browser's Accept-Language is arabic in my JSF application. When Accept-Language is english the text introduced by the user would be dir="ltr" (Left-To-Right). How can I do it? BalusC The client's Accept-Language is indirectly available via UIViewRoot#getLocale() . The UIViewRoot is in turn in EL available as #{view} . So, this should do: <h:inputText ... dir="#{view.locale.language eq 'ar' ? 'rtl' : 'ltr'}" /> Note that the dir is also supported on all other components and HTML elements, such as <h:form> and even