Thursday, August 8, 2013

Proxy Settings in Linux command line

Proxy Setting commands on Linux  Console :

Example:1 Access http base sites via proxy , use below variable

# export http_proxy=http://:

# export http_proxy=

Example:2 Password Protect Proxy Settings

# export http_proxy=http://USERNAME:PASSWORD@:PORT

# export http_proxy=http://nsit:*****

Using Above  Command we have set the proxy setting along with user name and password.

Example:3 To access secure sites(https) via proxy , set below variable

#  export https_proxy=http://:

# export https_proxy=

Example:4 To access ftp based sites via Proxy , set the below variable

# export ftp_proxy=http://:

# export ftp_proxy=

Note : As these variables are declared for the particular session , to set it permanently , define these variables in the file “/etc/bash.bashrc”

export http_proxy=
export ftp_proxy=

Example:5   Proxy Settings in APT  on Ubuntu Linux

# Vi /etc/apt/apt.conf

Acquire::http::Proxy "http://:";

Example:6  Proxy Settings for RSYNC

# export RSYNC_PROXY="http://:

# export RSYNC_PROXY="”

Taken From here

Calling Neo4j query Using Rest Interface Sample code

The following code can be used to query Neo4j using REST interface.
I have used HttpClient 4.2 . Please download and include it in the project.

static String readURL(){
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("http://scim-dev:7474/db/data/cypher");
try {
post.setHeader("Accept", "application/json");
post.setHeader("Content-Type", "application/json");
StringEntity entity = new StringEntity(
"{\n  \"query\" : \"Your Query Here",\n  \"params\" : {\n  }\n}");

HttpResponse response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
StringBuffer buff= new StringBuffer(line);
while ((line = rd.readLine()) != null) {
return buff.toString();
} catch (IOException e) {
return "";