directory

lucene中创建索引库

和自甴很熟 提交于 2020-01-15 01:57:18
package com.hope.lucene;import org.apache.commons.io.FileUtils;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.document.TextField;import org.apache.lucene.index.IndexWriter;import org.apache.lucene.index.IndexWriterConfig;import org.apache.lucene.store.Directory;import org.apache.lucene.store.FSDirectory;import org.junit.Test;import java.io.File;/** * @author newcityman * @date 2020/1/15 - 0:01 */public class LuceneFirst { @Test public void createIndex() throws Exception{ //1、创建一个Director对象,指定索引库保存的位置 //把索引库保存到磁盘 Directory directory =

Why does System.AppDomain.CurrentDomain.BaseDirectory return different results?

爷,独闯天下 提交于 2020-01-14 19:23:07
问题 I store the path of my database (a folder with some xml files) in the app.config. At the startup I check, if the path exists. If it doesn't exist, I want to set the path to the default path. Code looks like this: public void CheckAndRepairSettings() { /* Check Paths */ if(GetDatabasePath() == null) SetDatabasePath(System.AppDomain.CurrentDomain.BaseDirectory + "DataBase"); } GetDatabasePath() reads the path form the app.config and SetDatabasePath() writes the path to the app.config. These

How to scan a file in a different directory in java?

馋奶兔 提交于 2020-01-14 14:59:10
问题 How do you scan a file with java that isn't in the directory the java file is in? For example: The java file is located at "C:\Files\JavaFiles\test.java" However, the file I want to scan is located at "C:\Data\DataPacket99\data.txt" Note: I've already tried putting another java file in the "C:\Data" directory and using the test.java file as a class, but it doesn't work. It still tries to scan from the "C:\Files\JavaFiles" Directory. 回答1: By using an absolute path instead of a relative. File

How does the Call Directory Extension in iOS get updated

不羁的心 提交于 2020-01-14 13:51:30
问题 I have an app that I'm developing and I want to store a few thousand phone numbers using the Call Directory Extension of CallKit. What I'm confused about is, how and when does the extension get called? It doesn't seem like it happens with every phone call. Does it happen whenever the app is started? The reason I'm asking, I don't want to keep the thousands of phone numbers in my app. I don't want the user to see these phone numbers (unless of course, they get a call from one of them). So,

Create Folder that can not accessible by any other application

半腔热情 提交于 2020-01-14 05:25:12
问题 i want to create a one folder that can not accessible by any other application. Is it possible to do this ? If yes then give me the solution how to achieve this functionality. 回答1: Use internal storage like so: String FILENAME = "hello_file"; String string = "hello world!"; FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); fos.write(string.getBytes()); fos.close(); 回答2: Check out Using the Internal Storage to use the storage that is private to your app. 回答3: On the SD

How to set a password for a folder programmatically in android

喜欢而已 提交于 2020-01-14 02:45:26
问题 Is there a way to set a password for a folder programmatically? 回答1: The best solution I can think of is to do it like you do in java: An example in this link describes as follows: import java.io.*; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; public class FileLockTest { public static void main(String[] args) throws Exception { RandomAccessFile file = null; FileLock fileLock = null; try { file = new RandomAccessFile("FileToBeLocked", "rw"); FileChannel fileChannel

centos-5.5安装vmvare tools

偶尔善良 提交于 2020-01-14 01:21:58
centos-5.5安装vmvare tools 虚拟机管理,安装tools 找到VMwareTools压缩包 解压到Desktop,桌面 终端进入桌面 执行程序# ./vmware-install.pl 按回车一直下去,有人说是选分辨率,有人说是看到 To use the vmxnet driver, restart networking using the following commands: /etc/init.d/network stop rmmod pcnet32 rmmod vmxnet depmod -a modprobe vmxnet /etc/init.d/network start Enjoy, --the VMware team 出现以上,则基本安装完! shutdown -r now 重启 我看到的123选择分辨率,我选择了3, 1024*768 [root@rd01 ~]# cd /media [root@rd01 ~]# ls -a [root@rd01 ~]# cp VMwareTools-5.5.1-19175.tar.gz /tmp [root@rd01 ~]# cd /tmp [root@rd01 ~]# tar zxpf VMwareTools-5.5.1-19175.tar.gz [root@rd01 ~]# cd vmware-tools

Extract Directory Inside Zip

只愿长相守 提交于 2020-01-13 18:10:57
问题 I'm writing a script to extract files from a zip archive into the directory that the script is located. Here's my code: $zip = new ZipArchive; if ($zip->open('latest.zip') === TRUE) { $zip->extractTo('.'); $zip->close(); unlink('installer.php'); echo 'it works!'; } else { echo 'failed'; } This works fine, but there's one problem. The zip contains an extra layer. (zip/directory/files) which extracts like this directory/files rather then just the files. Is there a way to remove this extra layer

Safe way to remove a symbolic link to an non-existing directory (for the python binary)

若如初见. 提交于 2020-01-13 17:54:53
问题 I accidentally typed: sudo ln -sf /usr/local/bin/python2.5/ /usr/bin/python instead of: sudo ln -sf /usr/local/bin/python2.5 /usr/bin/python Now bash tells me that /usr/bin/python is not a directory whenever I run python. ls -l /usr/bin/python gives me expectedly /usr/bin/python --> /usr/local/bin/python2.5/ Is there any safe way to remove that symbolic link to a directory (that does not exist) and replace it with a link to the intended file? Arigato in advance if you have any ideas. I am

Python Module Importing Issues

天大地大妈咪最大 提交于 2020-01-13 16:55:29
问题 I run Windows 7, and I can import built-in modules, but when I save my own script and try to import it in IDLE, I get an error saying that the module doesn't exist. I use the Python text editor found by clicking "File" and "New Window" from the Python Shell. I save it as a .py file within a Module folder I created within the Python directory. However, whenever i type import module_name in IDLE, it says that the module doesn't exist. What am I doing wrong, or not doing? I've tried import