云自無心水自閑

          天平山上白云泉,云自無心水自閑。何必奔沖山下去,更添波浪向人間!
          posts - 288, comments - 524, trackbacks - 0, articles - 6
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          2017年8月9日

          1. java zip 多個(gè)文件時(shí),如果先添加了一個(gè)excel文件,然后再想添加其他的文件時(shí)會(huì)出現(xiàn) steam is closed的錯(cuò)誤。這是因?yàn)閣ork.write(outputSteam)后,出調(diào)用outputSteam.close(),關(guān)閉輸出流。
          解決方法:
          將原來的程序:
                      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區(qū)分大小寫
          select * from table1 where binary field1 = 'abc';

          posted @ 2017-08-09 19:52 云自無心水自閑 閱讀(446) | 評(píng)論 (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 云自無心水自閑 閱讀(428) | 評(píng)論 (0)編輯 收藏

          2017年6月15日

          move Git Server to a new IP/URL:

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

          也可以在git視圖中,右鍵點(diǎn)擊項(xiàng)目,選擇屬性,然后修改url中的地址

          posted @ 2017-06-15 08:40 云自無心水自閑 閱讀(337) | 評(píng)論 (0)編輯 收藏

          2017年5月24日

          autohotkey
          listary
          cmder可以split screen,在一個(gè)窗口中同時(shí)運(yùn)行數(shù)個(gè)cmd

          posted @ 2017-05-24 07:13 云自無心水自閑 閱讀(18788) | 評(píng)論 (0)編輯 收藏

          2017年3月8日

          官網(wǎng)地址: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 云自無心水自閑 閱讀(383) | 評(píng)論 (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 云自無心水自閑 閱讀(421) | 評(píng)論 (0)編輯 收藏

          2016年12月29日


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

          這里要注意的就是要把數(shù)組的數(shù)據(jù)類型強(qiáng)制轉(zhuǎn)換為Object 

          posted @ 2016-12-29 11:51 云自無心水自閑 閱讀(1641) | 評(píng)論 (0)編輯 收藏

          2016年12月21日

          在windows環(huán)境中,可以用如下方法重置root密碼

          1、先停止mysql數(shù)據(jù)庫

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

          3、以管理員身份打開命令行窗口,運(yùn)行
          C:\> cd "C:\Program Files\MySQL\MySQL Server 5.5\bin"
          C:\> mysqld --init-file=C:\reset.txt

          4、啟動(dòng)后,還不能馬上用新密碼連接數(shù)據(jù)庫,需要重啟mysql數(shù)據(jù)庫

          posted @ 2016-12-21 07:12 云自無心水自閑 閱讀(388) | 評(píng)論 (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.
          這是因?yàn)閙2eclipse(maven插件)要在啟動(dòng)時(shí)需要進(jìn)行的一個(gè)步驟。

          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.
          我們可以停止這個(gè)動(dòng)作。方法:Windows -> Preferences -> Maven 取消勾選 Download repository index updates on startup

          posted @ 2016-11-29 08:38 云自無心水自閑 閱讀(1332) | 評(píng)論 (0)編輯 收藏

          2016年11月28日

          有好幾個(gè)java library都可以實(shí)現(xiàn)這個(gè)功能,但是從pdf提取文本的一個(gè)問題是,提取出來的文本沒有固定的順序,不容易比較好的還原其格式。

          我的做法是使用pdfclown來進(jìn)行這項(xiàng)工作。官方網(wǎng)站是:https://pdfclown.org/ 先下載其最新版本。
          參考其示例代碼:https://pdfclown.org/2010/01/02/upcoming-0-0-8-whats-going-to-be-new/#more-30

          使用這段代碼,我們不僅可以得到文本的字符串,還能得到文本的頁數(shù)和相對(duì)坐標(biāo)。
          我的思路是先把所有文本的字符串和坐標(biāo)提取出來。然后排序,排序的順序是縱坐標(biāo),然后橫坐標(biāo)。
          這樣排序完畢后,就能比較好的解決文本格式問題。

          posted @ 2016-11-28 11:03 云自無心水自閑 閱讀(405) | 評(píng)論 (0)編輯 收藏

          主站蜘蛛池模板: 甘德县| 岳阳市| 抚州市| 静乐县| 芜湖县| 抚顺市| 曲沃县| 乌鲁木齐县| 永年县| 胶南市| 石屏县| 呼伦贝尔市| 惠来县| 秦皇岛市| 苍山县| 阿尔山市| 丹巴县| 龙陵县| 安仁县| 彭阳县| 离岛区| 梁河县| 长武县| 新宾| 罗平县| 沁源县| 柳林县| 汉中市| 华坪县| 淮北市| 怀仁县| 巴南区| 常熟市| 阿合奇县| 平顶山市| 乐清市| 咸宁市| 两当县| 会昌县| 丹凤县| 石家庄市|