ITeye博客

烂笔头

meiping · 共 41 篇文章

Resin3.x日志滚动

可以按照日志大小和时间滚动,对日志还支持压缩zip和gzip压缩 <stdout-log path-format="log/stdout.log.%Y%m%d" timestamp="[%Y-%m-%d %H:%M:%S] " rollover-period="1D" rollover-size="200mb" />

2011-03-12 11:29 · Java · 评论(0)

Resin3.x日志的名称

log name value Meaning "" Debug everything com.caucho.jsp Debug jsp com.caucho.java Java compilation com.caucho.xsl XSL debugging com.caucho.server.port TCP port debugging and threading com.caucho.server.port.AcceptPool port thread creation com.caucho.server.http HTTP-related debugging com.caucho.s…

2011-03-12 11:24 · Java · 评论(0)

List的遍历条件删除

List的遍历条件删除 List<Integer> l = new ArrayList<Integer>(); for (int i = 0; i < 10; i++) { l.add(i); } // 方法1,目标是删除1 for (int i = 0; i < l.size(); i++) { if (l.get(i) == 1) { l.remove(i); } } System.out.println(l); // 方法2,目标是删除2 Iterator<Integer> it = l.iterator(); while (it.hasNext()) { if (it.next() …

2011-03-11 17:40 · Java · 评论(0)

Hibernate在Resin下部署多个c3p0数据源

环境: resin3.x hibernate3 c3p0-0.9.1 单纯的使用hibernate,没有spring来配合,如果同一个resin下配置了多个c3p0连接池,则会报错,错误信息如下: A C3P0Registry mbean is already registered. This probably means that an application using c3p0 was undeployed, but not all PooledDataSources were close d prior to undeployment. This may lead to resour…

2011-03-11 17:22 · Java · 评论(0)

Hibernate对应MySQL的Text字段

Hibernate3.6.1,MySQL5InnoDBDialect 如果hbm文件中property元素的type属性是string,则当不指定column中的length属性时,ddl中默认为varchar(255)。由于varchar(x)中x是与字符集有关系的,最多也就是65535,当指定的length超过65535时,hibernate知道肯定是不能用varchar了,所以自动选择用longtext,在小于等于65535的范围内,hibernate如实生成varchar(length)形式的ddl,能不能执行就看MySQL的了; 如果hbm文件中property元素的type属性是…

2011-03-04 23:34 · Java · 评论(0)

Resin3.x日志级别

和java.util.logging.Level中的日志级别对应 声明为 Level 的 java.util.logging 中的字段 static Level Level. ALL ALL 指示应该记录所有消息。 static Level Level. CONFIG CONFIG 是用于静态配置消息的消息级别。 static Level Level. FINE FINE 是提供跟踪信息的消息级别。 static Level Level. FINER FINER 指示一条相当详细的跟踪消息。 static Level Level. FINEST FINEST 指示一条最详细的跟踪消息。 st…

2011-02-24 10:08 · Java · 评论(0)

tomcat中多次加载jni时的错误

问题描述: 知识库经过精简之后做成了一个hr的版本,两个版本都要求使用海量分词,这个分词工具是用jni进行包装的,于是很自然的在两个web的lib下面分别放了一个aplit.jar作为jni入口,后来发现使用搜索的时候总是只有一个能用,另一个在加载海量分词动态库的时候挂起,也就是java的System.loadLibary函数,而且有一个规律,第一次加载这个库的web可以正常使用 解决: 这很自然的让人想起是loadLibrary这个函数有问题,于是另写一个测试用例,在纯java环境下多次加载同一个库,没有发现问题,是不是tomcat环境问题呢?很自然的怀疑web环境和纯java环境的不同,…

2011-02-22 22:27 · Java · 评论(0)

多目录编译经典makefile

# Readme: # use: make config # use: make dir # use: make # use: make clean # use: make rebuild # use: make cleanall # use: make test # use: make # firs of all, use "make config" or "make dir" to # build a source files struct. and then, # put your source files into the DIR src # link libs to the DIR…

2011-02-22 22:25 · C/C++ · 评论(0)

GNU autotool构建工程

目录结构如下: 其中configure.in/Makefile.am需要配置 在at目录下执行autoscan,对于出现的错误不予理睬(据称乃是版本错误,在网上发现过不出错的截图:>) autom4te: configure.ac: no such file or directory autoscan: /usr/bin/autom4te failed with exit status: 1 将生成的configure.scan文件改名为configure.in文件,对该文件进行编辑 AC_INIT(at, 1.0, robinmei@tencent.com ) AM_INIT_AUTOMA…

2011-02-22 22:21 · Linux · 评论(0)

UDP编程中recvfrom函数的最后一个参数问题

recvfrom的最后一个参数返回往客户端机构中写的数据字节数,这里应该使用sizeof()来求出sockaddr_in的大小,然后赋值给最后一个参数,否则取到的客户端地址不对而且不能正确发送返回数据

2011-02-22 22:20 · Linux · 评论(0)

标准库算法(sort)的用法

#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; bool compare(int l, int r) { return l < r; // 如果写死返回真则排序算法报错 } int main(int argc, char** argv) { vector<int> v; for (int i = 0; i < 10; i++) { v.push_back(i); } sort(v.begin(), v.end(), compare); for (…

2011-02-22 22:19 · C/C++ · 评论(0)

多米诺覆盖问题的回溯解法

题目:现有6*6大小的棋盘和18张多米诺骨牌,每张牌能覆盖2个棋格,求将多米诺骨牌完全覆盖棋盘的所有组合? #include <iostream> #include <string> #include <map> #include <stack> #include <set> #include <sstream> using namespace std; const int MAX_LENGTH = 2 * 3; set<string> result; //================= // 棋盘位置类 //================= class Position { priv…

2011-02-22 22:17 · C/C++ · 评论(0)

Java字符串的split函数特殊情况

split函数使用的分隔符需要注意特殊字符,比如正则表达式中的+/*以及|等,使用\\进行转义,否则会出现意外的情况

2011-02-22 22:15 · Java · 评论(0)

jpgraph的配置问题

jpgraph配置显示中文的时候将字体文件simsun.ttf拷贝到/usr/X11R6/lib/X11/fonts/truetype/目录 下,然后配-置jpg-config.inc.php文件,在使用的时候使用SetFout("FF_SIMSUN")来设置字体,在 jpgraph_ttf.inc.ph-p文件中设置具体的字体格式,如粗体,斜体等等

2011-02-22 22:14 · Web · 评论(0)

如何用CGI(C/C++)输出二进制内容

用CGI输出文本文件已是司空见惯,输出二进制呢?你尝试过吗? 下面的代码演示在linux下想浏览器输出Excel文件 tt.cpp #include <fstream> #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include "stdio.h" int main(int argc, char** argv) {…

2011-02-22 22:12 · C/C++ · 评论(0)