发博文
个人资料
龙虾
龙虾
  • 博客等级:
  • 博客积分:715
  • 博客访问:122,744
  • 关注人气:8
评论
加载中…
留言
加载中…
好友
加载中…
博文
(2012-02-15 13:14)
标签:

java

poi

word

读取

页数

it

分类: JAVA

使用poi3.7读取word文件的页数

package readword;

import java.io.FileInputStream;
import org.apache.poi.POIXMLDocument;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;


public class Readword {

   
    public static void main(String[] args) throws Exception {
        // TODO code application logic here
        parse2007();
        parse97();
    }
   
    public static void parse2007()  throws Exception {
        XWPFDocument docx = new XWPFDocument(POIXMLDocument.openPackage('D:\\workspace\\test.docx'));

        int pages = docx.getProperties().getExtendedProperties().getUnde

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

java

下载

文件

it

分类: JAVA

把文件读出来,用流的方式放到response中,返回给前端。

String agent = request.getHeader('USER-AGENT');
     try {
      InputStream inStream = null;
      if(realPath){
       inStream=new FileInputStream(new File(filePath));
      }else{
       inStream = HttpRemoteFileUtils.getRemoteFileInputStream(filePath);
      }
          ServletOutputStream streamOut = response.getOutputStream();
            try {
              response.reset();
                response.setContentType('application/x-msdownload;charset=UTF-8');
   &n

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 

修改了root用户的host,把localhost修改为了%,结果远程是可以访问了,本地访问却报:

mysql error 1045 (28000) access denied for user root @

没办法,修改root密码:

先在my.ini文件中加上:skip-grant-tables。

然后

update user set password = password('123456') where user='root';

flush privileges;

再把my.ini中的skip-grant-tables去掉,这是本地可以访问了,但远程又不能访问了。

把my.ini中又加上skip-grant-tables。

这时都能访问,但这样明显不可行。

问题待解决。

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
(2012-01-10 00:31)

    mysql默认设置下,当一个连接的空闲时间超过8小时后,mysql就会断开该连接。而程序的连接池依然认为该连接有效,在这种情况下,如果客户端向连接池发送请求的话,就报异常。

    解决办法,修改默认空闲时间。

方法一:在mysql下查看默认空闲时间

    show variables like '%timeout%';

    然后可以设置空闲时间

    show variables like '%timeout%';

    set interactive_timeout=31536000;
    set wait_timeout=31536000;

    空闲设置为一年。

方法二:在my.ini中设置

interactive_timeout=31536000

wait_timeout=31536000


阅读  ┆ 评论  ┆ 转载 ┆ 收藏 

     在应用系统中,有时候我们需要获得word或pdf中的内容,对内容进行过滤,提取我们想要的关键信息。但获得word之类文件的内容可能会有些问题,比如你把word文件转换成文本,那文本中会包含word一些标签信息,这时你对这些字符进行提取过滤就会困难的多。使用tika可以解决这个问题,tika可以帮你获得word的文本内容,这些内容是不带word标签的。

     具体使用方法如下:

     public class tikaSimple {

 private final static String PATH = 'D:/tikatest.doc';
 private final static String OUTPATH = 'D:/tikatest.txt';
 
 public static void main(String[] args) throws Exception {
  Parser parser = new OfficeParser();
  InputStream iStream = new BufferedInputStream(new FileInputStream(new File(PATH)));
  OutputStream oStream = new BufferedOutputStream(new FileOutputStream(new File(OUTPATH)));
  ContentHandler iHandler = new BodyContent

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 

摘自:http://livenzhao.spaces.live.com/blog/cns!6E368BE9F6DDD872!595.entry

·PL/SQL Developer使用技巧

   

1、PL/SQL Developer记住登陆密码

在使用PL/SQL Developer时,为了工作方便希望PL/SQL Developer记住登录Oracle的用户名和密码;

设置方法:PL/SQL Developer 7.1.2 ->tools->Preferences->Oracle->Logon History , 'Store history'是默认勾选的,勾上'Store with password' 即可,重新登录在输入一次密码则记住了。

2、执行单条SQL语句

在使用PL/SQL Developer的SQL Window时,按F8键,PL/SQL Developer默认是执行该窗口的所有SQL语句,需要设置为鼠标所在的那条SQL语句,即执行当前SQL语句;

设置方法:PL/SQL Developer 7.1.2 -->tools->Preferences-->Window types ,勾上'AutoSelect Statement' 即可。

3、格式化SQL语句

在使用PL/SQL Developer的SQL Window时,有时候输入的SQL语句太长或太乱,希望能用比较通用的写法格式话一下,这样看起来会好看些,也好分析;

使用方法:选中

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

oracle

关键字

字段

方法

it

分类: 数据库

使用P/L SQL建表时,如果使用了关键字作为字段名,如:uid,type,date等,会提示出错无效的标识符(invalid identifier)。在一些情况不得不使用关键字作为字段名时,就像一些系统升级时,从其它数据库改为oracle时,该什么办呢。经验证, 解决办法是使用双引号'如'type';

create table test(id number, 'date' date,'type' number)


阅读  ┆ 评论  ┆ 转载 ┆ 收藏 

在myeclipse中配置





如果控制台报java.lang.OutOfM

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

oracle

查找

关联

it

分类: 数据库

 

select a.owner ,a.table_name ,b.column_name ,C.OWNER ,c.table_name ,d.column_name from user_constraints a
left join user_cons_columns b
on a.constraint_name=b.constraint_name
left join user_constraints C
ON C.R_CONSTRAINT_NAME=a.constraint_name
left join user_cons_columns d
on c.constraint_name=d.constraint_name
where a.constraint_type='P'
and a.table_name='STOCK' --需要查看主外键关系的表
order by a.table_name

 

要注意一点,表名必须要大写,小写的会查不到。

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 

在oracle中truncate一张表时,会报unique/primary keys in table referenced by enabled foreign keys的错误,提示说存在外键约束指向本表的主键。

在网上查了下,在truncate表之前需要把存在其他表中的执行本表主键的外键约束disable掉,再truncate,然后再把这些外键enable。

如下:

alter table testorder disable constraint FK499161FCAA1018AC

alter table testorder enable  constraint FK499161FCAA1018AC
查询表关联的约束:

 select constraint_name from dba_cons_columns where table_name='testorder';

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
  

新浪BLOG意见反馈留言板 不良信息反馈 电话:4006900000 提示音后按1键(按当地市话标准计费) 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 会员注册 | 产品答疑

新浪公司 版权所有