This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# start/stop subversion daemon. | |
test -f /usr/bin/svnserve || exit 0 | |
OPTIONS=”-d -r /svnroot” | |
case “$1″ in | |
start) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//validate string length | |
function ValidLen(s,min,max){ | |
if (s.length < min || s.length > max) { return false; } | |
return true; | |
} | |
// validate email | |
function ValidEmail(s){ | |
var check = /^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/; | |
if (!check.test(s)) { return false; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# Here is how to tell sudo not to ask for password... | |
visudo | |
# Or if you are an expert, then directly edit the file /etc/sudoers | |
vi /etc/sudoers | |
# Add this line to the end of the file (this should be the LAST line!!!)... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void createImage(OutputStream out) { | |
int width = 100; | |
int height = 100; | |
BufferedImage buffer = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB); | |
Graphics2D g = buffer.createGraphics(); | |
// set background: | |
g.setBackground(Color.BLUE); | |
g.clearRect(0, 0, width, height); | |
// set fore color: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//搭配 scale operator | |
Interpolation interp = Interpolation.getInstance(Interpolation.INTERP_BILINEAR); | |
//利用 ParameterBlock 物件儲存必要的 input Source 與 參數 | |
ParameterBlock params = new ParameterBlock(); | |
params.addSource(ri);//为RenderedImage对象或图像文件 | |
params.add(scale); // x scale factor | |
params.add(scale); // y scale factor | |
params.add(0.0F); // x translate | |
params.add(0.0F); // y translate | |
params.add(interp); // interpolation method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<security-constraint> | |
<web-resource-collection> | |
<web-resource-name>Forbidden</web-resource-name> | |
<url-pattern>/pages/*</url-pattern> | |
</web-resource-collection> | |
<auth-constraint/> | |
</security-constraint> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getLocalMAC() { | |
InetAddress address; | |
String sMAC = null; | |
try { | |
address = InetAddress.getLocalHost(); | |
NetworkInterface ni = NetworkInterface.getByInetAddress(address); | |
byte[] mac = ni.getHardwareAddress(); | |
Formatter formatter = new Formatter(); | |
for (int i = 0; i < mac.length; i++) { | |
sMAC = formatter.format(Locale.getDefault(), "%02X%s", mac[i], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=GBK" /> | |
<title>documentElement</title> | |
<style type="text/css"> | |
body{margin:0;padding:0;font:12px/150% arial;} | |
</style> | |
<script type="text/javascript"> | |
function a(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### file appender | |
log4j.appender.file=org.apache.log4j.RollingFileAppender | |
log4j.appender.file.maxFileSize=100KB | |
log4j.appender.file.maxBackupIndex=5 | |
log4j.appender.file.File=test.log | |
#NOTE: | |
log4j.appender.file.threshold=info | |
log4j.appender.file.layout=org.apache.log4j.PatternLayout | |
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" > | |
<log4j:configuration> | |
<appender name="file" | |
class="org.apache.log4j.RollingFileAppender"> | |
<param name="maxFileSize" value="100KB" /> | |
<param name="maxBackupIndex" value="5" /> | |
<param name="File" value="test.log" /> | |
<param name="threshold" value="info" /> | |
<layout class="org.apache.log4j.PatternLayout"> |
OlderNewer