菠萝三国

大江东去,浪淘尽...
随笔 - 34, 文章 - 47, 评论 - 22, 引用 - 0
数据加载中……

C3P0连接池详细配置(转)

<c3p0-config>
<default-config>
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement">3</property>

<!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 -->
<property name="acquireRetryAttempts">30</property>

<!--两次连接中间隔时间,单位毫秒。Default: 1000 -->
<property name="acquireRetryDelay">1000</property>

<!--连接关闭时默认将所有未提交的操作回滚。Default: false -->
<property name="autoCommitOnClose">false</property>

<!--c3p0将建一张名为Test的空表,并使用其自带的查询语句进行测试。如果定义了这个参数那么
属性preferredTestQuery将被忽略。你不能在这张Test表上进行任何操作,它将只供c3p0测试
使用。Default: null-->
<property name="automaticTestTable">Test</property>

<!--获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常。但是数据源仍有效
保留,并在下次调用getConnection()的时候继续尝试获取连接。如果设为true,那么在尝试
获取连接失败后该数据源将申明已断开并永久关闭。Default: false-->
<property name="breakAfterAcquireFailure">false</property>

<!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出
SQLException,如设为0则无限期等待。单位毫秒。Default: 0 -->
<property name="checkoutTimeout">100</property>

<!--通过实现ConnectionTester或QueryConnectionTester的类来测试连接。类名需制定全路径。
Default: com.mchange.v2.c3p0.impl.DefaultConnectionTester-->
<property name="connectionTesterClassName"></property>

<!--指定c3p0 libraries的路径,如果(通常都是这样)在本地即可获得那么无需设置,默认null即可
Default: null-->
<property name="factoryClassLocation">null</property>

<!--Strongly disrecommended. Setting this to true may lead to subtle and bizarre bugs.
(文档原文)作者强烈建议不使用的一个属性-->
<property name="forceIgnoreUnresolvedTransactions">false</property>

<!--每60秒检查所有连接池中的空闲连接。Default: 0 -->
<property name="idleConnectionTestPeriod">60</property>

<!--初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
<property name="initialPoolSize">3</property>

<!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime">60</property>

<!--连接池中保留的最大连接数。Default: 15 -->
<property name="maxPoolSize">15</property>

<!--JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements
属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。
如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0-->
<property name="maxStatements">100</property>

<!--maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数。Default: 0 -->
<property name="maxStatementsPerConnection"></property>

<!--c3p0是异步操作的,缓慢的JDBC操作通过帮助进程完成。扩展这些操作可以有效的提升性能
通过多线程实现多个操作同时被执行。Default: 3-->
<property name="numHelperThreads">3</property>

<!--当用户调用getConnection()时使root用户成为去获取连接的用户。主要用于连接池连接非c3p0
的数据源时。Default: null-->
<property name="overrideDefaultUser">root</property>

<!--与overrideDefaultUser参数对应使用的一个参数。Default: null-->
<property name="overrideDefaultPassword">password</property>

<!--密码。Default: null-->
<property name="password"></property>

<!--定义所有连接测试都执行的测试语句。在使用连接测试的情况下这个一显著提高测试速度。注意:
测试的表必须在初始数据源的时候就存在。Default: null-->
<property name="preferredTestQuery">select id from test where id=1</property>

<!--用户修改系统配置参数执行前最多等待300秒。Default: 300 -->
<property name="propertyCycle">300</property>

<!--因性能消耗大请只在需要的时候使用它。如果设为true那么在每个connection提交的
时候都将校验其有效性。建议使用idleConnectionTestPeriod或automaticTestTable
等方法来提升连接测试的性能。Default: false -->
<property name="testConnectionOnCheckout">false</property>

<!--如果设为true那么在取得连接的同时将校验连接的有效性。Default: false -->
<property name="testConnectionOnCheckin">true</property>

<!--用户名。Default: null-->
<property name="user">root</property>

<!--早期的c3p0版本对JDBC接口采用动态反射代理。在早期版本用途广泛的情况下这个参数
允许用户恢复到动态反射代理以解决不稳定的故障。最新的非反射代理更快并且已经开始
广泛的被使用,所以这个参数未必有用。现在原先的动态反射与新的非反射代理同时受到
支持,但今后可能的版本可能不支持动态反射代理。Default: false-->
<property name="usesTraditionalReflectiveProxies">false</property>

<property name="automaticTestTable">con_test</property>
<property name="checkoutTimeout">30000</property>
<property name="idleConnectionTestPeriod">30</property>
<property name="initialPoolSize">10</property>
<property name="maxIdleTime">30</property>
<property name="maxPoolSize">25</property>
<property name="minPoolSize">10</property>
<property name="maxStatements">0</property>
<user-overrides user="swaldman">
</user-overrides>
</default-config>
<named-config name="dumbTestConfig">
<property name="maxStatements">200</property>
<user-overrides user="poop">
<property name="maxStatements">300</property>
</user-overrides>
</named-config>
</c3p0-config>

posted @ 2008-01-18 11:58 菠萝 阅读(233) | 评论 (0)编辑 收藏

修改jfreechart中的默认字体

生成图表后自动生成chart表的问题:

我测试生成图表中的中文问题都解决了,但是每次生成chart图时会报UTF编码错误,从错误判断应该是某个文件的编码错误,起初根据错误判断是filter的问题,可是filter那点代码中根本不涉及编码的问题.我将很多配置文件的编码都改了也不行.因为那个英文例子没问题,我查看了JFreechart的一个servlet(org.jfree.chart.servlet.DisplayChart),因为jpviot就是调用这个servlet实现绘图的,分析这个servlet我知道它会在一个临时目录生成png文件,然后交给servlet写到浏览器的响应中去,我找到那个临时目录(tomcattemp),发现里面已经生成了正确的中文图形.从而判断图形生成正确,但是写到浏览器中时出了问题.最后我查看能生成英文图表的那个例子,发觉不仅仅在html中生成图形,而且生成map.而这个map的生成全是在程序中做的,程序生成一个xml文件,通过chart.xsl解析生成map的最终html代码.但是在程序中生成时并没有加入编码设置,因此问题出在生成map这儿.

最终修改代码如下:

com.tonbeller.jpivot.chart.ChartComponent:

在render函数中修改如下:

String desc="<?xml version="1.0" encoding="gb2312"?>";
String xchart =desc+"n"+ "<xchart>" + writeImageMap(filename, info, false) + "</xchart>";
这样就为xchart设置了编码.

修改jfreechart中的默认字体:

com.tonbeller.jpivot.chart.ChartComponent中定义了几种字体,但是这几种字体都是英文字体,我将其修改为宋体:
把所有的字体定义都改为"SimSun"
注意到这儿并没有玩,如果你仅仅修改程序,仍旧会出现问题,报错说没有适合"SimSun"的item
同时要修改一个配置文件:WEB-INFjpivotchartchartpropertiesform.xml
在这个配置文件中将SimSun加入其中,形式如下:

<listBox1 type="string" modelReference="fontName" label="Title font">
<listItem value="SansSerif" label="SansSerif"/>
<listItem value="Serif" label="Serif"/>
<listItem value="SimSun" label="SimSun"/>
<listItem value="Monospaced" label="Monospaced"/>
</listBox1>

posted @ 2008-01-14 12:20 菠萝 阅读(1198) | 评论 (0)编辑 收藏

jfreechart在aix unix上的中文显示问题

 

 

今天开始搭建新的平台,要把原来windows的应用迁移到Aix上,结果由于jfreechart的中文字体显示耗了整个下午,好不郁闷,不过还好最后解决问题了:)
     
主机环境:
 AIX Version 5.2 + Jboss4.03sp1 + J2RE 1.4.2 IBM AIX build ca142ifx-20050119
 使用jfreechart1.0rc

添加启动参数 -Djava.awt.headless=true才能正常显示jfreechart的图.

让jre使用中文字体的过程如下:

1.解包字体文件
TrueType_zhCN_GBK.tar,列表如下:
fangsongti.ttf
heiti.ttf
kaiti.ttf
songti.ttf
注:字体包是我以前在solaris上整出来的.

2.copy字体到jre的字体目录${JAVA_HOME}/jre/lib/fonts


3.修改JRE的字体配置
3.1 修改fonts.scale文件[${JAVA_HOME}/jre/lib/fonts/fonts.scale]
把一行的数字加4
在文件尾添加
fangsongti.ttf -zhongyi-fangsong-medium-r-normal--0-0-0-0-m-0-gbk-0
heiti.ttf -zhongyi-hei-medium-r-normal--0-0-0-0-m-0-gbk-0
kaiti.ttf -zhongyi-kai-medium-r-normal--0-0-0-0-m-0-gbk-0
songti.ttf -zhongyi-song-medium-r-normal--0-0-0-0-m-0-gbk-0
3.2 修改fonts.dir文件[${JAVA_HOME}/jre/lib/fonts/fonts.dir]
把一行的数字加4
在文件尾添加
fangsongti.ttf -zhongyi-fangsong-medium-r-normal--0-0-0-0-m-0-gbk-0
heiti.ttf -zhongyi-hei-medium-r-normal--0-0-0-0-m-0-gbk-0
kaiti.ttf -zhongyi-kai-medium-r-normal--0-0-0-0-m-0-gbk-0
songti.ttf -zhongyi-song-medium-r-normal--0-0-0-0-m-0-gbk-0
3.3 修改font.properties.zh文件[${JAVA_HOME}/jre/lib/font.properties.zh]
把所有的serif.1的值 进行如下替换
-zhongyi-song-medium-r-normal--0-0-0-0-m-0-gbk-0


4.重新启动就可以了.

 

其他的unix上我试了一下hp-unix,可以通过,其他的没有试过,或许也可以吧:)

posted @ 2008-01-14 12:18 菠萝 阅读(1108) | 评论 (9)编辑 收藏

修改字体

//X軸下標字體大小及顏色
Axis axis1 = plot.getDomainAxis();
axis1.setLabelFont(new Font("sansserf",Font.PLAIN,30));//字體
axis1.setLabelPaint(Color.white);//顏色
 
//X軸的字體顏色
Axis axis = plot.getDomainAxis();
axis.setTickLabelFont(new Font("Serif", Font.PLAIN,25));//字體
axis.setTickLabelPaint(Color.white);//顏色 
 
//Y軸字下標字體大小及顏色
Axis axis2 = plot.getRangeAxis();
axis2.setLabelFont(new Font("Serif", Font.PLAIN, 30));//字體  
axis2.setLabelPaint(Color.white); //顏色
 
//Y軸字體及顏色
Axis axis3 = plot.getRangeAxis();
axis3.setTickLabelFont(new Font("Serif", Font.PLAIN, 25));//字體  
axis3.setTickLabelPaint(Color.white);//顏色

posted @ 2008-01-14 12:10 菠萝 阅读(236) | 评论 (0)编辑 收藏

WebBrowser.ExecWB方法

WebBrowser.ExecWB(1,1) 打开
WebBrowser.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
WebBrowser.ExecWB(4,1) 保存网页
WebBrowser.ExecWB(6,1) 打印
WebBrowser.ExecWB(7,1) 打印预览
WebBrowser.ExecWB(8,1) 打印页面设置
WebBrowser.ExecWB(10,1) 查看页面属性
WebBrowser.ExecWB(15,1) 好像是撤销,有待确认
WebBrowser.ExecWB(17,1) 全选
WebBrowser.ExecWB(22,1) 刷新
WebBrowser.ExecWB(45,1) 关闭窗体无提示

 

其中最后一项WebBrowser.ExecWB(45,1)可以有效解决IE7下,使用

WebBrowser.ExecWB(7,1)执行打印预览后返回到原窗口时,window.close()方法失效的问题

posted @ 2008-01-03 13:08 菠萝 阅读(1504) | 评论 (1)编辑 收藏

iframe高度自适应(转)

<iframe name="src" width="100%" frameborder=0 scrolling=no src='admin.htm?catId=<c:out value="${model.l}" />'
        onload="this.height =   document.frames['src'].document.body.scrollHeight" />

例子:
1,创建页面 test.html 。 页面中含有一个 iframe,name为 ifrname ,id为 ifrid, src 为 iframe.html页面。
<iframe src="ifarme.html" name="ifrname" height="" style="" onload="" id="ifrid"   scrolling=""> </iframe>

2,创建 iframe.html 页面,里面含有一些内容。
<p>
这是iframe页面,通过在父窗口页面或子页面添加JS来自动更改宽高,以适应内容的多少。
</p>
要想使iframe自动适应宽和高,可以在 test.html 页面iframe onload处增加一些JS代码。如:
   <iframe src="ifarme.html" name="ifrname" height="" style="" onload="this.height =   document.frames["ifrname"].document.body.scrollHeight" id="ifrid"   scrolling=""></iframe>

这样iframe即可以自动适应高度了。如果不在onload处增加js,那也可以放到页面上来调用。比如写个函数。
<script>
function setAutoHeight(iframeElement,   iframeWindow) {
iframeElement.style.height = iframeWindow.document.body.scrollHeight;
iframeElement.style.width   =   iframeWindow.document.body.scrollWidth   ;
// 或者
// iframeElement.height = iframeWindow.document.body.offsetHeight ;
// iframeElement.width   =   iframeWindow.document.body.offsetWidth;

}
//调用函数setAutoHeight();
setAutoHeight( document.getElementById("iframeid"), window.frames[0]   );
</script>
这样也可以达到自适应高宽的目的,在这里要注意的是,iframeElement参数必须是 document.getElementById("iframeid"), iframeWindow参数是 window.frames[0] 或document.frames["ifrname"]。 这是因为通过name得到的对象是窗口(window)对象,非窗口里的iframe对象。同时document.getElementById("iframeid)不能像window对象可以得到window.document。
所以这里最好给iframe分别加上name和id,id用来更改宽高样式属性,name用来执行window相关事件如location.href,document.write。bgColor例外,元素对象和窗口对象都可以得到,这是因为他们都有这个属性。
如果要隐藏iframe滚动条,可以设置iframeWindow.scrolling = "no";但这不能兼容多个浏览器,用iframeElement.document.body.style.overflow = "hidden";这种或直接在iframe处增加scrolling="no" html代码就可以很好地兼容了。
3,如果不能修改父页面,而只能把代码增加在iframe页面里呢?
可以写个类似函数,放在iframe页面里:
<script>
function setAutoHeight( parentIframeElement, slefDocument ){
slefDocument.style.overflow = "hidden";           // 隐藏全部滚动条
// document.body.style.overflowY = "hidden";   // 没有竖滚动条
parentIframeElement.style.height = slefDocument.scrollHeight;
parentIframeElement.style.width   =   slefDocument.scrollWidth;
}
// 在页面最后执行
setAutoHeight(parent.document.getElementById("ifrid"), document.body);
// 或onload时执行
//window.onload = function() {
//    setAutoHeight(parent.document.getElementById("ifrid"), document.body);
//}
// 或者超时执行
// setTimeout(
//    function() {
//      setAutoHeight(parent.document.getElementById("ifrid"), document.body);
//   },
// 200 );
</script>

4,在线通过iframe更改父窗口里iframe的宽高,因为安全原因会有跨域的问题,若是不在同一域名,那是被禁止的。如果同在一个域名下,但2级域名不同,比如a.yourcompany.com 和b.yourcompany.com。
这时可以通过重新设置document.domain 来跨越2级域名。
var domain = "yourcompany.com";
try {
    if( document.domain.indexOf(domain)   != -1 ) {
      document.domain = domain;                   // set new document.domain;
    }
} catch (ex) {
    alert("error: " + ex.toString() );
}
如果域名含有yourcompany.com,则改将document.domain改为yourcompany.com

posted @ 2007-12-03 12:28 菠萝 阅读(281) | 评论 (0)编辑 收藏

高校ftp,密码一百年不变

高校ftp,密码一百年不变.好东东不少~~
高校ftp,密码一百年不变.好东东不少,速度狂快(夸张点说是一百年,但现在还可以用的)
ftp://smu:smc@218.5.241.10  主机:218.5.241.10 用户名:smu 密码: smc
是教育网的,电信的可能很快,大家都来看看,里面很多软件和电影
   
      看了,不要忘记跟贴哦。。。
友情提示:下载后,请自行查毒!

posted @ 2007-12-02 21:43 菠萝 阅读(343) | 评论 (0)编辑 收藏

我的链接

Tomcat专题
http://www.chinaitlab.com/www/techspecial/tomcat/

EXT
http://www.dojochina.com/

posted @ 2007-11-28 22:01 菠萝 阅读(139) | 评论 (0)编辑 收藏

Aptana 插件

Plugging Aptana into an existing Eclipse configuration

From Aptana

This page describes how to install into an existing Eclipse configuration.

Contents

[hide]

Introduction

If you are already an Eclipse user, you can install Aptana as a plug-in directly into your current Eclipse configuration.

Instructions

To plug Aptana (Milestone 8+) into an existing Eclipse (v3.2) configuration:

     

  1. From the Help menu in Eclipse, select Software Updates > Find and Install... to open an Install/Update pop-up window (shown below).

    Image:installUpdate.png

  2. On the Install/Update pop-up window, choose the Search for new features to install option, and click the Next button.
  3. Add a new remote site to add the Aptana plug-in:
    1. Click the New Remote Site... button to open a New Update Site pop-up window.
    2. On the New Update Site pop-up window, type Aptana in the site Name text box.
    3. In the URL text box, type the URL for the Aptana update site: http://update.aptana.com/install/3.2/ (shown below) and click OK.

      Image:updateAptana.png

    4. Click the Finish button to switch to the Updates window.
  4. On the Updates window, check the Aptana box (shown below), and click the Finish button.

    Image:includeAptana.png

  5. On the next screen, check the Aptana box, and click the Next button.
  6. Choose the option to accept the terms of the license agreement, and click the Next button.
  7. Click the Finish button.
  8. Click the Install All button.

     

 

Eclipse installs the Aptana plug-in. To finish the installation process, follow the prompts to shut down and re-start Eclipse.

To access all of Aptana's features as they are described in the Aptana documentation, you will need to change your Eclipse Perspective to the Aptana perspective. See Changing your Eclipse Perspective for instructions on how to change your Eclipse Perspective.


Installing manually

Download the latest release from http://update.aptana.com/install/3.2/ and follow the manual installation instructions on the page.

Note: You may need to start Eclipse from the command-line with the "clean" option: eclipse -clean if the update didn't seem to work correctly.

Related Topics

posted @ 2007-11-19 22:32 菠萝 阅读(1084) | 评论 (0)编辑 收藏

vsftp500错误简单解决方法

 

cannot change directory:/home/***

ftp服务器连接失败,错误提示:
500 OOPS: cannot change directory:/home/*******
500 OOPS: child died
解决方法:
 # setsebool ftpd_disable_trans 1
  # service vsftpd restart


为避免每次开机都要作这个操作,可在setsebool命令后面加上-P选项,使改动永久有效。

posted @ 2007-11-07 22:59 菠萝 阅读(594) | 评论 (0)编辑 收藏

仅列出标题
共4页: 上一页 1 2 3 4 下一页