2007年10月21日星期日

[捷报]

kao,第一轮竟然侥幸刚刚过了

2007年10月20日星期六

[随记]自由了

今天好像blog解封了,纪念一下,毕竟是千年一遇的事情,虽然也许是昙花一现
不用代理就是舒服啊,速度快... ...画面好像也变得清晰了

[随记]dididi...dododo

牙终于拆了,一年的痛苦终于彻底的画上了逗号...

"保持器要带2年"
"什么!!2年??!!!"

唉~~~苦命的人儿今天面试了,连蒙带骗终于弄到了华为的面试机会(本来是会计学专业注册资料的时候说的计算机;没有学位证骗他说有),不过第一轮技术面试好像还不错,那个面试官年龄看起来也就是二十八九岁,对我面试的时间挺长,技术好像挺满意,还多问了我一些别的东西,可能是后面几轮的问题,感动死我了;笔试题很简单,主要是技术之外的比如对一些事情的认识,看法,以及问题的处理方法,人与人之间,唉,总之是对一个人全面的了解,现在要等通知了
问题是还没弄到学位证,面试官说这个月弄不到也不太好办,如果弄不到要给他通知一声,让他也别出岔子;唉~~`人人都说要爱国,可是我一个会计系的学生好不容易有一个机会去大公司做软件开发却因为没有会计系的学位证而失之交臂,人生最大的遗憾莫过于此,,,,为什么社会要这么不懈的折磨一个大好青年???
所以我想大声的喊:I HATE THIS COUNTRY!
唉~~听天由命吧~~

2007年10月5日星期五

[转]jvm opcode instruction

A.3 Instructions by Category

This section contains a listing of the instructions and what they do, grouped by category. Here is a key to the descriptions:

aThe top slot of the stack. May be an int, float, or reference.
bThe second stack slot. May be an int, float, or reference.
cThe third stack slot. May be an int, float, or reference.
dThe fourth stack slot. May be an int, float, or reference.
abThe long or double on top of the stack, made up of slots a and b.
cdThe long or double second on the stack, made up of slots c and d.

A.3.1 Arithmetic

MnemonicArgumentsDescription
daddAdd double (ab+cd)
dcmpgCompare double
dcmplCompare double
ddivDivide double (ab/cd)
dmulMultiply double (ab*cd)
dnegNegate double (-ab)
dremRemainder double (ab%cd)
dsubSubtract double (ab-cd)
faddAdd float (a+b)
fcmpgCompare float
fcmplCompare float
fdivDivide float (a/b)
fmulMultiply float (a*b)
fnegNegate float (-a)
fremRemainder float (a%b)
fsubSubtract float (a-b)
i2bConvert int to byte
i2cConvert int to char
i2sConvert int to short
iaddAdd int (a+b)
iandBitwise and ints (a & b)
idivDivide ints (a/b)
imulMultiply ints (a*b)
inegNegate int (-a)
iorBitwise or ints (a b)
iremRemainder int (a%b)
ishlShift int left (a << b)
ishrShift int right (a >> c)
isubSubtract int (a-b)
iushrUnsigned shift int right (a >>> c)
ixorBitwise xor ints (a ^ b)
laddAdd long (ab+cd)
landBitwise and longs (ab & cd)
lcmpCompare longs
ldivDivide long (ab/cd)
lmulMultiply long (ab*cd)
lnegNegate long (-ab)
lorBitwise or longs (ab cd)
lremRemainder longs (ab%cd)
lshlShift long left (bc << 9)
lshrShift long right (bc >> 9)
lsubSubtract long (ab-cd)
lushrUnsigned shift long right (bc >>> 9)
lxorBitwise x or longs (ab ^ cd)

A.3.2 Array

MnemonicArgumentsDescription
aaloadPush array element a from array b
aastoreStore a in array element b of array c
anewarrayclassCreate array of class, length a
arraylengthLength of array a
athrowThrow exception a
baloadPush array element a from array b
bastoreStore a in array element b of array c
caloadPush array element a from array b
castoreStore a in array element
daloadPush array element a from array b
dastoreStore ab in array element
faloadPush array element a from array b
fastoreStore a in array element b of array c
ialoadPush array element a from array b
iastoreStore a in array element
laloadPush array element a from array b
lastoreStore ab in array element c of array d
multianewarrayclass nCreate multidimensional array with first n dimensions initialized to lengths a, b, c. . .
newarraytypeCreate array of type, length a
saloadPush array element a from array b
sastoreStore a in array element b of array c

A.3.3 Constant

MnemonicArgumentsDescription
aconst_nullPush null reference
bipushnPush int between ?28 and 127
dconst_0Push 0 (double)
dconst_1Push 1 (double)
fconst_0Push 0 (float)
fconst_1Push 1 (float)
fconst_2Push 2 (float)
iconst_0Push 0 (int)
iconst_1Push 1 (int)
iconst_2Push 2 (int)
iconst_3Push 3 (int)
iconst_4Push 4 (int)
iconst_5Push 5 (int)
iconst_m1Push ?(int)
lconst_0Push 0 (long)
lconst_1Push 1 (long)
ldcxPush x (a constant int, float, or String)
ldc_wxPush x (a constant int, float, or String)
ldc2_wxPush x (a constant long or double)
sipushnPush int between ?2,768 and 32767

A.3.4 Control

MnemonicArgumentsDescription
areturnReturn reference from method
dreturnReturn double from method
freturnReturn float from method
gotolabelBranch always
goto_wlabelBranch always to label
if_acmpeqlabelBranch if a == b
if_acmpnelabelBranch if a != b
if_icmpeqlabelBranch if a > b
if_icmpgelabelBranch if a >= b
if_icmpgtlabelBranch if a > b
if_icmplelabelBranch if a <= b
if_icmpltlabelBranch if a < b
if_icmpnelabelBranch if a != b
ifeqlabelBranch if a == 0
ifgelabelBranch if a >= 0
ifgtlabelBranch if a > 0
iflelabelBranch if a <= 0
ifltlabelBranch if a < 0
ifnelabelBranch if a != 0
ifnonnulllabelBranch if a is not null
ifnulllabelBranch if a is null
ireturnReturn int from method
jsrlabelBranch to label; push return location
jsr_wlabelJump to label
lookupswitch

tag1: label1

tag2: label2...

default: labeln

Branch to label1 on tag1, label2 on tag2, . . . , labeln otherwise
lreturnReturn long from method
nopDo nothing
retnBranch to location in variable n
returnReturn from method
tableswitch

n

label1

label2

. . .

default: labeln

Branch to label1 on n, label2 on n+1, . . . , labeln otherwise

A.3.5 Data Type Conversion

MnemonicArgumentsDescription
d2fConvert double ab to float
d2iConvert double ab to int
d2lConvert double ab to long
f2dConvert float a to double
f2iConvert float a to int
f2lConvert float a to long
i2dConvert int a to double
i2fConvert int a to float
i2lConvert int a to long
l2dConvert long ab to double
l2fConvert long ab to float
l2iConvert long ab to int

A.3.6 Object

MnemonicArgumentsDescription
checkcastclassThrow exception if a is not an instance of class
getfieldclass/field descPush object field from object a
getstaticclass/field descPush static field
instanceofclassPush 1 if a is class, 0 otherwise
invokeinterfaceclass/method desc nInvoke method through interface with n argument words
invokespecialclass/method descInvoke method directly
invokestaticclass/method descInvoke static method
invokevirtualclass/method descInvoke method virtually
newclassCreate new object of class
putfieldclass/field descStore a in object field
putstaticclass/field descStore a in static field

A.3.7 Stack Manipulation

MnemonicArgumentsDescription
dupDuplicate a
dup_x1Duplicate a, insert under b
dup_x2Duplicate a, insert under c
dup2Duplicate ab
dup2_x1Duplicate ab, insert under c
dup2_x2Duplicate ab, insert under d
popRemove a
pop2Remove ab
swapSwap a and b

A.3.8 Synchronization

MnemonicArgumentsDescription
monitorenterGain control of monitor of a
monitorexitRelease monitor of a

A.3.9 Variable

MnemonicArgumentsDescription
aloadnPush local variable n
aload_0Push local variable 0
aload_1Push local variable 1
aload_2Push local variable 2
aload_3Push local variable 3
astorenStore a in local variable n
astore_0Store a in local variable 0
astore_1Store a in local variable 1
astore_2Store a in local variable 2
astore_3Store a in local variable 3
dloadnPush local variable n
dload_0Push local variable 0
dload_1Push local variable 1
dload_2Push local variable 2
dload_3Push local variable 3
dstorenStore ab in local variable n
dstore_0Store ab in local variable 0
dstore_1Store ab in local variable 1
dstore_2Store ab in local variable 2
dstore_3Store ab in local variable 3
floadnPush local variable n
fload_0Push local variable 0
fload_1Push local variable 1
fload_2Push local variable 2
fload_3Push local variable 3
fstorenStore a in local variable n
fstore_0Store a in local variable 0
fstore_1Store a in local variable 1
fstore_2Store a in local variable 2
fstore_3Store a in local variable 3
iincn incrementIncrement local variable
iloadnPush local variable n
iload_0Push local variable 0
iload_1Push local variable 1
iload_2Push local variable 2
iload_3Push local variable 3
istorenStore a in local variable n
istore_0Store a in local variable 0
istore_1Store a in local variable 1
istore_2Store a in local variable 2
istore_3Store a in local variable 3
lloadnPush local variable n
lload_0Push local variable 0
lload_1Push local variable 1
lload_2Push local variable 2
lload_3Push local variable 3
lstorenStore ab in local variable n
lstore_0Store ab in local variable 0
lstore_1Store ab in local variable 1
lstore_2Store ab in local variable 2
lstore_3Store ab in local variable 3
wideinstruction argumentsLike instruction, except using wider range of values

2007年10月3日星期三

[原]oxygen.xml.editor.8.2.keygen&patch

今天下了一个好插件,处理xml的,注册机混淆了,研究了下jvm的opcode,把oxygen的xml editor(eclipse plugin)注册机发上来,
只要把plugin下的oxygenEclipse.jar中的ro.sync.D.A.class反编译一下,替换里边的数组为注册机中的数组,这个注册机就能用了.代码:

package cn.com;
import java.io.*;
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.text.SimpleDateFormat;
import java.util.Date;
import sun.misc.BASE64Encoder;

public class OxygenKeygen {

public static void main(String args[]) {
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in));
try {
System.out.println(z[5]);
System.out.println(z[7]);
System.out.println(z[5]);
System.out.println();
String s = a(bufferedreader, z[3]);
String s1 = a(bufferedreader, z[6]);
System.out.println();
System.out.println(z[5]);
System.out.println(z[4]);
System.out.println(z[5]);
System.out.println();
System.out.println((new OxygenKeygen(s, s1)).d());
System.out.println();
System.out.println(z[5]);
} catch (Exception exception) {
exception.printStackTrace();
}
try {
bufferedreader.close();
} catch (IOException _ex) {
}
}

private static PrivateKey a() throws InvalidKeySpecException, NoSuchAlgorithmException {
PKCS8EncodedKeySpec pkcs8encodedkeyspec = new PKCS8EncodedKeySpec(d);
return KeyFactory.getInstance(z[23]).generatePrivate(pkcs8encodedkeyspec);
}

private static String a(String s) {
StringBuffer stringbuffer;
int i;
int j;
boolean flag;
flag = f;
stringbuffer = new StringBuffer(s);
i = stringbuffer.length();

for (j = 0; j < i; j++) {
char ch = Character.toUpperCase(stringbuffer.charAt(j));
if (z[2].indexOf(ch) == -1)
stringbuffer.setCharAt(j, '_');
}
return stringbuffer.toString();
// if(!flag) goto _L2; else goto _L1
// _L1:
// z[2]; //z[2]
// _L7:
// Character.toUpperCase(stringbuffer.charAt(j)); //z[2],CH
// indexOf();
// -1;
// JVM INSTR icmpne 53; // 判断ch是否在z[2]中,在goto L4,continue;不在则break到line:102
// goto _L3 _L4
// _L3:
// break MISSING_BLOCK_LABEL_46;
// _L4:
// continue; /* Loop/switch isn't completed */
// stringbuffer.setCharAt(j, '_'); //maybe here is MISSING_BLOCK_LABEL_46;
// j++;
// _L2:
// if(j < i) goto _L1; else goto _L5
// _L5:
// stringbuffer.toString();
// if(flag) goto _L7; else goto _L6
// _L6:
// return;
}

private static String a(BufferedReader bufferedreader, String s) throws IOException {
boolean flag;
flag = f;
Object obj = null;
// _L2:

String s1;
do {
System.out.print(s);
System.out.flush();

s1 = bufferedreader.readLine();
} while (s1 == null || s1.trim().length() == 0);
// _L4:
// // JVM INSTR ifnull 6;
// // goto _L1 _L2
// _L1:
// s1.trim();
// if(flag) goto _L4; else goto _L3
// _L3:
// if(flag) goto _L6; else goto _L5
// _L5:
// length();
// JVM INSTR ifeq 6;
// goto _L7 _L2
// _L7:
// s1;
// _L6:
return s1;
}

public OxygenKeygen(String s, String s1) {
b = null;
c = null;
b = s;
c = s1;
}

private String b() throws Exception {
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append(a(b));
stringbuffer.append(a(c));
stringbuffer.append(a);
stringbuffer.append("0");
stringbuffer.append(z[16]);
stringbuffer.append(a(z[20]));
stringbuffer.append(a(z[22]));
stringbuffer.append(a(z[21]));
return stringbuffer.toString();
}

private String c() throws Exception {
Signature signature = Signature.getInstance(z[0]);
signature.initSign(a());
signature.update(b().getBytes(z[1]));
return (new BASE64Encoder()).encode(signature.sign());
}

private String d() throws Exception {
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append((new StringBuilder(z[8])).append(b).toString()).append('\n');
stringbuffer.append((new StringBuilder(z[13])).append(c).toString()).append('\n');
stringbuffer.append(z[11]).append(a).append('\n');
stringbuffer.append(z[15]).append('\n');
stringbuffer.append(z[9]).append(z[16]).append('\n');
stringbuffer.append(z[18]).append(z[20]).append('\n');
stringbuffer.append(z[12]).append(z[10]).append('\n');
stringbuffer.append(z[19]).append(z[14]).append('\n');
stringbuffer.append((new StringBuilder(z[17])).append(c()).toString());
return stringbuffer.toString();
}

private static final String a;
private String b;
private String c;
private static final byte d[];
public static boolean e;
public static boolean f;
private static String z[];

static {
String as[];
as = new String[25];
as[0] = "1G\b\026\020\013{!c4#";
as[1] = "7[\017\037";
as[2] = " N\rd\"$H\001n-)C\007j(2^\033t37Y\036\177=;?x\025TV:\177\020_[/\026\nI\"";
as[3] = "0j.N\024\026}(S\016\raiI\006\017ji\035G";
as[4] = ".f*B\t\021js\007";
as[5] = "_2t\032Z_2t\032Z_2t\032Z_2t\032Z_2t\032Z_2t\032Z_2t\032Z_2t\032Z_2t\032Z_2t\032Z";
as[6] = "!`$W\006\fvi\007GB/i\007GB/i\035G";
as[7] = "_2t\007[\rW0@\002\f w\177*./\fC\016\026`;\007\021Z!{\007\013\013l,I\024\007/.B\t\007}(S\b\020/t\032Z";
as[8] = "0j.N\024\026}(S\016\ra\026i\006\017jt";
as[9] = ",z$E\002\020P&A8.f*B\t\021j:\032";
as[10] = ":B\005\n\"\006f=H\025NW\032k3OK,E\022\005h,U";
as[11] = "&n=BZ";
as[12] = "!`$W\b\fj'SZ";
as[13] = "!`$W\006\fvt";
as[14] = "Z#{";
as[15] = "&z;F\023\013`'\032J";
as[16] = "S?y\027";
as[17] = "1H\007\032";
as[18] = "!n=B\000\r}0\032";
as[19] = "4j;T\016\rat";
as[20] = "'a=B\025\022} T\002";
as[21] = "97e\007U?";
as[22] = "9W\004kJ'k S\b\020#i\1774.[dc\002\000z.@\002\020R";
as[23] = "&\\\b";
as[24] = "/BdC\003Ov0^\036";
z = as;

byte[] con=new byte[] {0x62,15,73,39,103};
for (int k = 0; k < z.length; k++) {
char[] ch = z[k].toCharArray();
// if (ch.length < 1) {
// if (k < 0) {
// }
//
// }
for (int i = 0; i < ch.length; i++) {
ch[i] ^= con[i%5];
}
z[k] = new String(ch);
}

// for (int l = 0; l < z.length; l++) {
// System.out.println("" + l + ": " + z[l]);
// }

// break MISSING_BLOCK_LABEL_343;
// local;
// toCharArray();
// JVM INSTR dup ;
// JVM INSTR arraylength .length;
// JVM INSTR swap ;
// int i = 0;
// JVM INSTR swap ;//ca,length
// JVM INSTR dup_x1 ;//len,ca,len
// 1; //len,ca,len,1
// JVM INSTR icmpgt 322;//len,ca
// goto _L1 _L2
// _L1:
// JVM INSTR dup ;//len,ca,ca
// i; //len,ca,ca,i
// _L4:
// JVM INSTR dup2 ; //len,ca,ca,i,ca,i
// JVM INSTR caload ;//len,ca,ca,i,ca[i]
// byte byte0;
// switch(i % 5)
// {
// case 0: // '\0'
// byte0 = 0x62;
// break;
//
// case 1: // '\001'
// byte0 = 15;
// break;
//
// case 2: // '\002'
// byte0 = 73;
// break;
//
// case 3: // '\003'
// byte0 = 39;
// break;
//
// default:
// byte0 = 103;
// break;
// }
// byte0; //len,ca,ca,i,ca[i],byte0
// JVM INSTR ixor ;//len,ca,ca,i,ca[i]^byte0
// (char); //len,ca,ca,i,char
// JVM INSTR castore ;//len,ca {ca[i]=char} *****
// i++;
// JVM INSTR swap ; //ca,len
// JVM INSTR dup_x1 ; //len,ca,len
// JVM INSTR ifne 322;//if (len!=0) len,ca
// goto _L3 _L2
// _L3:
// JVM INSTR dup2 ;
// JVM INSTR swap ;
// goto _L4
// _L2:
// JVM INSTR swap ; //ca,len
// JVM INSTR dup_x1 ;//len,ca,len
// i; //len,ca,len,i
// JVM INSTR icmpgt 245; //len,ca
// goto _L5 _L1
// _L5:
// JVM INSTR new #153 ; //len,ca
// JVM INSTR dup_x1 ; //ca,len,ca
// JVM INSTR swap ; //ca,ca,len
// String();
// intern();
// JVM INSTR swap ;
// JVM INSTR pop ;
// JVM INSTR ret 0;
a = (new SimpleDateFormat(z[24])).format(new Date());
d = (new byte[] { 48, -126, 1, 76, 2, 1, 0, 48, -126, 1, 44, 6, 7, 42, -122, 72, -50, 56, 4, 1, 48, -126, 1, 31, 2, -127, -127, 0, -3, 127, 83, -127,
29, 117, 18, 41, 82, -33, 74, -100, 46, -20, -28, -25, -10, 17, -73, 82, 60, -17, 68, 0, -61, 30, 63, -128, -74, 81, 38, 105, 69, 93, 64, 34,
81, -5, 89, 61, -115, 88, -6, -65, -59, -11, -70, 48, -10, -53, -101, 85, 108, -41, -127, 59, -128, 29, 52, 111, -14, 102, 96, -73, 107, -103,
80, -91, -92, -97, -97, -24, 4, 123, 16, 34, -62, 79, -69, -87, -41, -2, -73, -58, 27, -8, 59, 87, -25, -58, -88, -90, 21, 15, 4, -5, -125,
-10, -45, -59, 30, -61, 2, 53, 84, 19, 90, 22, -111, 50, -10, 117, -13, -82, 43, 97, -41, 42, -17, -14, 34, 3, 25, -99, -47, 72, 1, -57, 2, 21,
0, -105, 96, 80, -113, 21, 35, 11, -52, -78, -110, -71, -126, -94, -21, -124, 11, -16, 88, 28, -11, 2, -127, -127, 0, -9, -31, -96, -123, -42,
-101, 61, -34, -53, -68, -85, 92, 54, -72, 87, -71, 121, -108, -81, -69, -6, 58, -22, -126, -7, 87, 76, 11, 61, 7, -126, 103, 81, 89, 87, -114,
-70, -44, 89, 79, -26, 113, 7, 16, -127, -128, -76, 73, 22, 113, 35, -24, 76, 40, 22, 19, -73, -49, 9, 50, -116, -56, -90, -31, 60, 22, 122,
-117, 84, 124, -115, 40, -32, -93, -82, 30, 43, -77, -90, 117, -111, 110, -93, 127, 11, -6, 33, 53, 98, -15, -5, 98, 122, 1, 36, 59, -52, -92,
-15, -66, -88, 81, -112, -119, -88, -125, -33, -31, 90, -27, -97, 6, -110, -117, 102, 94, -128, 123, 85, 37, 100, 1, 76, 59, -2, -49, 73, 42,
4, 23, 2, 21, 0, -106, -49, 66, -124, -79, -94, -48, -108, 26, -46, -57, -110, -117, 14, -38, 1, -77, -127, 0, 14 });
}
}

ps:今天上午又看了下注册原理,其实就是A.class里边是公钥,注册时程序将注册码base64decode为密文,然后再用公钥解开,明文内容应该和注册名一致;
而注册码是作者用用户的注册名+作者的私钥生成的.
因此只需要用程序生成一对密钥,私钥放入keygen里边,公钥放入A.class里边覆盖原来的公钥byte[],就ok了.这次终于明白签名注册的原理了 :-)

2007年10月2日星期二

[原]MB开发环境安装手册(Linux)

MB开发环境安装手册(Linux)

(最终版已经丢失,现将以前放在网上的初稿贴过来)

一. 安装环境
操作系统:

fedora5
数据库:

DB2 8.2

开发环境:

Websphere Message Broker Runtime 6.0 ,MQ Series 6.0



二. 软件安装及参数配置

OS…………(fedora5) 安装mq后会有错误:
AMQ8101: WebSphere MQ error (893) has occurred.


以下内容OS为redhat9.0

首先解包,将software中的mb,mq,db2分别解包到mb,mq,db2文件夹中
1. Db2在linux上的安装:
./install
选择第一个和第三个包
Useradd db2ins1
Passwd db2ins1
修改文件opt/IBM/db2/V8.1/instance/db2iutil中的tail为tail –n (版本不一样,限于fedora5,rh9.0无此问题)

opt/IBM/db2/V8.1/instance/db2icrt -u db2ins1 db2ins1
su – db2ins1
db2start(此时如果说权限不够,是因为db2icrt执行失败)
db2 create database jjjj

验证安装是否正确可用connect to database,然后选择表查看


2.安装mq

mqlicense.sh –text_only …??
rpm -ivh MQSeriesRuntime-5.3.0-1.i386.rpm
rpm -ivh MQSeriesSDK-5.3.0-1.i386.rpm
rpm -ivh MQSeriesServer-5.3.0-1.i386.rpm
/opt/mqm/bin/amqiclen -x

//也可以安装man 用于了解命令

配置脚本:

crtmqm -lc -lf 8192 -lp 2 -ls 1 -q MB00

strmqm MB00

runmqsc MB00



define channel(SYSTEM.ADMIN.SVRCONN) chltype(SVRCONN) trptype(TCP)

define channel(CHANNEL1) chltype(SVRCONN) TRPTYPE(TCP)



def ql(deadq) defpsist(yes) maxdepth(20000) replace

def ql(ERRMSG) defpsist(yes) maxdepth(20000) replace

alter qmgr deadq(deadq)



def ql(in) maxdepth(10000) defpsist(yes) maxmsgl(1048576) replace

def ql(out) maxdepth(10000) defpsist(yes) maxmsgl(1048576) replace

def qr(99_IN) rname(IN) rqmname(MB99) xmitq(MB00_99) defpsist(yes) replace

def ql(MB00_99) usage(xmitq) defpsist(yes) maxdepth(10000) maxmsgl(1048576) trigger trigtype(first) trigdata(00_99) initq(system.channel.initq) replace

def chl(00_99) chltype(sdr) discint(1800) conname('192.168.1.199(6666)') xmitq(MB00_99) trptype(tcp) shortrty(10000) shorttmr(30) longtmr(300) longrty(999999999) batchsz(50) replace

def chl(99_00) chltype(rcvr) trptype(tcp) replace

def listener(MB00) trptype(tcp)

alter listener(MB00) trptype(tcp) port(6666) control(qmgr)

alter qmgr ccsid(819)

end
如果不通可以复位接收方的通道


3.安装MB runtime
Setup 即可


准备mb runtime参数:

1. 创建实例: /opt/IBM/db2/V8.1/instance/db2icrt –u kongpeng kongpeng

2. 创建数据库: su – kongpeng

db2start

db2 create database MBDB

db2 connect to MBDB

db2 bind ~/sqllib/bnd/@db2cli.lst grant public CLIPKG 5db2

db2 update database configuration for MBDB using dbheap 900

edit .odbc.ini

export ODBCINI

(odbc环境变量参数已经在profile中设定,因此无需再次设定.)

set lib path add ~/instance dir/sqllib/lib32

export LANG=EN (放入profile中)

将mqbrk里边的profile拷贝到root下,合并原先的默认profile.

将root用户加入组mqm,mqbrkrs就ok了

DB2 authorization ???

mqsicreatebroker MB -i kongpeng -a kongpeng -q MB00 -n MBDB -u kongpeng -p kongpeng

mqsicreateconfigmgr MB_MANAGER -i kongpeng -a kongpeng -q MB00

mqsistart MB

mqsistart MB_MANAGER



db2set db2codepage=1386

db2 terminate

db2 connect to sample



mqsilist

mqsilist brokername (此命令验证执行组是否能部署到此broker中)

(如果显示BIP8029E错误,说明broker没有建好,toolkit发布的信息不能部署到执行组中)

为什么mqsistop/mqsideletebroker会无响应呢? 可能是一开始建立broker的时候有错误………….



验证:

用本机上的toolkit建立一个简单的项目,消息流为从IN放入消息,OUT队列会收到消息,归档部署,linux机器上amqsput放入,amqsget查看!

注意:

因为用命令方式建立的队列名称默认是大写,所以toolkit中控件的属性名称以及linux中进行队列操作时要注意队列名称要大写,否则会找不到相应的队列.



4.安装cvs

rpm –ivh cvs-1.11.2-17.i386.rpm

groupadd cvs

useradd –g cvs –G cvs –d /cvsroot cvsroot

passwd cvsroot

chmod –R 770 /cvsroot

su - cvsroot

cd /cvsroot

mkdir project1

cvs –d /cvsroot/project1 init

cd /etc/xinetd.d

vi cvspserver (root)

将server_args去掉,server改为server = /cvsroot/cvs.run

su – cvsroot

建立cvs.run文件:

#!/bin/bash

/usr/bin/cvs –f --allow-root=/cvsroot/project1 pserver

chmod +x cvs.run

加入cvs服务:

vi /etc/services

cvspserver 2666/tcp #pserver cvs service

cvspserver 2666/udp #pserver cvs service

/etc/init.d/xinetd restart

/cvsroot/passwdgen.pl 生成密码的脚本

#!/usr/bin/perl

srand (time());

my $randletter = "(int (rand(26)) + (int (rand(1) + .5) % 2 ? 65 : 97))";

my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);

my $plaintext = shift;

my $crypttext = crypt ($plaintext, $salt);

print "${crypttext}\n";

/cvsroot/project/passwd username:passwd:cvsroot



验证: cvs -d :pserver:username@192.168.1.31:/cvsroot/project1 login

三. 系统配置



(Aix分区/安装,用户的建立,权限的分配,密码… …安装mq,db2,mb runtime,agent controller可能还要涉及到cvs的安装,使用

安装mq的时候要先装eclipse,java1.4.2,环境变量的设置,安装db2的时候要将计算机用户加入到db2admin组中)

















=====原始数据=====

本机配置:

========MQ===========

crtmqm -lc -lf 8192 -lp 2 -ls 1 -q MB99

strmqm MB99

runmqsc MB99



define channel(SYSTEM.ADMIN.SVRCONN) chltype(SVRCONN) trptype(TCP) mcauser('mqm')

define channel(CHANNEL1) chltype(SVRCONN) TRPTYPE(TCP) mcauser('mqm')



def ql(deadq) defpsist(yes) maxdepth(20000) replace

def ql(ERRMSG) defpsist(yes) maxdepth(20000) replace

alter qmgr deadq(deadq)



def ql(in) maxdepth(10000) defpsist(yes) maxmsgl(1048576) replace





def qr(29_IN) rname(IN) rqmname(MB) xmitq(MB) defpsist(yes) replace //29的远程队列

def qr(00_IN) rname(IN) rqmname(MB00) xmitq(MB00) defpsist(yes) replace //00的远程队列



def ql(MB) usage(xmitq) defpsist(yes) maxdepth(10000) maxmsgl(1048576) trigger trigtype(first) trigdata(99_29) initq(system.channel.initq) replace //29传输队列

def ql(MB00) usage(xmitq) defpsist(yes) maxdepth(10000) maxmsgl(1048576) trigger trigtype(first) trigdata(99_00) initq(system.channel.initq) replace //00传输队列



def chl(99_29) chltype(sdr) discint(1800) conname('192.168.1.29(6666)') xmitq(MB) trptype(tcp) shortrty(10000) shorttmr(30) longtmr(300) longrty(999999999) batchsz(50) replace

def chl(29_99) chltype(rcvr) trptype(tcp) replace //29的发送及接受通道



def chl(99_00) chltype(sdr) discint(1800) conname('192.168.1.31(6666)') xmitq(MB00) trptype(tcp) shortrty(10000) shorttmr(30) longtmr(300) longrty(999999999) batchsz(50) replace

def chl(00_99) chltype(rcvr) trptype(tcp) replace //00的发送及接受通道





def listener(MB99) trptype(tcp)

alter listener(MB99) trptype(tcp) port(6666) control(qmgr)

alter qmgr ccsid(819)

end

============MB=========

mqsicreateconfigmgr -i kongpeng -a $$ -q MB99 MB_MANAGER

mqsistart MB_MANAGER





192.168.1.29配置:

========MQ===========

crtmqm -lc -lf 8192 -lp 2 -ls 1 -q MB

strmqm MB

runmqsc MB



define channel(SYSTEM.ADMIN.SVRCONN) chltype(SVRCONN) trptype(TCP) mcauser('mqm')

define channel(CHANNEL1) chltype(SVRCONN) TRPTYPE(TCP) mcauser('mqm')



def ql(deadq) defpsist(yes) maxdepth(20000) replace

def ql(ERRMSG) defpsist(yes) maxdepth(20000) replace

alter qmgr deadq(deadq)



def ql(in) maxdepth(10000) defpsist(yes) maxmsgl(1048576) replace



def qr(99_IN) rname(IN) rqmname(MB99) xmitq(MB99) defpsist(yes) replace



def ql(MB99) usage(xmitq) defpsist(yes) maxdepth(10000) maxmsgl(1048576) trigger trigtype(first) trigdata(29_99) initq(system.channel.initq) replace

def chl(29_99) chltype(sdr) discint(1800) conname('192.168.1.199(6666)') xmitq(MB99) trptype(tcp) shortrty(10000) shorttmr(30) longtmr(300) longrty(999999999) batchsz(50) replace

def chl(99_29) chltype(rcvr) trptype(tcp) replace



def listener(MB) trptype(tcp)

alter listener(MB) trptype(tcp) port(6666) control(qmgr)

alter qmgr ccsid(819)

end

============MB=========

mqsicreatebroker MB -i kongpeng -a $$ -q MB -n MBDB

mqsistart MB

mqsicreateconfigmgr -i kongpeng -a $$ -q MB MB_MANAGER

mqsistart MB_MANAGER











---------------------------------------------------------------------------------------------------------------------

mqsicreateaclentry MB_MANAGER -u kongpeng -a -x F -p





Add an access control list (ACL) entry to the Configuration Manager for the user with the Message Brokers Toolkit local user ID. For example, if USERA connects to the Message Brokers Toolkit on COMPUTERA, which belongs to DOMAINA, and is trying to connect to Configuration Manager CMA:

USERA must exist as a user on the Configuration Manager system and belong to the mqm group

USERA could have one of the following ACL entries:

To create an ACL entry for USERA to connect with full Configuration Manager Proxy authority from any computer or domain, issue the following command:

mqsicreateaclentry CMA -u USERA -a -x F -p

To create an ACL entry for USERA to connect with full Configuration Manager Proxy authority from COMPUTERA only, issue the following command:

mqsicreateaclentry CMA -u USERA -m COMPUTERA -x F -p

To create an ACL entry for USERA to connect with full Configuration Manager Proxy authority from DOMAINA only, issue the following command:

mqsicreateaclentry CMA -u USERA -m DOMAINA -x F -p

If a domain name and computer name match, and an ACL entry specified the -m parameter, connection from either the domain or computer is acceptable because they are not considered to be different users.

ACLs are necessary for all connections to the Configuration Manager so the user who issues a command such as mqsideploy from the command line must also have appropriate ACL entries.







setmqaut -m MB -t qmgr -p kongpeng +all

dspmqaut -m MB -t qmgr -p kongpeng

[转]关于Java栈与堆的思考

1. 栈(stack)与堆(heap)都是Java用来在Ram中存放数据的地方。与C++不同,Java自动管理栈和堆,程序员不能直接地设置栈或堆。

2. 栈的优势是,存取速度比堆要快,仅次于直接位于CPU中的寄存器。但缺点是,存在栈中的数据大小与生存期必须是确定的,缺乏灵活性。另外,栈数据可以共享,详见第3点。堆的优势是可以动态地分配内存大小,生存期也不必事先告诉编译器,Java的垃圾收集器会自动收走这些不再使用的数据。但缺点是,由于要在运行时动态分配内存,存取速度较慢。

3. Java中的数据类型有两种。
一种是基本类型(primitive types), 共有8种,即int, short, long, byte, float, double, boolean, char(注意,并没有string的基本类型)。这种类型的定义是通过诸如int a = 3; long b = 255L;的形式来定义的,称为自动变量。值得注意的是,自动变量存的是字面值,不是类的实例,即不是类的引用,这里并没有类的存在。如int a = 3; 这里的a是一个指向int类型的引用,指向3这个字面值。这些字面值的数据,由于大小可知,生存期可知(这些字面值固定定义在某个程序块里面,程序块退出后,字段值就消失了),出于追求速度的原因,就存在于栈中。
另外,栈有一个很重要的特殊性,就是存在栈中的数据可以共享。假设我们同时定义

int a = 3;
int b = 3;

编译器先处理int a = 3;首先它会在栈中创建一个变量为a的引用,然后查找有没有字面值为3的地址,没找到,就开辟一个存放3这个字面值的地址,然后将a指向3的地址。接着处理int b = 3;在创建完b的引用变量后,由于在栈中已经有3这个字面值,便将b直接指向3的地址。这样,就出现了a与b同时均指向3的情况。
特别注意的是,这种字面值的引用与类对象的引用不同。假定两个类对象的引用同时指向一个对象,如果一个对象引用变量修改了这个对象的内部状态,那么另一个对象引用变量也即刻反映出这个变化。相反,通过字面值的引用来修改其值,不会导致另一个指向此字面值的引用的值也跟着改变的情况。如上例,我们定义完a与b的值后,再令a=4;那么,b不会等于4,还是等于3。在编译器内部,遇到a=4;时,它就会重新搜索栈中是否有4的字面值,如果没有,重新开辟地址存放4的值;如果已经有了,则直接将a指向这个地址。因此a值的改变不会影响到b的值。
另一种是包装类数据,如Integer, String, Double等将相应的基本数据类型包装起来的类。这些类数据全部存在于堆中,Java用new()语句来显示地告诉编译器,在运行时才根据需要动态创建,因此比较灵活,但缺点是要占用更多的时间。

4. String是一个特殊的包装类数据。即可以用String str = new String("abc");的形式来创建,也可以用String str = "abc";的形式来创建(作为对比,在JDK 5.0之前,你从未见过Integer i = 3;的表达式,因为类与字面值是不能通用的,除了String。而在JDK 5.0中,这种表达式是可以的!因为编译器在后台进行Integer i = new Integer(3)的转换)。前者是规范的类的创建过程,即在Java中,一切都是对象,而对象是类的实例,全部通过new()的形式来创建。Java中的有些类,如DateFormat类,可以通过该类的getInstance()方法来返回一个新创建的类,似乎违反了此原则。其实不然。该类运用了单例模式来返回类的实例,只不过这个实例是在该类内部通过new()来创建的,而getInstance()向外部隐藏了此细节。那为什么在String str = "abc";中,并没有通过new()来创建实例,是不是违反了上述原则?其实没有。

5. 关于String str = "abc"的内部工作。Java内部将此语句转化为以下几个步骤:
(1)先定义一个名为str的对String类的对象引用变量:String str;
(2)在栈中查找有没有存放值为"abc"的地址,如果没有,则开辟一个存放字面值为"abc"的地址,接着创建一个新的String类的对象o,并将o的字符串值指向这个地址,而且在栈中这个地址旁边记下这个引用的对象o。如果已经有了值为"abc"的地址,则查找对象o,并返回o的地址。
(3)将str指向对象o的地址。
值得注意的是,一般String类中字符串值都是直接存值的。但像String str = "abc";这种场合下,其字符串值却是保存了一个指向存在栈中数据的引用!

为了更好地说明这个问题,我们可以通过以下的几个代码进行验证。

String str1 = "abc";
String str2 = "abc";
System.out.println(str1==str2); //true

注意,我们这里并不用str1.equals(str2);的方式,因为这将比较两个字符串的值是否相等。==号,根据JDK的说明,只有在两个引用都指向了同一个对象时才返回真值。而我们在这里要看的是,str1与str2是否都指向了同一个对象。
结果说明,JVM创建了两个引用str1和str2,但只创建了一个对象,而且两个引用都指向了这个对象。

我们再来更进一步,将以上代码改成:

String str1 = "abc";
String str2 = "abc";
str1 = "bcd";
System.out.println(str1 + "," + str2); //bcd, abc
System.out.println(str1==str2); //false

这就是说,赋值的变化导致了类对象引用的变化,str1指向了另外一个新对象!而str2仍旧指向原来的对象。上例中,当我们将str1的值改为"bcd"时,JVM发现在栈中没有存放该值的地址,便开辟了这个地址,并创建了一个新的对象,其字符串的值指向这个地址。
事实上,String类被设计成为不可改变(immutable)的类。如果你要改变其值,可以,但JVM在运行时根据新值悄悄创建了一个新对象,然后将这个对象的地址返回给原来类的引用。这个创建过程虽说是完全自动进行的,但它毕竟占用了更多的时间。在对时间要求比较敏感的环境中,会带有一定的不良影响。

再修改原来代码:

String str1 = "abc";
String str2 = "abc";

str1 = "bcd";

String str3 = str1;
System.out.println(str3); //bcd

String str4 = "bcd";
System.out.println(str1 == str4); //true

str3这个对象的引用直接指向str1所指向的对象(注意,str3并没有创建新对象)。当str1改完其值后,再创建一个String的引用str4,并指向因str1修改值而创建的新的对象。可以发现,这回str4也没有创建新的对象,从而再次实现栈中数据的共享。

我们再接着看以下的代码。

String str1 = new String("abc");
String str2 = "abc";
System.out.println(str1==str2); //false

创建了两个引用。创建了两个对象。两个引用分别指向不同的两个对象。

String str1 = "abc";
String str2 = new String("abc");
System.out.println(str1==str2); //false

创建了两个引用。创建了两个对象。两个引用分别指向不同的两个对象。

以上两段代码说明,只要是用new()来新建对象的,都会在堆中创建,而且其字符串是单独存值的,即使与栈中的数据相同,也不会与栈中的数据共享。

6. 数据类型包装类的值不可修改。不仅仅是String类的值不可修改,所有的数据类型包装类都不能更改其内部的值。

7. 结论与建议:

(1)我们在使用诸如String str = "abc";的格式定义类时,总是想当然地认为,我们创建了String类的对象str。担心陷阱!对象可能并没有被创建!唯一可以肯定的是,指向String类的引用被创建了。至于这个引用到底是否指向了一个新的对象,必须根据上下文来考虑,除非你通过new()方法来显要地创建一个新的对象。因此,更为准确的说法是,我们创建了一个指向String类的对象的引用变量str,这个对象引用变量指向了某个值为"abc"的String类。清醒地认识到这一点对排除程序中难以发现的bug是很有帮助的。

(2)使用String str = "abc";的方式,可以在一定程度上提高程序的运行速度,因为JVM会自动根据栈中数据的实际情况来决定是否有必要创建新对象。而对于String str = new String("abc");的代码,则一概在堆中创建新对象,而不管其字符串值是否相等,是否有必要创建新对象,从而加重了程序的负担。这个思想应该是享元模式的思想,但JDK的内部在这里实现是否应用了这个模式,不得而知。

(3)当比较包装类里面的数值是否相等时,用equals()方法;当测试两个包装类的引用是否指向同一个对象时,用==。

(4)由于String类的immutable性质,当String变量需要经常变换其值时,应该考虑使用StringBuffer类,以提高程序效率。

[原]MB开发环境安装手册(AIX)

MB开发环境安装手册

一. 安装环境

操作系统:
Aix P520 (开发机)
CPU. 1.5G
RAM. 1G
HD. 36G
数据库:
DB2 8.2
开发环境:
Websphere Message Broker Runtime 6.0 ,MQ Series 6.0

二. 软件安装及参数配置
将安装文件拷贝到/software下

1. Db2在aix上的安装:
gzip –d ese.dbcs.tar.gz
tar xvf ese.dbcs.tar
cd ese.dbcs
./install
三个包全部选择
Useradd db2inst1
Passwd db2inst1
mkdir /home/db2inst1
/usr/opt/db2_08_01/instance/db2icrt -u db2inst1 db2inst1(一开始处失败,原因可能为磁盘空间不足)
su – db2inst1
db2start
db2 create database jjjj
验证安装是否正确可用connect to database,然后选择表查看

[db2的实例及数据库安装在/home下,所以可以适当增加/home文件系统的大小]

2.安装mq
mount cdrom
smitty
install jdk1.4.2
install mqm.base
install mqm.server
install mqm.java
[安装的时候要将smitty选项.accept new license 改为yes
[mq建立的queue manager放在/var/mqm下边,加大容量]

配置脚本:
crtmqm -lc -lf 8192 -lp 2 -ls 1 -q QM00
strmqm QM00
runmqsc QM00

define channel(SYSTEM.ADMIN.SVRCONN) chltype(SVRCONN) trptype(TCP)
define channel(CHANNEL1) chltype(SVRCONN) TRPTYPE(TCP)

def ql(deadq) defpsist(yes) maxdepth(20000) replace
def ql(ERRMSG) defpsist(yes) maxdepth(20000) replace
alter qmgr deadq(deadq)

def ql(00_1) maxdepth(10000) defpsist(yes) maxmsgl(1048576) replace
def ql(00_2) maxdepth(10000) defpsist(yes) maxmsgl(1048576) replace

def qr(199_1) rname(199_1) rqmname(QM199) xmitq(QM199) defpsist(yes) replace

def ql(QM199) usage(xmitq) defpsist(yes) maxdepth(10000) maxmsgl(1048576) trigger trigtype(first) trigdata(00_199) initq(system.channel.initq) replace
def chl(00_199) chltype(sdr) discint(1800) conname('192.168.1.199(6666)') xmitq(QM199) trptype(tcp) shortrty(10000) shorttmr(30) longtmr(300) longrty(999999999) batchsz(50) replace
def chl(199_00) chltype(rcvr) trptype(tcp) replace

def listener(QM00) trptype(tcp)
alter listener(QM00) trptype(tcp) port(6666) control(qmgr)
alter qmgr ccsid(819)
end

如果不通可以复位接收方的通道

3.安装MB runtime

mkgroup mqbrkrs
setupaix –console

[mb安装在/opt,加大容量]
准备mb runtime参数:
{aix创建用户的时候没有profile文件,所以在创建实例之前要建立.profile文件在用户目录下}
1. 创建实例: /usr/opt/db2_08_01/instance/db2icrt -u kongpeng kongpeng
2. 创建数据库: su – kongpeng
db2start
db2 create database MBDB
db2 connect to MBDB user kongpeng(重要,aix有时密码会过期)
db2 bind ~/sqllib/bnd/@db2cli.lst grant public CLIPKG 5
db2 update database configuration for MBDB using dbheap 900

set lib path add ~/instance dir/sqllib/lib32 (aix自动加上了,lib和lib32都指向/usr/opt/db2_08_01/lib/)
export LANG=EN (放入profile中)
将安装目录/bin里边的mqsiprofile拷贝到/home/kongpeng下,合并原先的默认profile.
将root用户加入组mqm,mqbrkrs就ok了
mqsicreatebroker MB -i kongpeng -a kongpeng -q QM00 -n MBDB -u kongpeng -p kongpeng
mqsicreateconfigmgr MB_MANAGER -i kongpeng -a kongpeng -q QM00
mqsistart MB
mqsistart MB_MANAGER

db2set db2codepage=1386
db2 terminate
db2 connect to sample

mqsilist
mqsilist brokername (此命令验证执行组是否能部署到此broker中)
(如果显示BIP8029E错误,说明broker没有建好,toolkit发布的信息不能部署到执行组中)
为什么mqsistop/mqsideletebroker会无响应呢? 可能是一开始建立broker的时候有错误………….

验证:
用本机上的toolkit建立一个简单的项目,消息流为从IN放入消息,OUT队列会收到消息,归档部署,linux机器上amqsput放入,amqsget查看!
注意:
因为用命令方式建立的队列名称默认是大写,所以toolkit中控件的属性名称以及linux中进行队列操作时要注意队列名称要大写,否则会找不到相应的队列;建立好数据库后不要乱改登陆用户的密码,否则会连不上数据库!

4.安装cvs
rpm –ivh cvs-1.11.2-17.i386.rpm
groupadd cvs
useradd –g cvs –G cvs –d /cvsroot cvsroot
passwd cvsroot
chmod –R 770 /cvsroot
su - cvsroot
cd /cvsroot
mkdir project1
cvs –d /cvsroot/project1 init
cd /etc/xinetd.d
vi cvspserver (root)
将server_args去掉,server改为server = /cvsroot/cvs.run
su – cvsroot
建立cvs.run文件:
#!/bin/bash
/usr/bin/cvs –f --allow-root=/cvsroot/project1 pserver
chmod +x cvs.run
加入cvs服务:
vi /etc/services
cvspserver 2666/tcp #pserver cvs service
cvspserver 2666/udp #pserver cvs service
/etc/init.d/xinetd restart
/cvsroot/passwdgen.pl 生成密码的脚本
#!/usr/bin/perl
srand (time());
my $randletter = "(int (rand(26)) + (int (rand(1) + .5) % 2 ? 65 : 97))";
my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
my $plaintext = shift;
my $crypttext = crypt ($plaintext, $salt);
print "${crypttext}\n";
/cvsroot/project/passwd username:passwd:cvsroot

验证: cvs -d :pserver:username@192.168.1.31:/cvsroot/project1 login
三. 系统配置

增加/software文件系统,大小为5G
smitty jfs












[本机配置]
crtmqm -lc -lf 8192 -lp 2 -ls 1 -q QM199
strmqm QM199
runmqsc QM199

define channel(SYSTEM.ADMIN.SVRCONN) chltype(SVRCONN) trptype(TCP)
define channel(CHANNEL1) chltype(SVRCONN) TRPTYPE(TCP)

def ql(deadq) defpsist(yes) maxdepth(20000) replace
def ql(ERRMSG) defpsist(yes) maxdepth(20000) replace
alter qmgr deadq(deadq)

def ql(199_1) maxdepth(10000) defpsist(yes) maxmsgl(1048576) replace

def qr(00_1) rname(00_1) rqmname(QM00) xmitq(QM00) defpsist(yes) replace

def ql(QM00) usage(xmitq) defpsist(yes) maxdepth(10000) maxmsgl(1048576) trigger trigtype(first) trigdata(199_00) initq(system.channel.initq) replace
def chl(199_00) chltype(sdr) discint(1800) conname('192.168.1.33(6666)') xmitq(QM00) trptype(tcp) shortrty(10000) shorttmr(30) longtmr(300) longrty(999999999) batchsz(50) replace
def chl(00_199) chltype(rcvr) trptype(tcp) replace

def listener(QM199) trptype(tcp)
alter listener(QM199) trptype(tcp) port(6666) control(qmgr)
alter qmgr ccsid(819)
end
free counters