Button to Move/Rename a page – MindTouch Community Portal
Button to Move/Rename a page
Button to Move/Rename a page – MindTouch Community Portal
Button to Move/Rename a page
CreatingGraphs
How to create new templates or graph
Introduction
This
document explains how to create Cacti templates simply and reliably.
For this example, we’ll assume you are going to add a new set of graphs
into the ss_get_by_ssh.php file. This means you’re going to write a
command to SSH to a server and collect some data, parsing code to turn
that into a list of named values to graph, and graphs to display the
result.This example will show a fairly complex set of graphs.
If you understand the example, you should be ready to create quite
complex graphs yourself. We’re going to collect data from
/proc/diskstats on Linux and graph it.
Supported Plugins
486的 大丈夫週記: 舊屋 中古屋 整修前必須知道的。 – yam天空部落
舊屋 中古屋 整修前必須知道的。以文找文
Chapter 21 – Using Automatic Configuration and Automatic Proxy
Using Automatic Configuration and Automatic Proxy
Connect through a Proxy – Real’s Java How-to
Connect through a Proxy
The Networking Properties
You have to set the following properties :http.proxyHost (default: )
http.proxyPort (default: 80 if http.proxyHost specified)
http.nonProxyHosts (default: )NOTE: proxyHost, proxyPort are deprecated. you have to prefix them with “http.".
NOTE: Those properties are documented here : http://java.sun.com/javase/6/docs/technotes/guides/net/properties.html.You can set the required properties when starting the JVM for a JAVA application from the command line:
java -Dhttp.proxyHost=myproxyserver.com -Dhttp.proxyPort=80 MyJavaApp
Or in your source :
System.setProperty(“http.proxyHost", “myProxyServer.com");
System.setProperty(“http.proxyPort", “80″);Since Java 1.5 you can also pass a java.net.Proxy instance to the openConnection() method:
//Proxy instance, proxy ip = 123.0.0.1 with port 8080
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(“123.0.0.1″, 8080));
URL url = new URL(“http://www.yahoo.com");
HttpURLConnection uc = (HttpURLConnection)url.openConnection(proxy);
uc.connect();String page;
StringBuffer tmp = new StringBuffer();
BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));
while ((line = in.readLine()) != null){
page.append(line + “\n");
}
System.out.println(page);so you don’t need to set system properties.
You can use the default PROXY as defined by your networking settings.
System.setProperty(“java.net.useSystemProxies", “true");
List l = null;
try {
l = ProxySelector.getDefault().select(new URI(“http://www.yahoo.com"));
}
catch (URISyntaxException e) {
e.printStackTrace();
}if (l != null) {
for (Iterator iter = l.iterator(); iter.hasNext() {
java.net.Proxy proxy = (java.net.Proxy) iter.next();
System.out.println(“proxy hostname : " + proxy.type());
InetSocketAddress addr = (InetSocketAddress) proxy.address();
if (addr == null) {
System.out.println(“No Proxy");
}
else {
System.out.println(“proxy hostname : " + addr.getHostName());
System.out.println(“proxy port : " + addr.getPort());
}
}
}To bypass the PROXY,
URL url = new URL(“http://internal.server.local/");
URLConnection conn = url.openConnection(Proxy.NO_PROXY);Proxy and Username/Password
You might need to identify yourself to the proxy server.
One way is to use the HTTP property “Proxy-Authorization" with a username:password base64 encoded.
System.setProperty(“http.proxyHost", “myProxyServer.com");
System.setProperty(“http.proxyPort", “80″);
URL url=new URL(“http://someserver/somepage");
URLConnection uc = url.openConnection ();
String encoded = new String
(Base64.base64Encode(new String(“username:password").getBytes()));
uc.setRequestProperty(“Proxy-Authorization", “Basic " + encoded);
uc.connect();NOTE: For a base64 function, see this How-to. The following example dumps the content of a URL but before we identify ourself to the proxy.
import java.net.*;
import java.io.*;public class URLUtils {
public static void main(String s[]) {
URLUtils.dump(“http://www.yahoo.com");
System.out.println(“**************");
URLUtils.dump(“https://www.paypal.com");
System.out.println(“**************");
}public static void dump(String URLName){
try {
DataInputStream di = null;
FileOutputStream fo = null;
byte [] b = new byte[1];// PROXY
System.setProperty(“http.proxyHost","proxy.mydomain.local") ;
System.setProperty(“http.proxyPort", “80″) ;URL u = new URL(URLName);
HttpURLConnection con = (HttpURLConnection) u.openConnection();
//
// it’s not the greatest idea to use a sun.misc.* class
// Sun strongly advises not to use them since they can
// change or go away in a future release so beware.
//
sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
String encodedUserPwd =
encoder.encode(“mydomain\\MYUSER:MYPASSWORD".getBytes());
con.setRequestProperty
(“Proxy-Authorization", “Basic " + encodedUserPwd);
// PROXY ———-di = new DataInputStream(con.getInputStream());
while(-1 != di.read(b,0,1)) {
System.out.print(new String(b));
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}With JDK1.2, the java.net.Authenticator can be used to send the credentials when needed.
public static void dump(String URLName){
try {
DataInputStream di = null;
FileOutputStream fo = null;
byte [] b = new byte[1];// PROXY
System.setProperty(“http.proxyHost","proxy.mydomain.local") ;
System.setProperty(“http.proxyPort", “80″) ;Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new
PasswordAuthentication(“mydomain\\username","password".toCharArray());
}});URL u = new URL(URLName);
HttpURLConnection con = (HttpURLConnection) u.openConnection();
di = new DataInputStream(con.getInputStream());
while(-1 != di.read(b,0,1)) {
System.out.print(new String(b));
}
}
catch (Exception e) {
e.printStackTrace();
}
}Bypass a Proxy
In intranet environment, you may need to bypass the proxy server and go directly to the http server.
The http.nonProxyHosts property indicates the hosts which should be connected too directly and not through the proxy server. The value can be a list of hosts, each seperated by a |, and in addition a wildcard character (*) can be used for matching.
java.exe
-Dhttp.nonProxyHosts="*.mycompany.com|*.mycompany.local|localhost"
MyClass
[LifeType] WordPress To Lifetype | 墨嗓的資訊筆記
前陣子幫一個朋友的網誌從WordPress平台轉換到LifeType平台,在網路上找到的資料大多都是由LifeType轉換到Wordpress的資料,幾乎很少看到由WordPress轉換到Lifetype的資訊,而且目前Lifetype並沒有提供WordPress資料匯入的功能,只能手工透過資料庫轉換來達到轉換,所以在這邊就順手做一下紀錄:(以Lifetype 1.2.8 及WordPress 2.7.1為例)