社区
ASP
帖子详情
请测试我的聊天室好吗? 版本已经更新了 下载 www.cpinfo.net/eden/eden.zip
Jera
2001-02-20 12:08:00
...全文
123
1
打赏
收藏
请测试我的聊天室好吗? 版本已经更新了 下载 www.cpinfo.net/eden/eden.zip
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
huangbenny
2001-02-20
打赏
举报
回复
让我试试看!
jclasslib 工具修改.class文件,同时需要jad.exe做辅助
修改jar包中变量 或者长量 步骤如下: 1.用jd-gui打开该jar 怎么打开不用我说了吧? 打开之后找到 要修改提示信息 的class文件 这里找到的是GenEntity 找到对应需要修改的代码所在的方法名 我这里包含提示信息的这段代码在方法 getAllDataBase() 如下图: 2.用jd-gui或者winrar把GenEntity.class 解压出来到C盘 (目录无所谓) 3.双击桌面上安装好了的 jc lasslib bytecode viewer ,点击软件的 File -- Open Class File 打开你刚解压出来的class文件 4.点击methods--getAllDataBase--Code methods是表示方法不用说吧 getAllDataBase是刚在jd-gui里面找到的方法名 Code包含了getAllDataBase方法里所有的信息 找到"不能打开数据库连接,
请
检查!" 这里这个工具没有提供搜索功能 如果这里很多内容 那么你可以点击 copy to clipboard把这里的内容复制到一个文本文件里面然后再搜索 这里找到的是第82行 5.点击第 82行后面的 #34 会跳转到Constant Pool常量池的第34个常量 6.再点右边的
cp
info
#362 会跳转到第362个常量 这里能看到String: 不能打开数据库连接,
请
检查! 也就是最后输出的信息 7.找到GenEntity.class的关键常量了现在就该修改它了 在eclipse里面新建一个Test来处理GenEntity.class [java] view plain copy import java.io.*; import org.gjt.jclasslib.io.ClassFileWriter; import org.gjt.jclasslib.structures.
CP
Info
; import org.gjt.jclasslib.structures.ClassFile; import org.gjt.jclasslib.structures.constants.ConstantUtf8
Info
; public class Test { public static void main(String[] args) throws Exception { String filePath = "C:\\GenEntity.class"; FileInputStream fis = new FileInputStream(filePath); DataInput di = new DataInputStream(fis); ClassFile cf = new ClassFile(); cf.read(di);
CP
Info
[]
info
s = cf.getConstantPool(); int count =
info
s.length; for (int i = 0; i < count; i++) { if (
info
s[i] != null) { System.out.print(i); System.out.print(" = "); System.out.print(
info
s[i].getVerbose()); System.out.print(" = "); System.out.println(
info
s[i].getTagVerbose()); if(i == 362){ ConstantUtf8
Info
u
Info
= (ConstantUtf8
Info
)
info
s[i]; u
Info
.setBytes("芝麻不开门!".getBytes());
info
s[i]=u
Info
; } } } cf.setConstantPool(
info
s); fis.close(); File f = new File(filePath); ClassFileWriter.writeToFile(f, cf); } } 这里需要注意"C:\\GenEntity.class"是我存放class的目录 if(i == 362) 这里是刚我在第七步找到的常量序号 "芝麻不开门!"这里是我想修改的文字信息! 运行Test.java 会有如下提示信息 没有报错就证明正常的 如果报错那么就有问题 9.把C盘刚修改后的GenEntity.class替换掉原来的GenEntity.class 怎么替换不用我说了吧.. 用winrar打开.jar 然后把GenEntity.class拖进去覆盖就行了 10.运行效果..
生日祝福系统 有动画 音乐
非常好用的生日祝福系统 #include "stdafx.h" // Standard windows header file #include "BCMenu.h" // BCMenu class declaration #include //SK: makes A2W and other spiffy AFX macros work #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define GAP 1 #ifndef OBM_CHECK #define OBM_CHECK 32760 // from winuser.h #endif #if _MFC_VER <0x400 #error This code does not work on Versions of MFC prior to 4.0 #endif static
CP
INFO
CP
Info
; enum Win32Type{ Win32s, Windoze95, WinNT3, WinNT4orHigher }; Win32Type IsShellType() { Win32Type ShellType; DWORD winVer; OSVERSION
INFO
*osvi; winVer=GetVersion(); if(winVerdwOSVersion
Info
Size=sizeof(OSVERSION
INFO
); GetVersionEx(osvi); if (osvi->dwMajorVersion>=4L) ShellType=WinNT4orHigher;//yup, it is NT 4 or higher! free(osvi); } } else if (LOBYTE(LOWORD(winVer))<4) ShellType=Win32s;/*Win32s*/ else ShellType=Windoze95;/*Windoze95*/ return ShellType; } static Win32Type g_Shell=IsShellType();
jclasslib与javassist案例.doc
jclasslib与javassist案例.doc
Killtest 分享156-315.65 题库
Killtest免费提供最新的 156-315.65 考试资料
下载
~~欢迎广大用户使用。
数据连接池
package com.
cp
info
.his.db; import java.io.*; import java.sql.*; import java.util.*; import java.util.Date; /** * 数据库连接池 * 单例对象 */ public class DBConnectionManager { static private DBConnectionManager instance; // 唯一实例 static private int clients; private Vector
drivers = new Vector
(); private PrintWriter log; private Hashtable
pools = new Hashtable
(); /** * 返回唯一实例.如果是第一次调用此方法,则创建实例 * * @return DBConnectionManager 唯一实例 */ static synchronized public DBConnectionManager getInstance() { if (instance == null) { instance = new DBConnectionManager(); } clients++; return instance; } /** * 建构函数私有以防止其它对象创建本类实例 */ private DBConnectionManager() { init(); } /** * 将连接对象返回给由名字指定的连接池 * * @param name 在属性文件中定义的连接池名字 * @param con 连接对象 */ public void freeConnection(String name, Connection con) { DBConnectionPool pool = (DBConnectionPool) pools.get(name); if (pool != null) { pool.freeConnection(con); } } /** * 获得一个可用的(空闲的)连接.如果没有可用连接,且已有连接数小于最大连接数 * 限制,则创建并返回新连接 * * @param name 在属性文件中定义的连接池名字 * @return Connection 可用连接或null */ public Connection getConnection(String name) { DBConnectionPool pool = (DBConnectionPool) pools.get(name); if (pool != null) { return pool.getConnection(); } return null; } /** * 获得一个可用连接.若没有可用连接,且已有连接数小于最大连接数限制, * 则创建并返回新连接.否则,在指定的时间内等待其它线程释放连接. * * @param name 连接池名字 * @param time 以毫秒计的等待时间 * @return Connection 可用连接或null */ public Connection getConnection(String name, long time) { DBConnectionPool pool = (DBConnectionPool) pools.get(name); if (pool != null) { return pool.getConnection(time); } return null; } /** * 关闭所有连接,撤销驱动程序的注册 */ public synchronized void release() { // 等待直到最后一个客户程序调用 if (--clients != 0) { return; } Enumeration
allPools = pools.elements(); while (allPools.hasMoreElements()) { DBConnectionPool pool = allPools.nextElement(); pool.release(); } Enumeration
allDrivers = drivers.elements(); while (allDrivers.hasMoreElements()) { Driver driver = allDrivers.nextElement(); try { DriverManager.deregisterDriver(driver); log("撤销JDBC驱动程序 " + driver.getClass().getName() + "的注册"); } catch (SQLException e) { log(e, "无法撤销下列JDBC驱动程序的注册: " + driver.getClass().getName()); } } } /** * 根据指定属性创建连接池实例. * * @param props 连接池属性 */ private void createPools(Properties props) { Enumeration propNames = props.propertyNames(); while (propNames.hasMoreElements()) { String name = (String) propNames.nextElement(); if (name.endsWith(".url")) { String poolName = name.substring(0, name.lastIndexOf(".")); String url = props.getProperty(poolName + ".url"); if (url == null) { log("没有为连接池" + poolName + "指定URL"); continue; } String user = props.getProperty(poolName + ".user"); String password = props.getProperty(poolName + ".password"); String maxconn = props.getProperty(poolName + ".maxconn", "0"); int max; try { max = Integer.valueOf(maxconn).intValue(); } catch (NumberFormatException e) { log("错误的最大连接数限制: " + maxconn + " .连接池: " + poolName); max = 0; } DBConnectionPool pool = new DBConnectionPool(poolName, url, user, password, max); pools.put(poolName, pool); log("成功创建连接池" + poolName); } } } /** * 读取属性完成初始化 */ private void init() { InputStream is = getClass().getResourceAsStream("/db.properties"); Properties dbProps = new Properties(); try { dbProps.load(is); } catch (Exception e) { System.err.println("不能读取属性文件. " + "
请
确保db.properties在CLASSPATH指定的路径中"); return; } String logFile = dbProps.getProperty("logfile", "DBConnectionManager.log"); try { log = new PrintWriter(new FileWriter(logFile, true), true); } catch (IOException e) { System.err.println("无法打开日志文件: " + logFile); log = new PrintWriter(System.err); } loadDrivers(dbProps); createPools(dbProps); } /** * 装载和注册所有JDBC驱动程序 * * @param props 属性 */ private void loadDrivers(Properties props) { String driverClasses = props.getProperty("drivers"); StringTokenizer st = new StringTokenizer(driverClasses); while (st.hasMoreElements()) { String driverClassName = st.nextToken().trim(); try { Driver driver = (Driver) Class.forName(driverClassName).newInstance(); DriverManager.registerDriver(driver); drivers.addElement(driver); log("成功注册JDBC驱动程序" + driverClassName); } catch (Exception e) { log("无法注册JDBC驱动程序: " + driverClassName + ", 错误: " + e); } } } /** * 将文本信息写入日志文件 */ private void log(String msg) { log.println(new Date() + ": " + msg); } /** * 将文本信息与异常写入日志文件 */ private void log(Throwable e, String msg) { log.println(new Date() + ": " + msg); e.printStackTrace(log); } /** * 此内部类定义了一个连接池.它能够根据要求创建新连接,直到预定的最 * 大连接数为止.在返回连接给客户程序之前,它能够验证连接的有效性. */ class DBConnectionPool { private int checkedOut; private Vector
freeConnections = new Vector
(); private int maxConn; private String name; private String password; private String URL; private String user; /** * 创建新的连接池 * * @param name 连接池名字 * @param URL 数据库的JDBC URL * @param user 数据库帐号,或 null * @param password 密码,或 null * @param maxConn 此连接池允许建立的最大连接数 */ public DBConnectionPool(String name, String URL, String user, String password, int maxConn) { this.name = name; this.URL = URL; this.user = user; this.password = password; this.maxConn = maxConn; } /** * 将不再使用的连接返回给连接池 * * @param con 客户程序释放的连接 */ public synchronized void freeConnection(Connection con) { // 将指定连接加入到向量末尾 freeConnections.addElement(con); checkedOut--; notifyAll(); } /** * 从连接池获得一个可用连接.如没有空闲的连接且当前连接数小于最大连接 * 数限制,则创建新连接.如原来登记为可用的连接不再有效,则从向量删除之, * 然后递归调用自己以尝试新的可用连接. */ public synchronized Connection getConnection() { Connection con = null; if (freeConnections.size() > 0) { // 获取向量中第一个可用连接 con = (Connection) freeConnections.firstElement(); freeConnections.removeElementAt(0); try { if (con.isClosed()) { log("从连接池" + name + "删除一个无效连接"); // 递归调用自己,尝试再次获取可用连接 con = getConnection(); } } catch (SQLException e) { log("从连接池" + name + "删除一个无效连接"); // 递归调用自己,尝试再次获取可用连接 con = getConnection(); } } else if (maxConn == 0 || checkedOut < maxConn) { con = newConnection(); } if (con != null) { checkedOut++; } return con; } /** * 从连接池获取可用连接.可以指定客户程序能够等待的最长时间 * 参见前一个getConnection()方法. * * @param timeout 以毫秒计的等待时间限制 */ public synchronized Connection getConnection(long timeout) { long startTime = new Date().getTime(); Connection con; while ( (con = getConnection()) == null) { try { wait(timeout); } catch (InterruptedException e) {} if ( (new Date().getTime() - startTime) >= timeout) { // wait()返回的原因是超时 return null; } } return con; } /** * 关闭所有连接 */ public synchronized void release() { Enumeration
allConnections = freeConnections.elements(); while (allConnections.hasMoreElements()) { Connection con = allConnections.nextElement(); try { con.close(); log("关闭连接池" + name + "中的一个连接"); } catch (SQLException e) { log(e, "无法关闭连接池" + name + "中的连接"); } } freeConnections.removeAllElements(); } /** * 创建新的连接 */ private Connection newConnection() { Connection con = null; try { if (user == null) { con = DriverManager.getConnection(URL); } else { con = DriverManager.getConnection(URL, user, password); } log("连接池" + name + "创建一个新的连接"); } catch (SQLException e) { log(e, "无法创建下列URL的连接: " + URL); return null; } return con; } } protected void finalize() throws SQLException { instance.release(); System.out.println("释放所有链接池对象!"); } }
ASP
28,405
社区成员
356,946
社区内容
发帖
与我相关
我的任务
ASP
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
复制链接
扫一扫
分享
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章