Skip to content

Instantly share code, notes, and snippets.

/* ===================================================
* jQuery SelectAll plugin
* ===================================================
* @author: https://gist.github.com/Leegorous
* @license: Licensed under the Apache License, Version 2.0 (the "License"),
* see http://www.apache.org/licenses/LICENSE-2.0
* ===================================================
*
* Example:
*
@Leegorous
Leegorous / restlet-connection-timeout.java
Created June 16, 2013 08:03
If there are some requests you don't want to wait, just set the socket & connection timeout & no retry on error. Restlet 设置连接超时的方法。
Context ctx = new Context();
ctx.getParameters().add("socketTimeout", "200"); // http.socket.timeout
ctx.getParameters().add("socketConnectTimeoutMs", "100"); // http.connection.timeout
ClientResource client = new ClientResource(uri);
client.setNext(new Client(ctx, Protocol.HTTP));
client.setRetryOnError(false);
Representation entity = client.get();
# before run this script, run sudo ls, type your password
sudo mkdir -p /usr/lib/jvm
sudo tar xvzf ./jdk-7u21-linux-x64.tar.gz -C /usr/lib/jvm
cd /usr/lib/jvm
sudo mv jdk1.7.0_21 java-7-sun
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-7-sun/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-7-sun/bin/javac 300