Skip to content

Instantly share code, notes, and snippets.

View ulinkwo's full-sized avatar
:fishsticks:
Out sick

Kyle Liu ulinkwo

:fishsticks:
Out sick
View GitHub Profile
@ulinkwo
ulinkwo / mes-report
Created January 3, 2012 02:38
Maven POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.realtech.mes</groupId>
<artifactId>rt-mes-parent</artifactId>
<version>1.2-SNAPSHOT</version>
</parent>
@ulinkwo
ulinkwo / mes-parent
Created January 3, 2012 02:37
Maven Parent POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.realtech.mes</groupId>
<artifactId>rt-mes-parent</artifactId>
<version>1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>rt-mes parent module</name>
public class PipeTest {
public static void main(String[] args) throws java.io.IOException, java.lang.InterruptedException {
java.lang.Runtime rt = java.lang.Runtime.getRuntime();
// Start three processes: ps ax | grep rbe | grep JavaVM
java.lang.Process p1 = rt.exec("ps ax");
java.lang.Process p2 = rt.exec("grep rbe");
java.lang.Process p3 = rt.exec("grep JavaVM");
// Start piping
java.io.InputStream in = Piper.pipe(p1, p2, p3);
@ulinkwo
ulinkwo / svnserve
Created June 14, 2011 04:34
Howto: Start Subversion at Boot on Ubuntu
#!/bin/sh
# Step 1 – Create your script.
# Step 2 – Save the script in the /etc/init.d/ folder
# Step 3 – Make the script executable
# sudo chmod +x svnserve
# Step 4 – Add the script to the boot sequence
# sudo update-rc.d svnserve defaults
svnserve -d -r /usr/local/svn/repository_name
@ulinkwo
ulinkwo / log4j.xml
Created November 10, 2010 09:19
debugging messages to one file and other messages to another file. This can only be done with XML because we need a LevelRange filter.
<?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">
@ulinkwo
ulinkwo / log4j.properties
Created November 10, 2010 09:17
Log different level to different appender in log4j
### 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
<!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(){
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],
<security-constraint>
<web-resource-collection>
<web-resource-name>Forbidden</web-resource-name>
<url-pattern>/pages/*</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
//搭配 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