云自无心水自闲

天平山上白云泉,云自无心水自闲。何必奔冲山下去,更添波浪向人间!
posts - 288, comments - 524, trackbacks - 0, articles - 6
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

2017年8月9日

1. java zip 多个文件时,如果先添加了一个excel文件,然后再想添加其他的文件时会出现 steam is closed的错误。这是因为work.write(outputSteam)后,出调用outputSteam.close(),关闭输出流。
解决方法:
将原来的程序:
            ZipEntry entry = new ZipEntry( "file3.txt" );
            zos.putNextEntry( entry );
            workbook.write( zos );
            zos.closeEntry();
改为:
            ZipEntry entry = new ZipEntry( "file3.txt" );
            zos.putNextEntry( entry );
            workbook.write( new NonCloseableOutputStream( zos ) );
            zos.closeEntry();

其中 NonCloseableOutputStream 定义如下:
public class NonCloseableOutputStream extends java.io.FilterOutputStream {
    public NonCloseableOutputStream(OutputStream out) {
        super(out);
    }
    @Override public void close() throws IOException {
        flush();
    }
}



2. 使用binary使得mysql区分大小写
select * from table1 where binary field1 = 'abc';

posted @ 2017-08-09 19:52 云自无心水自闲 阅读(395) | 评论 (0)编辑 收藏

2017年6月26日

https://notepad-plus-plus.org/community/topic/13661/plugin-manager-x64-available-submit-your-plugins

posted @ 2017-06-26 09:33 云自无心水自闲 阅读(369) | 评论 (0)编辑 收藏

2017年6月15日

move Git Server to a new IP/URL:

you can just edit 
.git/config and change the URLs there

也可以在git视图中,右键点击项目,选择属性,然后修改url中的地址

posted @ 2017-06-15 08:40 云自无心水自闲 阅读(293) | 评论 (0)编辑 收藏

2017年5月24日

autohotkey
listary
cmder可以split screen,在一个窗口中同时运行数个cmd

posted @ 2017-05-24 07:13 云自无心水自闲 阅读(13852) | 评论 (0)编辑 收藏

2017年3月8日

官网地址:autohotkey.com

; fill password
^Numpad2::
Send, root{tab}root{enter}
Return
^Numpad3::
IfWinExist, ahk_exe OUTLOOK.EXE
{
    WinActivate ahk_exe OUTLOOK.EXE ; Automatically uses the window found above.
    ; WinMaximize  ; same
    ;Send, Some text.{Enter}
msgbox Outlook is running.
}
Return

posted @ 2017-03-08 13:06 云自无心水自闲 阅读(338) | 评论 (0)编辑 收藏

2017年2月9日

<html>
<head>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <script>
        window.onload = function () {
            var app = new Vue({
                el: '#app',
                data: {
                    message: 'Hello Vue!'
                }
            });
        }    
    </script>
</head>

<body>
    <div id="app">
      {{ message }}
    </div>
</body>
</html>

posted @ 2017-02-09 07:41 云自无心水自闲 阅读(373) | 评论 (0)编辑 收藏

2016年12月29日


String[] splits=someString.split("a,b,c,d", ",");
logger.debug( "array: {}", (Object) splits );

这里要注意的就是要把数组的数据类型强制转换为Object 

posted @ 2016-12-29 11:51 云自无心水自闲 阅读(1553) | 评论 (0)编辑 收藏

2016年12月21日

在windows环境中,可以用如下方法重置root密码

1、先停止mysql数据库

2、保存密码重置sql文件
     5.7.6(包括)以后的版本:ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
     5.7.5(包括)以前的版本:SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
假设保存到文件: c:\reset.txt

3、以管理员身份打开命令行窗口,运行
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.5\bin"
C:\> mysqld --init-file=C:\reset.txt

4、启动后,还不能马上用新密码连接数据库,需要重启mysql数据库

posted @ 2016-12-21 07:12 云自无心水自闲 阅读(340) | 评论 (0)编辑 收藏

2016年11月29日

This is a general step that happens when m2e/m2eclipse (Maven integration for Eclipse) is installed, whether projects are actively using it or not.
这是因为m2eclipse(maven插件)要在启动时需要进行的一个步骤。

This step can be disabled through the Eclipse preferences: Window / Preferences / Maven / "Download repository index updates on startup". This option is on the main "Maven" preference page (not a child page). Just uncheck the box to prevent this from happening.
我们可以停止这个动作。方法:Windows -> Preferences -> Maven 取消勾选 Download repository index updates on startup

posted @ 2016-11-29 08:38 云自无心水自闲 阅读(1268) | 评论 (0)编辑 收藏

2016年11月28日

有好几个java library都可以实现这个功能,但是从pdf提取文本的一个问题是,提取出来的文本没有固定的顺序,不容易比较好的还原其格式。

我的做法是使用pdfclown来进行这项工作。官方网站是:https://pdfclown.org/ 先下载其最新版本。
参考其示例代码:https://pdfclown.org/2010/01/02/upcoming-0-0-8-whats-going-to-be-new/#more-30

使用这段代码,我们不仅可以得到文本的字符串,还能得到文本的页数和相对坐标。
我的思路是先把所有文本的字符串和坐标提取出来。然后排序,排序的顺序是纵坐标,然后横坐标。
这样排序完毕后,就能比较好的解决文本格式问题。

posted @ 2016-11-28 11:03 云自无心水自闲 阅读(354) | 评论 (0)编辑 收藏