Deployment - PxYu/Hide-Seek GitHub Wiki
Database
First step is to set up the database. We need a mysql database with three tables. Script is:
-- keep each user profiles
CREATE TABLE users (
userID varchar(48) NOT NULL,
-- user's profile which is a json file converted to a string
profile MEDIUMTEXT,
PRIMARY KEY (userID)
);
-- keep each user's query history
CREATE TABLE queries (
-- actionID is a shorter version of session
actionID int NOT NULL,
sessionID int NOT NULL,
query varchar(100) NOT NULL,
topic varchar(100),
topicNo int,
-- (0: user query, 1: java program query, 2: python program query)
tag int NOT NULL,
userID varchar(48) NOT NULL,
time varchar(100) NOT NULL,
FOREIGN KEY (userID) REFERENCES users(userID)
);
-- keep each click, including users' and simulated ones
CREATE TABLE clicks (
userID varchar(48) NOT NULL,
url varchar(255) NOT NULL,
title varchar(255) NOT NULL,
query varchar(100) NOT NULL,
-- (1: user click, 0: simulation click)
tag int NOT NULL,
idx int NOT NULL,
time varchar(100) NOT NULL,
FOREIGN KEY (userID) REFERENCES users(userID)
);
Database name is not important, but I use "chrome" as does the servlet. If you decide to use some other name, make corresponding change in the servlet source code.
NN-based Query Generator:
One of the K cover queries will be generated by this neural network python flask program.
Source code of python program can be found: here.
Make sure you have python3 before running this program. After installing python3, run python3 source/pyserver.py
. If you are prompted that some packages are missing, install them via pip3. The only package that cannot be installed by pip3 is PyTorch. See this to find the best way to install it. For ubuntu system without CUDA support, the command should be
pip3 install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp35-cp35m-manylinux1_x86_64.whl
pip3 install torchvision
One other thing is that we need this program constantly running in the backend. So I recommend running this program with a terminal multiplexer like screen or tmux.
Intent-aware Query Generator Using ODP Tree
This Java servlet program is a tomcat web application, whose source code could be found: here. You will need to download the source code, make a few changes to adapt to local environment, rebuild the project and deploy it under hcdm server's tomcat. I use netbeans (IDE) to make this process easier.
A few changes
There are three .java
source files but you only need to change two of them.
Servlet.java
:
In String path = "/Users/Lucius/Documents/data";
has to be changed to a place where extra data file is stored. By the way, this folder is available here. Download this folder to your PC, upload it to hcdm server and point path
to that location. Make sure that location is accessible to the servlet. This could be the major reason if the program fails to work!
JDBC.java
:
In static final String DB_URL = "jdbc:mysql://localhost:3306/chrome?verifyServerCertificate=false&useSSL=true";
static final String USER = "xxx";
static final String PASS = "xxx";
These three lines need to be changed according to your mysql database configuration. Default port for mysql is 3306, but please make sure. If you change to database name while building the database, change to "chrome" to your new name.
In the getCover()
function near the bottom, String urlString = "http://120.77.42.144:8000/cover/?query=" + q;
has to be changed to the address of python program, presumably http://localhost:8000/cover/?query=
.
Rebuild the project
If you are using netbeans or other IDEs this should be automatic. When importing the source code into IDE, jar files to be included is in web/WEB-INF/lib/
, not build/web/WEB-INF/lib/
! After the rebuild, the .war
file is in dist
folder.
Chrome extension
The only one thing to change about the extension is in config.js
. Change localhost
to the address of hcdm server.
Some resources to download mentioned above, ICMYI.