directory

Load a file from src folder into a reader

余生长醉 提交于 2019-12-19 09:16:40
问题 I would like to know how can I load a file lol.txt from src folder into my close method. The code so far: public void close() throws IOException { boolean loadFromClasspath = true; String fileName = "..."; // provide an absolute path here to be sure that file is found BufferedReader reader = null; try { if (loadFromClasspath) { // loading from classpath // see the link above for more options InputStream in = getClass().getClassLoader().getResourceAsStream("lol.txt"); reader = new

PHP Determining the current url

白昼怎懂夜的黑 提交于 2019-12-19 08:54:56
问题 I need to modify my function to return also the current folder I am in. Here is my current function: function getLinkFromHost($url){ $port = $_SERVER['REMOTE_PORT']; $server = $_SERVER['HTTP_HOST']; if($port == 443){ $type = "https"; } else { $type = "http"; } return $type . "://" . $server . "/" . $url; } 回答1: Take a look at $_SERVER['REQUEST_URI'] or $_SERVER['SCRIPT_NAME'] (From the $_SERVER manual entry) 回答2: Here a short sweet function I've been using to do this for awhile now. function

How to get date/time when file was placed in a directory on Windows?

徘徊边缘 提交于 2019-12-19 08:26:47
问题 Is there a way to tell when a file was moved to a certain directory? I'm being asked why a script of mine did not find a file in a certain directory. The file was created last January but I suspect it was placed in the directory after the script was run. Is there a way for me to confirm my suspicion? Viewing the file properties gives me the created, modified, and accessed times, and the first two do not change when moving files from one directory to another. EDIT: I have cygwin installed, if

How does windows link html files to folders?

非 Y 不嫁゛ 提交于 2019-12-19 08:17:25
问题 Almost every time you save a web page from a web browser to your local computer a PAGENAME.html(htm) file is created and a folder named 'PAGENAME_files' that contains resources specific to that page. If you copy/move/delete either the folder or the .html file windows automatically does the same operation the other file as well. This behaviour also happens if you create a file named 1.html and a folder called 1_files. How does this link happen? And Why it works only with web files? Edit: For

Storing folder hierarchy in relational database

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 08:01:07
问题 I have objects representing folders and I'm wondering if they should be represented in the database. On the one hand it seems like the easiest way would be to not represent folder objects and just store a path value for objects contained in a folder. Problems I see with this is that you can't persist an folder whose descendants do not contain any items, which isn't too big of a deal. Also I don't have a clear idea of how to load the folder hierarchy to display (such as in a TreeView) without

Specifying a relative path

我怕爱的太早我们不能终老 提交于 2019-12-19 07:59:08
问题 I have a windows forms project. In the current directory I have a Help folder with *.chm files. What is the easiest way to launch them from the application? How can I specify the relative path to them? 回答1: You should use Help.ShowHelp to do this var chmFile = "CHM/test.chm"; Help.ShowHelp(ctrl, chmFile); by default ShowHelp will search file in the application path 回答2: The Environment.CurrentDirectory property will be set to the location of your .exe file. So if you place your help folder in

What is the Meteor server-side path to /public?

回眸只為那壹抹淺笑 提交于 2019-12-19 06:55:48
问题 On the Meteor client-side, I know that files in the project's public directory are referenced at '/'. How are they referenced on the server-side? I am trying to get a directory listing with fs.readdir, but I don't know how to construct the path to get to the server side equivalent of the client side '/images/gallery'. Any advice? 回答1: When I use the fs-module I just use './public' for my public folder, works fine on my local install. And then I set it to whatever's correct at the production

What is the Meteor server-side path to /public?

帅比萌擦擦* 提交于 2019-12-19 06:55:21
问题 On the Meteor client-side, I know that files in the project's public directory are referenced at '/'. How are they referenced on the server-side? I am trying to get a directory listing with fs.readdir, but I don't know how to construct the path to get to the server side equivalent of the client side '/images/gallery'. Any advice? 回答1: When I use the fs-module I just use './public' for my public folder, works fine on my local install. And then I set it to whatever's correct at the production

VulnHub靶场之Billu_b0x

一个人想着一个人 提交于 2019-12-19 06:19:10
VulnHub靶场之Billu_b0x emmm,好久没玩靶机实验了,今天玩一下!! 用vm打开靶机,把网络适配改为NAT,然后运行kali和靶机 首先肯定查看kali的ip地址,然后使用nmap命令: nmap -sP 192.168.80.0/24 扫描主机 找到了靶机的IP地址,接下来进行端口扫描 nmap命令: nmap -p 1-65535 -sV 192.168.80.129 开放了两个端口!!先不用管22端口,直接访问一下80端口: 进入到主页面得到一句提示sql注入???使用万能密码尝试登录结果失败,,, 只能先放弃,看后续是否没有思路再来继续刚,先信息收集!! 使用dirbuster和dirb两个一起爆破一下目录 dirbuster扫描结果: Dir found: /cgi-bin/ - 403 File found: /index.php - 200 Dir found: /icons/ - 403 File found: /c.php - 200 File found: /in.php - 200 File found: /show.php - 200 Dir found: /doc/ - 403 File found: /add.php - 200 File found: /test.php - 200 Dir found: /icons/small/ -

How to zip a folder and file in python?

社会主义新天地 提交于 2019-12-19 05:54:08
问题 I've got a folder called: 'files' which contains lots of jpg photographs. I've also got a file called 'temp.kml'. I want to create a KMZ file (basically a zip file) which contains the temp.kml file AND the files directory which has the photographs sitting inside it. Here is my code: zfName = 'simonsZip.kmz' foo = zipfile.ZipFile(zfName, 'w') foo.write("temp.kml") foo.close() os.remove("temp.kml") This creates the kmz file and puts the temp.kml inside. But I also want to put the folder called