Lotus教程、Java教程、Java虚拟机、Java软件综合开发社区

Lotus、Domino、Java、C#、Web、数据库综合开发教程、资料社区

Archive for the ‘转载’ Category

用批处理文件删除n天前的文件

Published by admin on 05月 7, 2012

服务器用来备份数据的硬盘过段时间就会被备份文件占满,弄得我老是要登录到服务器去手工删除那些老的文件,有时忘记了就会导致硬盘空间不足而无法备份。
因为只要保留最近几天的备份,如果可以做一个批处理让系统自动删除老备份文件就好了,但是Windows的命令行和Linux的Shell比起来功能差了很多,到底行不行我自己也不清楚。
于是上网查了一下各位大虾发的帖子,再经过自己的摸索和尝试,发现只要花点功夫还是能实现这个功能的。
下面来看看我的实现方法。

如果操作系统是 Windows Server 2003 那就好办了,因为它有一个forfiles命令能够查找满足指定条件的文件,下面是这个命令的用法。
forfiles /p <目标目录名> /d <天数> /c <执行的命令>

Read the rest of this entry »

为ckeditor编辑器添加行距功能

Published by admin on 05月 6, 2012

在选用ckeditor编辑器是,感觉缺少行距功能而遗憾,网上搜索资料零散,却很少有系统的例子,为此收集并整理,提供例子下载。为ckeditor编辑器添加行距功能,添加之后的效果如下:
Read the rest of this entry »

CKeditor加入中文字体

Published by admin on 05月 6, 2012

CKeditor确实非常好,但是编辑时,字体选择里面没有中文字体。可以按如下方法添加:

打开CKeditor目录里的config.js,在

CKEDITOR.editorConfig = function( config )
{
};
里添加如下代码:

Read the rest of this entry »

出现java.lang.IllegalArgumentException: id to load is required for loading的解决方法

Published by admin on 05月 1, 2012

使用了hibernate进行关系映射的时候,比如有一对多的关系,一个测试项目对应多个测试用例模块,部分的关系映射表:

代码

<many-to-one name=”testProject” class=”com.eyely.pojos.TestProject”>
<column name=”f_test_project_id” sql-type=”nvarchar2(32)” />
</many-to-one>
<set name=”testCaseModules” lazy=”true” inverse=”false”>
<key>
<column name=”f_test_project_id” sql-type=”nvarchar2(32)” />
</key>
<one-to-many class=”com.eyely.pojos.TestCaseModule”/>
</set>

相关Java文件:

Read the rest of this entry »

如何查看ORACLE的版本?

Published by admin on 03月 2, 2012

COL PRODUCT FORMAT A35 COL VERSION FORMAT A15

COL STATUS FORMAT A15

SELECT * FROM PRODUCT_COMPONENT_VERSION;

Deployment failure on Tomcat 6.x. Could not copy all resources to

Published by admin on 02月 8, 2012

Deployment failure on Tomcat 6.x. Could not copy all resources to C:\tomcat6\webapps\OAPMS. If a file is locked, you can wait until the lock times out to redeploy, or stop the server and redeploy, or manually remove the deployment at C:\tomcat6\webapps\OAPMS

问题已解决,记得之前遇到过一次,但这次和前一次又不一样,解决办法:
1. 查看工程下的.mymetadata 看是否少了一个context-root=“” 属性,少的话,加上,值和前边的name属性一样,比如我的:
<?xml version=”1.0″ encoding=”UTF-8″?>
<project-module
type=”WEB”
name=”OAPMS”
id=”myeclipse.1191910938406″
context-root=”/OAPMS”
j2ee-spec=”1.4″
archive=”OAPMS.war”>
<attributes>
<attribute name=”webrootdir” value=”WebRoot” />
</attributes>
</project-module>

Read the rest of this entry »

在Eclipse中遇到The type XXX cannot be resolved. It is indirectly referenced from required .class files错误

Published by admin on 02月 3, 2012

在Eclipse中遇到The type XXX cannot be resolved. It is indirectly referenced from required .class files错误…..,查找的解决办法如下:

一:
It is indirectly referenced from required .class file原因:你正要使用的类调用了另一个类,而这个类又调用了其他类,这种关系可能会有好多层。而在这个调用的过程中,某个类所在的包的缺失就会造成以上那个错误。

解决方法:导入缺失的包
Read the rest of this entry »

[html5 canvas] 实现转换图片为灰度模式

Published by admin on 01月 29, 2012

需要把之前用jq来做的图片改”黑白”转成dojo实现

思路

么有思路..囧. 网上找到解决办法. 大概是如下这样. 因为需求说明了, 针对非IE浏览器.

  1. 在canvas中绘制出目标图像.
  2. 获取图像的所有像素点, getImageData().
  3. 遍历所有像素, 将RGB转换为灰度值(灰度值对应的RGB三个值相等. 即R=G=B=灰度值)
  4. 将处理之后的图片数据重新载入原图片, putImageData()

这里涉及到一个灰度值的计算公式, 网上找了些, 老版本的解决方案是grayscale= (R+G+B)/3, 然后将grayout赋值给RGB, 这个不够精确, 新版本为grayscale = R*0.3+G*0.59+B*0.11.

Read the rest of this entry »

css 背景图片平铺技巧

Published by admin on 11月 6, 2011

使用css来设置背景图片同传统的做法一样简单,但相对于传统控制方式,css提供了更多的可控选项,我们先来看看最基本的设置图片的方法。

xhtml代码:

<div id=”content”>
</div>

css代码:
#content {
border:1px solid #000fff;
height:500px;
background-image:url(images/bg.GIF);
}

网页中id为content的元素被我们设置了使用images文件夹下的bg.GIF作为背景,与传统表格式布局中的设置并无差别,在默认状态下,背景同样以平铺的方式出现在元素之中。然而使用css来控制背景当然不可能如此简单,实际上css为我们提供了更多用于控制背景的属性,包含可以控制元素是否需要平铺。改进后的代码:

Read the rest of this entry »

Oracle中”listener does not currently know of SID given in connect descriptor”

Published by admin on 10月 29, 2011

首先应该保证数据库的服务启动
在myeclipse的数据库视图中点 右键->new 弹出database driver的窗口,
Driver template选择oracle(thin driver),
Driver name 输入oracle
connection URL=jdbc:oracle:thin:@localhost:1521:oracle 注意localhost:1521:oracle中的oracle是数据库得sid换成你自己数据库的sid就可以
username:登陆数据库具有system权限的用户名
password:登陆数据库具有system权限的密码
点击add jar 选择ojdbc14.jar的存放位置,没有得可以到百度下一个叫ojdbc14.jar的文件。
点击test driver 到此成功配置。

Read the rest of this entry »