??xml version="1.0" encoding="utf-8" standalone="yes"?>
<groupId>net.blogjava.prometheus</groupId>
<artifactId>prometheus</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>prometheus</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
projectQpom.xml的顶U元?br>modelVersionQ指明了POM正在使用的对象模型的版本。这个版本号极少改变?br>groupIdQ指明了创徏工程者的唯一标识W。一般来说基于工E创的域名Q例如net.blogjava.prometheus?br>artifactIdQ指明了工程生成的artifact的唯一基础名称QMaven最后生的artifact是这样一个格式:<artifactId><version>.<extension>Q比如prometheus-1.0-SNAPSHOT.jar?br>packagingQ指明了当前artifact打包的格式(warQjarQear{)
versionQ指明了工程产生的artifact的版本。SNAPSHOT表明当前版本正处于开发状态?br>nameQ指明了工程的显C名U?br>urlQ指明了工程的web site位于何处?br>
]]>
匚w双字节字W?包括汉字在内)Q[^\x00-\xff]
匚wI的正则表辑ּQ\n[\s| ]*\r
匚wHTML标记的正则表辑ּQ?<(.*)>.*<\/\1>|<(.*) \/>/
匚w首尾I格的正则表辑ּQ?^\s*)|(\s*$)
匚wIP地址的正则表辑ּQ?\d+)\.(\d+)\.(\d+)\.(\d+)/
匚wEmail地址的正则表辑ּQ\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
匚w|址URL的正则表辑ּQhttp://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
Field Name | Allowed Values | Allowed Special Characters | ||
---|---|---|---|---|
Seconds
|
0-59
|
, - * /
|
||
Minutes
|
0-59
|
, - * /
|
||
Hours
|
0-23
|
, - * /
|
||
Day-of-month
|
1-31
|
, - * ? / L W C
|
||
Month
|
1-12 or JAN-DEC
|
, - * /
|
||
Day-of-Week
|
1-7 or SUN-SAT
|
, - * ? / L #
|
||
Year (Optional)
|
empty, 1970-2099
|
, - * /
|
The '*' character is used to specify all values. For example, "*" in the minute field means "every minute".
The '?' character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'. This is useful when you need to specify something in one of the two fileds, but not the other.
The '-' character is used to specify ranges For example "10-12" in the hour field means "the hours 10, 11 and 12".
The ',' character is used to specify additional values. For example "MON,WED,FRI" in the day-of-week field means "the days Monday, Wednesday, and Friday".
The '/' character is used to specify increments. For example "0/15" in the seconds field means "the seconds 0, 15, 30, and 45". And "5/15" in the seconds field means "the seconds 5, 20, 35, and 50". Specifying '*' before the '/' is equivalent to specifying 0 is the value to start with. Essentially, for each field in the expression, there is a set of numbers that can be turned on or off. For seconds and minutes, the numbers range from 0 to 59. For hours 0 to 23, for days of the month 0 to 31, and for months 1 to 12. The "/" character simply helps you turn on every "nth" value in the given set. Thus "7/6" in the month field only turns on month "7", it does NOT mean every 6th month, please note that subtlety.
The 'L' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "last", but it has different meaning in each of the two fields. For example, the value "L" in the day-of-month field means "the last day of the month" - day 31 for January, day 28 for February on non-leap years. If used in the day-of-week field by itself, it simply means "7" or "SAT". But if used in the day-of-week field after another value, it means "the last xxx day of the month" - for example "6L" means "the last friday of the month". When using the 'L' option, it is important not to specify lists, or ranges of values, as you'll get confusing results.
The 'W' character is allowed for the day-of-month field. This character is used to specify the weekday (Monday-Friday) nearest the given day. As an example, if you were to specify "15W" as the value for the day-of-month field, the meaning is: "the nearest weekday to the 15th of the month". So if the 15th is a Saturday, the trigger will fire on Friday the 14th. If the 15th is a Sunday, the trigger will fire on Monday the 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. However if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not 'jump' over the boundary of a month's days. The 'W' character can only be specified when the day-of-month is a single day, not a range or list of days.
The 'L' and 'W' characters can also be combined for the day-of-month expression to yield 'LW', which translates to "last weekday of the month".
The '#' character is allowed for the day-of-week field. This character is used to specify "the nth" XXX day of the month. For example, the value of "6#3" in the day-of-week field means the third Friday of the month (day 6 = Friday and "#3" = the 3rd one in the month). Other examples: "2#1" = the first Monday of the month and "4#5" = the fifth Wednesday of the month. Note that if you specify "#5" and there is not 5 of the given day-of-week in the month, then no firing will occur that month.
The legal characters and the names of months and days of the week are not case sensitive.
java.lang.Class klass = Myclass.class;
log(java.lang.String.class.getClassLoader());
protected synchronized Class<?> loadClass
(String name, boolean resolve)
throws ClassNotFoundException{
// First check if the class is already loaded
Class c = findLoadedClass(name);
if (c == null) {
try {
if (parent != null) {
c = parent.loadClass(name, false);
} else {
c = findBootstrapClass0(name);
}
} catch (ClassNotFoundException e) {
// If still not found, then invoke
// findClass to find the class.
c = findClass(name);
}
}
if (resolve) {
resolveClass(c);
}
return c;
}
public class MyClassLoader extends ClassLoader{
public MyClassLoader(){
super(MyClassLoader.class.getClassLoader());
}
}
public class MyClassLoader extends ClassLoader{
public MyClassLoader(){
super(getClass().getClassLoader());
}
}
protected Class<?> findClass(String name)
throws ClassNotFoundException {
throw new ClassNotFoundException(name);
}
Target target3 = (Target) target2;
public void fx(){
log("this = " + this + "; Version.fx(1).");
}
static{
log("client.TaskImpl.class.getClassLoader
(v1) : " + TaskImpl.class.getClassLoader());
}
public void execute(){
log("this = " + this + "; execute(1)");
}
public byte[] findClassBytes(String className){
try{
String pathName = currentRoot +
File.separatorChar + className.
replace('.', File.separatorChar)
+ ".class";
FileInputStream inFile = new
FileInputStream(pathName);
byte[] classBytes = new
byte[inFile.available()];
inFile.read(classBytes);
return classBytes;
}
catch (java.io.IOException ioEx){
return null;
}
}
public Class findClass(String name)throws
ClassNotFoundException{
byte[] classBytes = findClassBytes(name);
if (classBytes==null){
throw new ClassNotFoundException();
}
else{
return defineClass(name, classBytes,
0, classBytes.length);
}
}
public Class findClass(String name, byte[]
classBytes)throws ClassNotFoundException{
if (classBytes==null){
throw new ClassNotFoundException(
"(classBytes==null)");
}
else{
return defineClass(name, classBytes,
0, classBytes.length);
}
}
public void execute(String codeName,
byte[] code){
Class klass = null;
try{
klass = findClass(codeName, code);
TaskIntf task = (TaskIntf)
klass.newInstance();
task.execute();
}
catch(Exception exception){
exception.printStackTrace();
}
}
public class Client{
public static void main (String[] args){
try{
byte[] code = getClassDefinition
("client.TaskImpl");
serverIntf.execute("client.TaskImpl",
code);
}
catch(RemoteException remoteException){
remoteException.printStackTrace();
}
}
private static byte[] getClassDefinition
(String codeName){
String userDir = System.getProperties().
getProperty("BytePath");
FileSystemClassLoader fscl1 = null;
try{
fscl1 = new FileSystemClassLoader
(userDir);
}
catch(FileNotFoundException
fileNotFoundException){
fileNotFoundException.printStackTrace();
}
return fscl1.findClassBytes(codeName);
}
}
public void execute(String codeName, byte[] code)throws RemoteException{
FileSystemClassLoader fileSystemClassLoader = null;
try{
fileSystemClassLoader = new FileSystemClassLoader();
fileSystemClassLoader.execute(codeName, code);
}
catch(Exception exception){
throw new RemoteException(exception.getMessage());
}
}
<#if animals.python.price < animals.elephant.price> Pythons are cheaper than elephants today. <#else>循环d数据
Pythons are not cheaper than elephants today.
</#if>
// 在内存中创徏图象
int width=60, height=20;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// 获取囑Ş上下?BR>Graphics g = image.getGraphics();
//生成随机c?BR>Random random = new Random();
// 讑֮背景?BR>g.setColor(getRandColor(200,250));
g.fillRect(0, 0, width, height);
//讑֮字体
g.setFont(new Font("Times New Roman",Font.PLAIN,18));
//画边?BR>g.setColor(new Color(255,255,255));
g.drawRect(0,0,width-1,height-1);
// 随机产生155条干扰线Q图象中的认证码不易被其它E序探测?BR>g.setColor(getRandColor(160,200));
for (int i=0;i<155;i++)
{
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x,y,x+xl,y+yl);
}
// 取随Z生的认证?4位数?
String sRand="";
for (int i=0;i<4;i++){
String rand=String.valueOf(random.nextInt(10));
sRand+=rand;
// 认证码昄到图象中
g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110)));
//调用函数出来的颜色相同,可能是因为种子太接近Q所以只能直接生?BR>g.drawString(rand,13*i+6,16);
}
// 认证码存入SESSION
session.setAttribute("rand",sRand);
// 图象生效
g.dispose();
// 输出图象到页?BR>ImageIO.write(image, "JPEG", response.getOutputStream());
%>
-------------我是漂亮的分割线---------------
display.jsp
<%@ page contentType="text/html;charset=gb2312" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>认证码输入页?lt;/title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
</head>
<body>
<form method=post action="check.jsp">
<table>
<tr>
<td align=left>pȝ产生的认证码Q?lt;/td>
<td><img border=0 src="image.jsp"></td>
</tr>
<tr>
<td align=left>输入上面的认证码Q?lt;/td>
<td><input type=text name=rand maxlength=4 value=""></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="提交?></td>
</tr>
</form>
</body>
</html>
------------分割U?又见分割U?-------------------------
check.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>认证码验证页?lt;/title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
</head>
<body>
<%
String rand = (String)session.getAttribute("rand");
String input = request.getParameter("rand");
%>
pȝ产生的认证码为: <%= rand %><br>
您输入的认证码ؓQ?<%= input %><br>
<br>
<%
if (rand.equals(input)) {
%>
<font color=green>输入相同Q认证成功!</font>
<%
} else {
%>
<font color=red>输入不同Q认证失败!</font>
<%
}
%>
</body>
</html>
存放数据的地?/FONT>:
1.寄存?Registers):位于处理器内?速度最?E序员无法直接操U?
2.?Stack):位于一般的RAM当中,处理器由指针提供支持.因ؓ要移动指?所以存攑֜stack中的数据的实际大和存活旉都是明确?reference可以|入其中,但是java对象不可?
3.?Heap):位于RAM当中,攄所有的java对象.new的对象都是自Heap分配I间?
4.静态存储空?Static storage):static可以某个对象内的特定成员置为静?java对象不可能置入此?
5.帔R存储I间(Constant storage):位于ROM?
6.Non-RAM存储I间:streamed objects和persistent objects.
两种型别
1.对象型别:object type
2.基本型别:primitive type 不以new分配I间,而是一Uautomatic变量直接存放数据?|于stack
如果惛_heap内代替基本型?可以适用外覆c?比如Character(char)
cȝ初始化过E?/FONT>
1.当一个对象首ơ生?或者当cȝstatic函数和static对象首次被访?java inter Preter首先Ҏclasspath环境变量来查找该对象.
2.一旦类被装?执行它的static初始动作,因此static初始化动作仅发生一?是在Class对象首次被装载时.
3.当new Class(),则先为class对象在Heap上分配够的存储I间.
4.该存储空间先被清I?q自动将class对象内部所有隶属基本类型的数据设ؓ~省?q将reference|ؓnull
5.执行所有出C数据定义处的初始化动?/P>
6.执行构造函?/P>