directory

How to change docker daemon root directory in CentOS7

こ雲淡風輕ζ 提交于 2019-12-21 04:58:21
问题 I am running docker in CentOS7. I'd like to change my basic directory from /var/lib/docker to /data/docker . I found this guide from official site, but do not know how to apply this to my case. I just make new daemon.json in /etc/docker/ . After that when I am trying to run daemon occurs an error. follow is systemctl status -l docker.service . ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)

HTML5 Canvas not working in external JavaScript file

独自空忆成欢 提交于 2019-12-21 04:42:06
问题 I have written this code in JavaScript and works perfectly fine when I include it on my index.html page: <canvas id="bannerCanvas" width="960" height="200"> Your browser does not support the canvas element. </canvas> <script type="text/javascript"> var canvas = document.getElementById("bannerCanvas"); var context = canvas.getContext("2d"); context.beginPath(); context.moveTo(25,25); context.lineTo(355,55); context.lineTo(355,125); context.lineTo(25,125); context.moveTo(465,25); context.fill()

Python: script's directory

白昼怎懂夜的黑 提交于 2019-12-21 04:33:10
问题 I was looking for a solution, but have not found what I need. Script path: /dir/to/script/script.py or C:\dir\script.py Excepted result: $ ./script.py output: /dir/to/script $ cd .. && ./script/script.py output: /dir/to/script Is there any function in os module or something? I mixed solutions and write: print os.path.abspath(os.path.dirname(__file__)) But it's ugly. Is there better way? 回答1: os.path.realpath will give you the result: os.path.dirname(os.path.realpath(__file__)) 来源: https:/

What is the fastest and most efficient way of storing and fetching images when you have millions of users on a LAMP server?

会有一股神秘感。 提交于 2019-12-21 04:26:33
问题 Here is the best method I have come up with so far and I would like to know if there is an even better method (I'm sure there is!) for storing and fetching millions of user images: In order to keep the directory sizes down and avoid having to make any additional calls to the DB, I am using nested directories that are calculated based on the User's unique ID as follows: $firstDir = './images'; $secondDir = floor($userID / 100000); $thirdDir = floor(substr($id, -5, 5) / 100); $fourthDir =

Monitoring directory for changes - potential high memory

淺唱寂寞╮ 提交于 2019-12-21 04:13:10
问题 I'm currently using a script in nodeJS to monitor a directory (and it's sub directories), and do some function once a file has been placed there. In reality, this would be an FTP, where users upload files, it is processed, then deleted. Obviously, i'm already seeing some high amount in CPU usage with the script, as it traverses over the directories, waiting for files to be visible. But what worries me is that the longer the script runs, the higher the memory usage (it just keeps rising

Drag and Drop a Folder from Windows Explorer to listBox in C#

若如初见. 提交于 2019-12-21 03:47:14
问题 I succeeded in developing C# code for drag files from windows explorer to listBox. // Drag and Drop Files to Listbox private void listBox1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop, false)) e.Effect = DragDropEffects.All; else e.Effect = DragDropEffects.None; } private void listBox1_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string fileName in files) { listBox1

How to query the permissions on an Oracle directory?

依然范特西╮ 提交于 2019-12-21 03:38:28
问题 I have a directory in all_directories, but I need to find out what permissions are associated with it, i.e. what has been granted on it? 回答1: This should give you the roles, users and permissions granted on a directory: SELECT * FROM all_tab_privs WHERE table_name = 'your_directory'; --> needs to be upper case And yes, it IS in the all_TAB_privs view ;-) A better name for that view would be something like "ALL_OBJECT_PRIVS", since it also includes PL/SQL objects and their execute permissions

can't delete file from external storage in android programmatically

这一生的挚爱 提交于 2019-12-21 03:34:35
问题 I am trying to delete a file located at the path /storage/714D-160A/Xender/image/Screenshot_commando.png What I've done so far: try{ String d_path = "/storage/714D-160A/Xender/image/Screenshot_commando.png"; File file = new File(d_path); file.delete(); }catch(Exception e){ e.printStackTrace(); } and the file is still at its place(Not deleted :( ) Also I've given permission in Manifest file. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android

Can I make RecursiveDirectoryIterator skip unreadable directories?

情到浓时终转凉″ 提交于 2019-12-21 03:31:23
问题 foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(".")) as $file) { echo "$file\n"; } Is there any way for this code to not throw UnexpectedValueException "failed to open dir: Permission denied" whenever there is a unreadable subdirectory inside directory I attempt to list? UPDATE Converting foreach() to while() and explicitly calling Iterator::next() wrapped in try() catch {} doesn't help. This code: $iter = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(".")

Finding the size of a directory

人走茶凉 提交于 2019-12-21 03:15:36
问题 I got this question in a Cisco interview: write a function to find the size of a directory? Following is the pseudocode for such a function, that follows a recursive approach. Please tell me if there can be any other approach also. int directorySize(DirectoryHandle dh) { int size=0; if (!dh) { DirectoryHandle dh1 = directoryOpen("Directory_path"); } else { dh1 = dh; } while (dh1) { if (TRUE=IsDirectory(dh1)) { size += directorysize(dh1); } else if (TRUE == IsFile(dh1)) { FileHandle fh = dh1;