Liullen dev daily
http://nelluil.postach.io/feed.xml
2018-09-29T15:41:22.946000Z
Werkzeug
Klean-prep 刻見清服心得用與台安大腸鏡健檢心得
https://nelluil.postach.io/post/jian-jian-da-chang-jing-qian-klean-prep-ke-jian-qing-fu-yong-xin-de
2018-09-29T15:41:22.946000Z
2018-08-22T04:45:58Z
Liullen
<div><span>這次是參加公司提供的台安健檢。</span></div>
<div><span><br clear="none"/></span></div>
<div><span>大腸鏡健檢前總共要喝兩包清腸藥Klean-prep 刻見清,每包藥粉加入 1000cc 的水做成溶液(或運動飲料、甘蔗汁)</span><br clear="none"/><span>規定是 20:00 喝 1000cc 於一小時內喝完,喝完後再補充水分 1000cc</span><br clear="none"/><span>03:00 爬起來喝 1000cc 於一小時內喝完,喝完後補充 500cc </span><br clear="none"/><br clear="none"/><span>因為我太晚吃晚餐,所以拖到 21:00 才開始喝,我是加運動飲料。</span><br clear="none"/><span>剛入口時覺得還好,似乎就鹹鹹甜甜的,</span><br clear="none"/><span>可怕的是吞下去後,那股氣會衝上鼻子,就和J大大形容的一樣:「一股鐵鏽味」,很噁心。</span><br clear="none"/><br clear="none"/><span>因為太難喝了,喝著喝著就過了 22:00,</span><br clear="none"/><span>大概還剩下 500cc 時,藥效開始了,</span><br clear="none"/><span>開始一直跑廁所,就和J大大說的一樣,肚子不會痛,只是會很想拉而已,</span><br clear="none"/><span>就這樣邊跑廁所邊喝,大約 23:00 左右喝完了。</span><br clear="none"/><br clear="none"/><span>緊接著是另外 1000cc 不加藥的運動飲料,</span><br clear="none"/><span>這時候還是一直跑廁所,常常一待就是半小時,</span><br clear="none"/><span>這 1000cc 喝完大概也 01:30 了,</span><br clear="none"/><span>蹲著蹲著想說去沖個澡好了,</span><br clear="none"/><span>雖然肚子不會痛,但是因為過度使用,小花開始紅腫感,</span><br clear="none"/><span>清洗的時候不得了,非常刺痛,可能沐浴乳含有某些精油是會刺激傷口。</span><br clear="none"/><br clear="none"/><span>洗完澡一整個舒服,想說可以躺一下吧,</span><br clear="none"/><span>但是看著時鐘是顯示 02:15 ,就覺得母湯,萬一躺下去就一覺不醒就得重來,</span><br clear="none"/><span>所以就 Youtube 看著看著直到 03:00 迎接下一壺,</span><br clear="none"/><br clear="none"/><span>第2包 2000cc 看之前的心得文是說只能用水沖成溶液,</span><br clear="none"/><span>但實在太難喝了,我還是用 1000cc 的運動飲料做成溶液,</span><br clear="none"/><span>這 1000cc 也是邊看 Youtube 邊喝,</span></div>
<div><span>而且吞下去噁心的感覺一點都不減,<br clear="none"/></span>突然想到網路上說的小技巧,捏著鼻子或是吞下去時要停止呼吸,<br clear="none"/>不過停止呼吸最後還是得呼吸,那個味道還是會有,只是少了些。</div>
<div>但這招還真的有點效果,讓我順利喝完 500cc 左右<br clear="none"/><span>不知道是因為身理時鐘的關係,感覺水全部都在胃裏,</span><br clear="none"/><span>沒有任何一點消化下去,喝完 500cc 時也過了一個小時,已經飽到一個完全喝不下。</span><br clear="none"/><br clear="none"/><span>大約 04:30 時,開始下一波馬桶 long stay,</span><br clear="none"/><span>到這邊的時候,已經是清澈如水,符合清腸規定的結果了。</span><br clear="none"/><br clear="none"/><span>最後到 05:00 前又硬撐喝了 250cc 左右,最後還有 250cc 我果斷放棄,</span><br clear="none"/><span>因為已經到了最後能補充水分的時間了 05:00</span><br clear="none"/><span>一直到 07:00 出門前,還是會一直跑廁所。</span></div>
<div><span>因為出來的都是水,所以過度使用的小花,實在有點不舒服,</span>最後還擦上了點凡士林來舒緩。</div>
<div><br clear="none"/></div>
<div><span>所以還真的整晚都沒睡。</span><br clear="none"/><br clear="none"/>我 08:00 報到,一連串檢查跟一班的檢查大致相通,沒什麼印象深刻的部分,<br clear="none"/>前面的部分檢查到約 09:00,就要開始做最後一項大腸鏡檢查了,</div>
<div>一開始要我換上另一件開襠褲,</div>
<div>換完後護理師或是醫師會做一連串的問題和確認,整個麻醉檢查過程大約要半小時,</div>
<div>確認完後就要我躺在病床上,</div>
<div>左手會綁上血壓計,右手會打一針注射點滴 (?),並在食指夾上脈搏偵測的儀器,</div>
<div>並要我側躺,腳縮起來。</div>
<div><br clear="none"/></div>
<div>躺一陣子後,</div>
<div>最後麻醉師(?)過來了,說打麻醉時手臂會酸會脹痛是正常現象。<br clear="none"/></div>
<div>一會兒後,麻醉就開始了,真的如醫師所說的,超酸超脹,還在感受從手臂到二頭肌的痠脹感時,下一秒就完全昏迷了,<br clear="none"/>不是漸漸的睡著,而是像被柯南的麻醉槍射中一般。</div>
<div><br clear="none"/></div>
<div>下一刻時,聽到了一些聲音,護理師來叫醒我,還真的起床就做好了,<br clear="none"/></div>
<div>要我再躺著休息一下,等等醫師會來解說,<br clear="none"/>過一陣子後,醫師來解說的時候,整個還昏昏沉沉的,應該是藥效還在,</div>
<div>大約在躺個十分鐘,就下床了,剛開始還真的是走路不太穩,</div>
<div>跟我說整個檢查已經結束,稍後換完衣服就可以吃早餐,吃完早餐就可以離開了。</div>
<div><br clear="none"/></div>
<div><br clear="none"/></div>
<div><br clear="none"/></div>
<div><span><br clear="none"/></span></div>
<div><span><br clear="none"/></span></div>
透過 symbolic link 避免開發環境變數的變更
https://nelluil.postach.io/post/tou-guo-symbolic-link-bi-mian-kai-fa-huan-jing-bian-shu-de-bian-geng
2018-05-16T07:23:45.977000Z
2018-05-16T01:48:05Z
Liullen
<div><br clear="none"/></div>
<div><br clear="none"/></div>
<div>若經常於 git branch 間切換,且當其中一些環境變數、檔案路徑相關的程式碼需要調整時,</div>
<div>總是需要透過 stash, 再 branch 之類的方式將變數相關的程式存下來,避免遺失</div>
<div>一個方法是建立 symbolic link ,這樣就不用一直改拉<br clear="none"/></div>
<div><br clear="none"/></div><ul><li>unix: </li></ul><div><br clear="none"/></div><table style="border-collapse: collapse; table-layout: fixed;" border="1" width="100%" cellspacing="0" cellpadding="2"><tr><td colspan="1" rowspan="1" valign="top" style="padding: 10.0px; margin: 0.0px; border: 1.0px solid #d9d9d9;">sudo ln -s /Users/liullen/workspace/ihergo /Users/ihergo<br clear="none"/></td></tr></table><div><br clear="none"/></div><ul><li>window: </li></ul><div><br clear="none"/></div><table style="border-collapse: collapse; table-layout: fixed;" border="1" width="100%" cellspacing="0" cellpadding="2"><tr><td colspan="1" rowspan="1" valign="top" style="padding: 10.0px; margin: 0.0px; border: 1.0px solid #d9d9d9;">mklink /d C:\ihergoGit C:\workspace\ihergo<br clear="none"/></td></tr></table><div><br clear="none"/></div>
用 jstl 的 <c:import url> 遇到 SSL 相關的問題
https://nelluil.postach.io/post/yong-jstl-de-c-import-url-yu-dao-ssl-xiang-guan-de-wen-ti
2018-03-16T04:24:04.071000Z
2018-03-16T03:53:43Z
Liullen
<div>在某一個 jsp 頁面使用 jstl core 直接 import 指定位置的 url 時會有問題,例如:</div>
<div><br /></div>
<div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><c:import url="https://ihaveapen.com/ihaveanapple" /></div>
<div><br /></div>
<div>在 macOS 本機(Apache+Tomcat) 連到用到這樣使用的 tag 的頁面時,Tomcat 會發生 SunCertPathBuilderException</div>
<div>(Exception 太長放最後面)</div>
<div><br /></div>
<div>解法:</div>
<div><br /></div>
<div>- 透過 firefox 將目前頁面的根憑證匯出 (這邊直接拿 apache ssl 指定的根憑證應該要也可以)</div>
<div>- 用 keytool 匯入到執行 tomcat 用的 jre 底下的 cacerts</div>
<div><br /></div>
<div><br /></div>
<div style="-en-codeblock: true; box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial;"><div>sudo keytool -import -alias ihergo -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/lib/security/cacerts -file wwwihergocom.crt</div></div><div><br /></div>
<div><br /></div>
<div>- 注意: 要用 sudo 權限, 且調整 cacerts 會要求輸入密碼, 預設密碼是</div>
<div><br /></div>
<div><br /></div>
<div style="-en-codeblock: true; box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial;"><div>changeit</div></div><div><br /></div>
<div><br /></div>
<div><br /></div>
<div>- 解決方法來源 stackoverflow https://stackoverflow.com/a/36427118</div>
<div><br /></div>
<div>- Exceptions:</div>
<div><br /></div>
<div><br /></div>
<div style="-en-codeblock: true; box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial;"><div>2018/03/16 11:43:36 [ERROR] [com.xxxxxx.mobile.web.controller.GlobalExceptionHandler@ajp-nio-8009-exec-9]_jspService(130) jsp error on:/mobile/WEB-INF/jsp/error/error.jsp</div>
<div>org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Problem accessing the absolute URL "https://www.xxxxxx.com/mobile/ad/banner". javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</div>
<div> at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:596)</div>
<div> ...</div>
<div><br /></div>
<div>Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: Problem accessing the absolute URL "https://www.xxxxxx.com/mobile/ad/banner". javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</div>
<div> at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:905)</div>
<div> ... 81 more</div>
<div>Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</div>
<div> at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)</div>
<div> ... 84 more</div>
<div>Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</div>
<div> ... 101 more</div>
<div>Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</div>
<div> ... 107 more</div></div><div><br /></div>
<div><br /></div>
<div><br /></div>
FATAL: sorry, too many clients already
https://nelluil.postach.io/post/fatal-sorry-too-many-clients-already
2018-03-08T03:27:26.239000Z
2018-03-08T03:17:38Z
Liullen
<div><br /></div>
<div>有時候在 pgsql 會遇到這個錯誤訊息,意思大概就是當前連線數量已達上限,</div>
<div>有可能是因為重複啟動 tomcat 等等</div>
<div><br /></div>
<div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);"><div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">FATAL: sorry, too many clients already</div>
<div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><br /></div></div><div><br /></div>
<div><br /></div>
<div><br /></div>
<div>總之可以透過這個 query,刪除10分鐘內的 idle 連線,應該就可以繼續使用。</div>
<div><br /></div>
<div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);"><div>SELECT pg_terminate_backend(pid)</div>
<div> FROM pg_stat_activity</div>
<div> WHERE datname = 'xxxxx'</div>
<div> AND pid <> pg_backend_pid()</div>
<div> AND state = 'idle'</div>
<div> AND state_change < current_timestamp - INTERVAL '10' MINUTE;SELECT pg_terminate_backend(pid)</div>
<div> FROM pg_stat_activity</div>
<div> WHERE datname = 'xxxxx'</div>
<div> AND pid <> pg_backend_pid()</div>
<div> AND state = 'idle'</div>
<div> AND state_change < current_timestamp - INTERVAL '10' MINUTE;</div></div><div><br /></div>
Eclipse Oxygen SVN Connector
https://nelluil.postach.io/post/eclipse-oxygen-svn-connector
2018-03-08T03:28:58.706000Z
2018-03-07T10:40:10Z
Liullen
<div style="width: 50em; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;"><div><span style="color: rgb(0, 0, 0);"><span style="font-family: monospace;"><br /></span></span></div>
<div>Eclipse Oxygen 無法安裝 SVN connector</div>
<div><br /></div>
<div>透過 svn-plug 底下安裝 plug-in 會閃一下就關閉</div>
<div><br /></div>
<div>而直接去找 SVN-kit 或 JavaHL 的 connector update-site 嘗試安裝也失敗</div>
<div><br /></div>
<div>所以找到遇到同樣問題的人,透過特定的 update-site 來安裝 SVNKit Connector,才順利解決這個問題</div>
<div><span style="font-family: monospace;"><span style="color: rgb(0, 0, 0);"><br /></span></span></div>
<div><br /></div>
<div><span style="font-family: monospace;"><span style="color: rgb(0, 0, 0);"><br /></span></span></div>
<div>來源:Mauro Molinari 在 <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=518033">https://bugs.eclipse.org/bugs/show_bug.cgi?id=518033</a> 發表的解法</div>
<div>其實也是直接透過 update-site 來安裝,但是來源不同,這版應該有特別處理過。</div>
<div><br /></div>
<div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);"><div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><span style="color: rgb(0, 0, 0);"><span style="font-family: monospace;"><span style="font-size: small;">Same problem here.</span></span></span></div>
<div><span style="color: rgb(0, 0, 0);font-family:"Helvetica Neue", Arial, sans;font-size:16px;"><span style="font-family: monospace;"><br /><span style="font-size: small;">Also, pages at: <br /><span style="font-size: small;"><a href="https://www.eclipse.org/subversive/latest-releases.php" style="color: rgb(102, 51, 102);">https://www.eclipse.org/subversive/latest-releases.php</a><br /></span><span style="font-size: small;"><a href="https://polarion.plm.automation.siemens.com/products/svn/subversive/download?utm_source=eclipse.org&utm_medium=link&utm_campaign=subversive" style="color: rgb(102, 51, 102);">https://polarion.plm.automation.siemens.com/products/svn/subversive/download?utm_source=eclipse.org&utm_medium=link&utm_campaign=subversive</a><br /></span>should be updated for Oxygen.<br /><br /></span></span></span><div style="font-family:monospace;font-size:12px;"><span style="color: rgb(0, 0, 0);"><span style="font-family: monospace;"><span style="font-size: small;">The main problem is that, as other mentioned already, the x64 binaries for the JavaHL connector seems not to be available at <a href="http://community.polarion.com/projects/subversive/download/eclipse/6.0/update-site/" style="color: rgb(102, 51, 102);"><span style="font-size: small;">http://community.polarion.com/projects/subversive/download/eclipse/6.0/update-site/</span></a></span></span></span></div></div></div><div><br /></div>
<div><br /></div>
<div><br /></div>
<div>是說 MacOS 上的免費且好用的 SVN GUI 圖形化工具好像有點少 QQ</div></div>
The Simplest Http File Server (by nodejs)
https://nelluil.postach.io/post/the-simplest-http-file-server-by-nodejs
2018-03-01T04:14:13.539000Z
2018-02-26T10:11:10Z
Liullen
<div><a href="https://github.com/indexzero/http-server">https://github.com/indexzero/http-server</a></div>
<div><br /></div>
<div>快速建立 http file server</div>
<div><br /></div>
<div><br /></div>
<div>###安裝</div>
<div>```</div>
<div>npm install http-server -g</div>
<div>```</div>
<div><br /></div>
<div>###執行方法1 </div>
<div>```</div>
<div>cd D:\Folder</div>
<div>http-server</div>
<div>```</div>
<div><br /></div>
<div>###或執行方法2</div>
<div>```</div>
<div>http-server D:\Folder</div>
<div>```</div>
hibernate column validation annotaion
https://nelluil.postach.io/post/hibernate-column-validation-annotaion
2018-02-14T03:39:39.605000Z
2018-02-14T03:37:02Z
Liullen
<div><br /></div>
<div><div style="box-sizing: border-box; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace; font-size: 16px; margin: 0px; padding: 1em; direction: ltr; color: rgba(0, 0, 0, 0.9); font-weight: 400; text-rendering: optimizeSpeed; border-radius: 4px; border: 0px solid rgb(136, 136, 136); background: rgb(247, 247, 248); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><code style="box-sizing: border-box; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace; font-size: 1em; font-weight: 400; color: rgba(0, 0, 0, 0.9); text-rendering: optimizeSpeed;"><span style="box-sizing: border-box; color: rgb(0, 0, 0);"> </span><span style="box-sizing: border-box; color: rgb(0, 102, 102);">@NotNull</span><span style="box-sizing: border-box; color: rgb(0, 0, 0);"><br /> </span><span style="box-sizing: border-box; color: rgb(0, 102, 102);">@Size</span><span style="box-sizing: border-box; color: rgb(102, 102, 0);">(</span><span style="box-sizing: border-box; color: rgb(0, 0, 0);">min </span><span style="box-sizing: border-box; color: rgb(102, 102, 0);">=</span><span style="box-sizing: border-box; color: rgb(0, 0, 0);"> </span><span style="box-sizing: border-box; color: rgb(0, 102, 102);">2</span><span style="box-sizing: border-box; color: rgb(102, 102, 0);">,</span><span style="box-sizing: border-box; color: rgb(0, 0, 0);"> max </span><span style="box-sizing: border-box; color: rgb(102, 102, 0);">=</span><span style="box-sizing: border-box; color: rgb(0, 0, 0);"> </span><span style="box-sizing: border-box; color: rgb(0, 102, 102);">14</span><span style="box-sizing: border-box; color: rgb(102, 102, 0);">)</span></code><div><span style="color: rgb(0, 0, 0);"> </span><span style="box-sizing: border-box; color: rgb(0, 0, 136);">private</span><span style="box-sizing: border-box; color: rgb(0, 0, 0);"> </span><span style="box-sizing: border-box; color: rgb(102, 0, 102);">String</span><span style="box-sizing: border-box; color: rgb(0, 0, 0);"> productName</span><span style="box-sizing: border-box; color: rgb(102, 102, 0);">;</span></div></div></div>
jQuery namespaced event
https://nelluil.postach.io/post/jquery-namespaced-event
2018-02-08T02:35:49.344000Z
2018-01-08T02:44:20Z
Liullen
<div><br /></div>
<div>在處理 jQuery Mobile 時,因為是手機介面,所以常常需要透過綁定 scroll 事件來處理各種狀況,</div>
<div><br /></div>
<div>一般通常是 scroll to HIDE 或 scroll to LOAD&SHOW</div>
<div><br /></div>
<div>但某些情況有可能會導致重複綁定的問題,所以需要透過 namesapced 的 event 來解決,避免兩個相同的事件(但處理不同情況)互相干擾</div>
<div><br /></div>
<div>例如: </div>
<div><br /></div>
<div>某些頁面要在 scroll 時把元素 A 和 B 都隱藏:</div>
<div><br /></div>
<div><br /></div>
<div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);"><div><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">$(document).on('scroll', function (event) {</span></div>
<div> //TODO: determine the length of scrollTop to hide element A</div>
<div><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">}</span></div>
<div><br /></div>
<div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">$(document).on('scroll', function (event) {</span></div>
<div><div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">}</span></div></div></div><div><br /></div>
<div>但有時候<span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">元素 A 和 B 的事件都是 </span>global 使用的, 但其中<span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">某些頁面</span>不處理 B:</div>
<div><br /></div>
<div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);"><div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">$(document).on('scroll', function (event) {</span></div>
<div><div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"> //TODO: determine the length of scrollTop to hide element A</div>
<div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">}</span></div>
<div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"><br /></div></div><div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">$(document).off('scroll');</span></div></div><div><br /></div>
<div>當 off('bind') 時就會把 A 和 B 的 handler 都刪除了</div>
<div><br /></div>
<div><br /></div>
<div><hr /></div>
<div><br /></div>
<div><br /></div>
<div>所以必須引用 namespaced </div>
<div><br /></div>
<div><br /></div>
<div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);"><div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">$(document).on('<span style="color: rgb(255, 0, 0);">scroll.typeA</span>', function (event) {</span></div>
<div><div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"> //TODO: determine the length of scrollTop to hide element A</div>
<div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">}</span></div></div><div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"><br /></div>
<div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">$(document).on('<span style="color: rgb(255, 0, 0);">scroll.typeB</span>', function (event) {</span></div>
<div><div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"> //TODO: determine the length of scrollTop to hide element B</div>
<div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">}</span></div></div></div></div><div><br /></div>
<div>這樣就可以單獨 off 一個元素不影響其他 handler 的綁定</div>
<div><br /></div>
<div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);"><div><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">$(document).off('<span style="color: rgb(255, 0, 0);">scroll.typeA</span></span><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">'</span>);</div>
<div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"><br /></div>
<div><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">$(document).off('<span style="color: rgb(255, 0, 0);">scroll.typeB</span></span><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">'</span>);</div></div><div><br /></div>
<div><br /></div>
<div><br /></div>
<div>btw. 可以透過 jquery 去檢查目前事件有哪些 handler</div>
<div><br /></div>
<div><br /></div>
<div style="-en-codeblock: true; box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial;"><div>$._data(document, 'events');</div>
<div><br /></div>
<div>// 例如:可以把 document 中 scroll 事件的 handler 都印出來</div>
<div><br /></div>
<div>$._data(document, 'events').scroll.forEach(function(elem) {</div>
<div> console.log ( elem.handler.toString());</div>
<div>});</div></div><div><br /></div>
<div><br /></div>
<div><br /></div>
<div><br /></div>
<div>參考 api:</div>
<div><a href="http://api.jquery.com/on/#event-names">http://api.jquery.com/on/#event-names</a></div>
<div>click demo: </div>
<div><a href="https://jsfiddle.net/bpbed789/">https://jsfiddle.net/bpbed789/</a></div>
iOS 滑動卡卡不順暢 scroll inside scroll
https://nelluil.postach.io/post/ios-hua-dong-qia-qia-scroll-inside-scroll
2017-12-27T06:31:33.582000Z
2017-11-10T08:47:45Z
Liullen
<div>當 overflow scroll 的區塊中有其他 overflow 是 scroll 時, iOS 裝置的滑動會卡卡的,沒有硬體的慣性滑動效果</div>
<div><br /></div>
<div>嘗試在內層的 scroll 元件 css 加上 <tt>-webkit-overflow-scrolling: touch</tt></div>
透過輸入法組字事件 CompositionEvent 解決 iOS 上可能無法觸發 GoogleMap Autocomplete
https://nelluil.postach.io/post/tou-guo-shu-ru-fa-zu-zi-shi-jian-compositionevent-jie-jue-ios-shang-ke-neng-wu-fa-chu-fa-googlemap-autocomplete
2017-12-27T06:20:18.413000Z
2017-09-13T09:17:34Z
Liullen
<div><br /></div>
<div><div style="color: rgb(0, 0, 0); font-family: "PingFang TC"; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; font-weight: bold; font-size: 16px;"><div>透過輸入法組字事件 CompositionEvent 解決 iOS 可能無法正確觸發 GoogleMap Autocomplete</div></div><div style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><div> </div>
<div style="-en-codeblock: true; box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial;"><div> // hack: 讓 iOS 鍵盤拼完字會跳出 google map 的 autocomplete</div>
<div> $(pacInput).on('compositionend', function() {</div>
<div> $(this).trigger('blur').trigger('focus');</div>
<div> });</div></div><div><br /></div>
<div><br /></div></div></div><div><br /></div>
<div><div style="font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><div><span style="color: rgb(0, 0, 0);"><span style="font-size: 16px;"><span style="font-family: "PingFang TC";">jsfiddle demo: </span></span></span><a href="https://jsfiddle.net/25gj9m9x/">https://jsfiddle.net/25gj9m9x/</a></div>
<div><span style="color: rgb(0, 0, 0);"><span style="font-size: 16px;"><span style="font-family: "PingFang TC";"><br /></span></span></span></div>
<div><span style="color: rgb(0, 0, 0);"><span style="font-size: 16px;"><span style="font-family: "PingFang TC";">相關事件:</span></span></span></div></div><ol style="color: rgb(0, 0, 0); font-family: "PingFang TC"; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><li><a href="https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/compositionstart">compositionstart</a> : 輸入法組字開始</li><li><a href="https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/compositionend">compositionend</a> : 輸入法組字結束</li><li><a href="https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/compositionupdate">compositionupdate</a>: 輸入法修改字詞</li></ol><p style="color: rgb(0, 0, 0); font-family: "PingFang TC"; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[1] 參考 MDN: <a href="https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent">https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent</a></p></div>
jqueryMobile 下載檔案注意事項
https://nelluil.postach.io/post/jquerymobile-xia-zai-dang-an-zhu-yi-shi-xiang
2018-01-29T02:04:49.647000Z
2017-06-26T07:37:42Z
Liullen
<div>jQuery Mobile 下載一般檔案 <tt><span style="font-family: "courier new", courier, monospace;"><span style="color: rgb(255, 0, 0);"><b>data-ajax="false"</b></span></span></tt></div>
<div><br /></div>
<div><span style="color: rgb(51, 51, 51);">```</span></div>
<div><span style="font-size: 12px;font-family:gotham, helvetica, arial, sans-serif;"><span style="font-family: Monaco, Menlo, Consolas, "Courier New", monospace;"><a href="https://blah.com/example.pdf" data-ajax="false">下載檔案</a></span></span></div>
<div><span style="color: rgb(51, 51, 51);">```</span></div>
M版 Spring MVC 排程設定
https://nelluil.postach.io/post/mban-spring-mvc-pai-cheng-she-ding
2017-12-27T06:19:58.234000Z
2017-06-26T07:35:57Z
Liullen
<div><br /></div>
<div><h1 style="font-family: Roboto, sans-serif; font-weight: 700; margin: 0px 0px 0.75em; font-size: 35px; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">M版 Spring MVC 排程設定</h1><br style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" /></div>
<div><br /></div>
<div><div style="font-family: Consolas, "Liberation Mono", Menlo, "Courier Prime Web", Courier, monospace; background: rgb(243, 243, 243); display: block; text-shadow: white 0px 1px; padding: 5px 5px 5px 30px; position: relative; margin: 1em 0px; color: rgb(51, 51, 51); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><code style="font-family: Consolas, "Liberation Mono", Menlo, "Courier Prime Web", Courier, monospace; background: rgb(243, 243, 243); padding: 1px; margin: 0px -1px; border-radius: 3px;">public class UpdatexxxxxTask {<br /><br /> @Scheduled(fixedDelay = 30000)<br /> public void execute() {<br /> try {<br /> dosomething<br /> } catch (Exception e) {<br /> ApLog.error(e.getMessage(), e);<br /> }<br /> }</code><div><span style="background-color: rgb(243, 243, 243);">}</span></div></div><h3 style="font-family: Roboto, sans-serif; font-weight: 700; margin: 1.25em 0px 0.75em; text-transform: uppercase; font-size: 13px; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">1.新增一個 CLASS 和 METHOD 並利用 ANNOTATION 增加要執行的排程</h3><span style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">a. </span><code style="font-family: Consolas, "Liberation Mono", Menlo, "Courier Prime Web", Courier, monospace; background: rgb(243, 243, 243); padding: 1px; margin: 0px -1px; border-radius: 3px; color: rgb(51, 51, 51); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">@Scheduled(fixedDelay = 30000)</code><br style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" /><span style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">執行完才會執行下一次(ms)</span><br style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" /><br style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" /><span style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">b. </span><code style="font-family: Consolas, "Liberation Mono", Menlo, "Courier Prime Web", Courier, monospace; background: rgb(243, 243, 243); padding: 1px; margin: 0px -1px; border-radius: 3px; color: rgb(51, 51, 51); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">@Scheduled(fixedRate=5000)</code><br style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" /><span style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">不管這次執行是否完成,時間到了即執行下一次</span><br style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" /><br style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" /><span style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">c. </span><code style="font-family: Consolas, "Liberation Mono", Menlo, "Courier Prime Web", Courier, monospace; background: rgb(243, 243, 243); padding: 1px; margin: 0px -1px; border-radius: 3px; color: rgb(51, 51, 51); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">@Scheduled(cron="*/5 * * * * MON-FRI")</code><br style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" /><span style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">同b, cron 的排程時間到了立即執行</span><br style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" /><h3 style="font-family: Roboto, sans-serif; font-weight: 700; margin: 1.25em 0px 0.75em; text-transform: uppercase; font-size: 13px; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">2.在 SPRING-QUARTZ.XML 增加 BEAN</h3></div><div><span style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">參考: </span><b style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">src/main/resources/spring/spring-quartz.xml</b></div>
<div><div style="font-family: Consolas, "Liberation Mono", Menlo, "Courier Prime Web", Courier, monospace; background: rgb(243, 243, 243); display: block; text-shadow: white 0px 1px; padding: 5px 5px 5px 30px; position: relative; margin: 1em 0px; color: rgb(51, 51, 51); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><div><code style="font-family: Consolas, "Liberation Mono", Menlo, "Courier Prime Web", Courier, monospace; background: rgb(243, 243, 243); padding: 1px; margin: 0px -1px; border-radius: 3px;"><bean id="UpdateLuceneSearcherTask" class="com.xxxxx.mobile.tasks.UpdatexxxxxTask"></bean></code></div></div><h3 style="font-family: Roboto, sans-serif; font-weight: 700; margin: 1.25em 0px 0.75em; text-transform: uppercase; font-size: 13px; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">3.可能存在的問題:</h3><span style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">目前沒有特別設定哪一台機器要跑, 應該 critical, master, slaves 都會執行.</span></div><div><span style="color: rgb(51, 51, 51); font-family: "Crimson Text", serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">未來 task 更多、或是有需要指定機器執行時,可能需要類似 web 版獨立設定。</span></div>
apache mod_jk @ MacOS Worker 設定問題
https://nelluil.postach.io/post/apache-mod-jk-macos-worker-she-ding-wen-ti
2017-12-27T06:21:11.348000Z
2017-03-14T01:35:14Z
Liullen
<div>在 mod_jk 的 log 發現 localhost 無法解析等相關錯誤訊息</div>
<div><br /></div>
<div>嘗試把 workers.properties 中連到 tomcat 的 IP(port 8009那個) 從 localhost 改為 127.0.0.1 後</div>
<div><br /></div>
<div>就可以讓 Apache 的 mod_jk 和 tomcat 順利整合了</div>
<div><br /></div>
<div><br /></div>
<div>P.S. 猜測可能原因: tomcat listen 的 ip 只有 127.0.0.1 並不包含 localhost</div>
macOS Sierra 10.12 安裝 apache mod_jk
https://nelluil.postach.io/post/macos-sierra-10-12-an-zhuang-apache-mod-jk
2017-12-27T06:21:12.065000Z
2017-02-16T03:07:50Z
Liullen
<div>###如何在 macOS Sierra 10.12 正確安裝 apache mod_jk</div>
<div><br /></div>
<div>##編譯 mod_jk.so</div>
<div><br /></div>
<div><br /></div><div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div>
<div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">cd ~/Desktop/tomcat-connector-source/native
</div><div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"><br /></div><div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;">./configure CFLAGS='-arch x86_64' APXSLDFLAGS='-arch x86_64' --with-apxs=/usr/sbin/apxs
</div><div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"><br /></div><div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;">make
</div><div style="font-family:"Helvetica Neue", Arial, sans;font-size:16px;"><br /></div></div><div style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">sudo make install</div></div><div><br /></div>
<div>* 第一步的 configure 可能會遇到 apxs path not found 的問題, 解決方式: </div>
<div><br /></div>
<div><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">用 homebrew 安裝 apache24: </span><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><tt>brew install apache</tt></span></div>
<div><br /></div><div>將
<span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">--with-apxs 指定到 homebrew 安裝的 apache 位址(太長忘了), 大概就能正確 configure 了</span></div><div><br /></div>
<div><tt><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">--with-apxs=/usr/local/Cellar/apache/apache24...</span></tt></div>
<div><br /></div><div>* 如果還有 apxs 的問題,
<span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">可以執行</span>
<span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"> </span>
<span><tt>apxs -q</tt> 看看</span>有少什麼套件</div><div><br /></div>
<div>將make 好的 mod_jk.so 搬到原本的(homebrew的) apache libexec 下</div>
<div><br /></div>
<div style="-en-codeblock: true; box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial;"><div>5) Copy created mod_jk.so:
</div>
<div><br /></div>
<div>cp /usr/libexec/apache2/mod_jk.so /Applications/Coldfusion10/config/wsconfig/1/mod_jk.so</div></div><div><br /></div>
<div>btw. 如果要使用 brew 的 apache 記得更換symbolic link <span><tt>ln -s</tt></span></div>
<div><br /></div>
<div>參考: </div>
<div><br /></div>
<div><a href="https://gist.github.com/jclausen/7121183">https://gist.github.com/jclausen/7121183</a></div>
struts1 中 DispatchAction 繼承 execute 執行順序
https://nelluil.postach.io/post/struts1-zhong-dispatchaction-ji-cheng-execute-zhi-xing-shun-xu
2017-12-27T06:21:29.172000Z
2017-02-16T02:59:36Z
Liullen
<div>地雷時間: 8小時(一個工作天) :(((</div>
<div><br /></div>
<div>假設</div>
<div><br /></div>
<div><tt>StoreManageBaseAction extends DispatchAction</tt></div>
<div><br /></div>
<div>又</div>
<div><br /></div>
<div><tt>StoreManageIndexAction extends StoreManageBaseAction</tt></div>
<div><br /></div>
<div>當 execute 被執行時, </div>
<div>會優先執行父類別的 execute(), 才執行子類別指定的 method</div>
<div><br /></div>
<div><br /></div>
<div>例如:</div>
<div>要執行 <tt><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">StoreManageIndexAction.</span></tt><tt>index()</tt>,</div>
<div>會先執行完 <tt><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">StoreManageBaseAction.</span></tt><tt>execute()</tt> 才執行 <tt><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">StoreManageIndexAction</span></tt><tt>.index()</tt></div>
<div><br /></div>
<div><br /></div>
PostgreSQL pgSQL 終止沒有回應的 Query
https://nelluil.postach.io/post/pgsql-zhong-zhi-query
2018-01-29T02:07:41.204000Z
2016-11-24T02:02:59Z
Liullen
<div><br /></div><div>由於對較大的 Table
<span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;">執行 update SQL 可能因為網路環境等因素, 造成沒有回應,</span></div><div><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"> </span></div>
<div><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><s>所以不用 GUI 操作, 用 CLI 操作, 當然有時候還是會卡住,</s> </span><span style="color: rgb(255, 0, 0);">結果即使用 psql.exe 還是每次都卡住...</span></div>
<div><span style="color: rgb(0, 0, 0);"><br /></span></div>
<div><span style="color: rgb(0, 0, 0);">問題可能是因為 網路?</span></div>
<div><br /></div>
<div> </div><div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="font-family:gotham, helvetica, arial, sans-serif;font-size:14px;"><span style="font-family: "courier new", courier, monospace;">C:\pgAdminIII\1.22\psql.exe -U username -h 60.xxx.xxx.xxx -d dbname -a -f a.sql -L a.log</span>
</span>
</div></div><div><br /></div>
<div>另外, 可以透過 SQL 來查詢目前正在執行的 Query </div>
<div><br /></div>
<div style="box-sizing: border-box; padding: 8px; color: rgb(51, 51, 51); border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="font-family: "courier new", courier, monospace;">SELECT * FROM pg_stat_activity ;</span></div></div><div><br /></div>
<div>可以看 datname, application_name, state=Idle 欄位值</div>
<div><br /></div>
<div><br /></div>
<div><br /></div>
<div>查詢後, 如果遇到想要中止的 Query 可以: </div>
<div><br /></div>
<div><br /></div>
<div style="box-sizing: border-box; padding: 8px; border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902);"><div><span style="font-family: "courier new", courier, monospace;"><span style="color: rgb(0, 0, 0); font-size: 13.44px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none; display: inline !important;">SELECT pg_cancel_backend(pid); 或 SELECT pg_terminate_backend(pid); // like force</span></span></div></div>
MSSQL varchar, nvarchar 預設長度 30
https://nelluil.postach.io/post/mssql-varchar-nvarchar-yu-she-chang-du-30
2017-12-27T06:21:48.709000Z
2016-04-15T06:10:02Z
Liullen
<div style="font-size: 16px;"><p style="box-sizing: border-box; outline: none !important; margin: 0px 0px 1.1em; color: rgb(44, 63, 81); font-family: 'Helvetica Neue', Arial, 'Hiragino Sans GB', STHeiti, 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, Song, sans-serif; widows: 1;"><strong style="box-sizing: border-box; outline: none !important;">MSSQL varchar, nvarchar 預設長度 30</strong></p><p style="box-sizing: border-box; outline: none !important; margin: 0px 0px 1.1em; color: rgb(44, 63, 81); font-family: 'Helvetica Neue', Arial, 'Hiragino Sans GB', STHeiti, 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, Song, sans-serif; widows: 1;"><code style="box-sizing: border-box; outline: none !important; font-family: 'Source Code Pro', monospace; font-size: 0.9em; padding: 2px 4px; color: rgb(199, 37, 78); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(249, 242, 244);">nvarchar</code>, <code style="box-sizing: border-box; outline: none !important; font-family: 'Source Code Pro', monospace; font-size: 0.9em; padding: 2px 4px; color: rgb(199, 37, 78); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(249, 242, 244);">varchar</code> 不給長度時, 有預設 30 的限制</p><p style="box-sizing: border-box; outline: none !important; margin: 0px 0px 1.1em; color: rgb(44, 63, 81); font-family: 'Helvetica Neue', Arial, 'Hiragino Sans GB', STHeiti, 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, Song, sans-serif; widows: 1;">以後記得, 所有對資料庫欄位的 update, 都應該要<strong style="box-sizing: border-box; outline: none !important;">備份</strong>, 以確保不會有慘劇發生…</p><ul style="box-sizing: border-box; outline: none !important; margin-top: 0px; margin-bottom: 1.1em; color: rgb(44, 63, 81); font-family: 'Helvetica Neue', Arial, 'Hiragino Sans GB', STHeiti, 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, Song, sans-serif; widows: 1;"><li style="box-sizing: border-box; outline: none !important;">方法1: 新增一個備份用的欄位, 將值 copy 過去</li><li style="box-sizing: border-box; outline: none !important;">方法2: 直接對資料庫備份</li></ul><div style="box-sizing: border-box; outline: none !important; margin: 0px 0px 1.1em; color: rgb(44, 63, 81); font-family: 'Helvetica Neue', Arial, 'Hiragino Sans GB', STHeiti, 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, Song, sans-serif; widows: 1;"><div>2016/04/15 某案子得到的教訓…</div></div></div>
兩顆沒碰過的地雷 Oracle Sequence, Lucene lock file
https://nelluil.postach.io/post/liang-ke-mei-peng-guo-de-di-lei-oracle-sequence-lucene-lock-file
2016-09-07T03:39:07.055000Z
2015-03-09T03:43:29Z
Liullen
<ol>
<li>lucene 在操作時會在 temp 目錄產生一個 <code>lucene*.lock</code><br />
若程式被異常終止後, 導致該檔案沒有沒刪除, 會讓 lucene 幾乎整個壞掉, 因為每次要 query 或建 index 時, 遇到 <code>.lock</code> 檔時, 操作皆會被 lucene 擋下來</li>
</ol>
<h4>暫時的解決方案</h4>
<pre><code> - 透過每次啟動時, 去清除 temp 目錄底下所有的 `lucene*.lock` 檔,
</code></pre>
<hr />
<ol>
<li>Oracle DB 某張 Table 不明原因導致當前 Sequence 小於已經存在資料的 Sequence, 讓新資料想要 insert 不能, 因為 Sequence 不能重複</li>
</ol>
<h4>暫時的解決方案</h4>
<pre><code> - 透過 Oracle 查看該 Table 的 Sequence 到多少了,
</code></pre>
<pre><code class="select">documentviewlog_seq
.
currval
from
dual
</code></pre>
<p>並比對存在資料的 Sequence, 最後透過 <code>nextval</code> 來增加到比已經存在的資料多 1 個序號, 應該就會正常了</p>
<blockquote>
<pre><code>nextval 每次 insert 之後, sequence 就會直接 +1
若要用 currval 之前, 必須先用 nextval select 一次
</code></pre>
</blockquote>
<pre><code class="select">documentviewlog_seq
.
nextval
from
dual
</code></pre>
Oracle 資料庫密碼過期相關指令
https://nelluil.postach.io/post/oracle-mi-ma-guo-qi-xiang-guan-zhi-ling
2015-03-05T08:43:13.919000Z
2015-02-26T06:27:24Z
Liullen
<ol>
<li>
<p>密碼過期時就得修改密碼 , 否則該帳號將無法使用: </p>
<p><code>ALTER USER "使用者名稱" IDENTIFIED BY "新密碼" REPLACE "舊密碼"</code></p>
</li>
<li>
<p>查詢 Default user profile 的密碼期限: (預設是 <code>180</code> 天)<br />
<code>SELECT * FROM dba_profiles s WHERE s.profile=&apos;DEFAULT&apos; AND resource_name=&apos;PASSWORD_LIFE_TIME&apos;;</code></p>
</li>
<li>
<p>查詢 user 是哪一種 profile: (預設應該都是 <code>default</code>)<br />
<code>SELECT username,PROFILE FROM dba_users;</code></p>
</li>
<li>
<p>修改 default user profile 密碼過期的時間 (這邊改為無限制: <code>UNLIMITED</code>)<br />
<code>ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;</code></p>
</li>
</ol>
<h4>注意:</h4>
<ul>
<li>按照 <strong>第4點</strong> 的修改 user profile 會降低帳號的安全性, 因為原本預設是 180 天密碼到期, 期至便須修改密碼, 改無限制意思是永遠不會過期. (所以我只用在開發用的機器上, 產品或客戶的資料庫不要用)</li>
</ul>
<h4>參考資料:</h4>
<ol>
<li>
<p><a href="http://pramaire.pixnet.net/blog/post/45150667-oracle-11g%E5%AF%86%E7%A2%BC%E9%81%8E%E6%9C%9F%E5%95%8F%E9%A1%8C-ora-28002">Oracle 11g密碼過期問題 ORA-28002</a></p>
</li>
<li>
<p><a href="http://www.itcert.org/thread-3536-1-1.html">Oracle 11g存在密碼過期問題</a></p>
</li>
</ol>
OutOfMemoryError Occurs when allocate a big Byte Array
https://nelluil.postach.io/post/outofmemoryerror-occurs-when-allocate-a-big-byte-array
2015-03-05T08:43:13.935000Z
2015-02-06T07:52:46Z
Liullen
<p>今天遇到另一個 Java 的地雷,</p>
<p>而且一個非常簡單的一個程式碼就會吐出 OOM 錯誤: </p>
<blockquote>
<p><code>java.lang.OutOfMemoryError: Java heap space</code></p>
</blockquote>
<pre><code>int fileLength = 170 * 1024 * 1024;
byte[] b2 = new byte[fileLength];
</code></pre>
<p>Array 不能且不應該產生這麼長的 instance, 因為會超過 java 的 default heap size.</p>
<p>當然可以去改 jvm 參數將 heap size 加大, <br />
但這並不是一個長遠之計, <br />
改天再遇到更大的檔案一樣會 OOM</p>
<p>這次因為想要打亂檔案的 header , <br />
所以求快直接使用這種方法比較簡單... 囧</p>
<h4>參考資料:</h4>
<ul>
<li>參考了 stackoverflow, 有人回答道: 若遇上這樣的問題, 應該要 partial 去處理.</li>
<li><a href="http://stackoverflow.com/questions/8652073/java-heap-space-error-while-reading-file-in-byte-array">http://stackoverflow.com/questions/8652073/java-heap-space-error-while-reading-file-in-byte-array</a></li>
</ul>
<h4>修改方法</h4>
<ul>
<li>修改前<br />
<code>byte[] b2 = new byte[b.length];
for (int i = 0; i < b.length; i++) {
b2[i] = (byte) (b[i] + k);
}
return b2;</code></li>
<li>修改後(利用 buffer 來改)</li>
</ul>
<pre><code>abc
</code></pre>
Implements equals() for non-primitive types
https://nelluil.postach.io/post/implements-equals-for-non-primitive-types
2018-03-28T02:58:05.802000Z
2015-01-21T04:25:23Z
Liullen
<p>這次遇到一個簡單到不行的 <strong>Java</strong> 小地雷,</p>
<p>實作物件的 <code>equals()</code> 時, 若要比對 <strong>non-<br />
primitive<br />
type</strong> 的 <code>Integer</code>, <code>Long</code>, <code>Double</code> 等物件數值,</p>
<p>請記得使用 <code>equals()</code> 不要用 <code>==</code> ,</p>
<p>或者自己將 <code>Integer.intValue()</code> 或 <code>Long.longValue()</code> 拿出來再用 <code>==</code> 比</p>
<p>不然 <code>boolean eq = new Integer(1) == new Integer(1)</code> 會永遠給你 <code>false</code>,</p>
<p>除非夠幸運兩個 <code>Object</code> 發生 conflict XD</p>
<p>這是 <code>Integer.equals(obj)</code> 的實作, 也就是為什麼 <code>equals(obj)</code> 才會正確的原因</p>
<pre><code>
private final int value;
public boolean equals(Object obj) {
if (obj instanceof Integer) {
return value == ((Integer)obj).intValue();
}
return false;
}
</code></pre>
<h4>參考資料</h4>
<p>另外參考了 stackoverflow <a href="http://stackoverflow.com/questions/20541636/compare-non-
primitive
-long-values-127-and-128">Compare non-<br />
primitive<br />
Long values 127 and 128</a> 後, 發現 <strong> <code>-128</code> 到 <code>127</code> 之間的數值 jvm 會先 cache 起來 </strong>,</p>
<p>如下程式碼:</p>
<pre><code class="java">
Long a = Long .valueOf(127);
Long b = Long .valueOf(127);
boolean eq = a == b; // 是 true
Long a = Long .valueOf(128);
Long b = Long .valueOf(128);
boolean eq = a == b; // 是 false
boolean eq = new Long(1) == new Long(1); // 但這一樣永遠是 false !
</code></pre>
<h4>小結:</h4>
<ol>
<li>
<p>用 <code>==</code> 去比較 <code>new Long(long)</code> 的數值都不會相等, </p>
</li>
<li>
<p>用 <code>==</code> 去比較 <code>Long.valueOf(long)</code> 的數值只有在 -128 到 127 之間會相等</p>
</li>
<li>
<p>所以若要比較 <strong>non-<br />
primitive<br />
type</strong> (ex: <code>Integer</code>, <code>Long</code>, <code>Double</code>) 的數值, 請用 <code>equals(obj)</code></p>
</li>
</ol>
透過 SQL 查詢樹狀結構某節點下的所有節點
https://nelluil.postach.io/post/tong-ji-shu-zhuang-jie-gou-fen-lei-di-xia-ge-wen-jian-fu-jian-fu-dang-ming-zong-shu
2015-03-05T08:43:13.963000Z
2014-12-26T04:01:15Z
Liullen
<h4>透過 SQL 查詢 Oracle 樹狀結構某節點下的所有節點</h4>
<ul>
<li><strong>ORACLE 限定方法</strong>: <code>START WITH ... CONNECT BY PRIOR ...</code></li>
<li>Oracle ex:</li>
</ul>
<pre><code>SELECT Id
FROM Category START WITH Id=2 CONNECT BY
PRIOR Id=Parentid
</code></pre>
<h4>透過 SQL 查詢 MSSQL 樹狀結構某節點下的所有節點</h4>
<ul>
<li><strong>MSSQL</strong> 似乎沒有直接的查詢語法(?), 但有 <code>with</code></li>
<li>MSSQL ex:</li>
</ul>
<pre><code>WITH n (id, name) AS
(SELECT id, name
FROM category
WHERE id = 2 --父節點 id
UNION ALL SELECT child.id, child.name
FROM Category AS child, n
WHERE n.id = child.parentId)
SELECT * FROM n
</code></pre>
<p>如果要透過 <code>n</code> 再查詢, 例如查詢分類樹底下所有 binder<br />
(假設 <code>Binder</code> 和 <code>Category</code> 透過 <code>Binder_Category</code> 來記錄關聯性)</p>
<p><code>WITH n (id, name) AS
(SELECT id,
name
FROM category
WHERE id = 2 --父節點 id
UNION ALL SELECT child.id,
child.name
FROM Category AS child, n
WHERE n.id = child.parentId)
SELECT *
FROM Binder bb
LEFT JOIN Binder_Category bc ON bc.binder_id = bb.id
WHERE bc.cat_id IN (SELECT id FROM n)</code></p>
<p><em>(感謝 April 大大教學)</em></p>
Eclipse 一些好用的快捷鍵
https://nelluil.postach.io/post/eclipse-yi-xie-hao-yong-de-kuai-jie-jian
2015-03-05T08:43:13.974000Z
2014-12-08T08:39:26Z
Liullen
<p>用了這款 IDE 好幾年, 最近才學會的一些好用的快捷鍵, 把它記錄下來:</p>
<ul>
<li>Incremental Find: <code>Ctrl</code> + <code>j</code>, 按完快捷鍵後轉換mode, 直接輸入要搜尋的文字會跳持續到符合的位置, 若有多個符合可以用方向鍵選取</li>
<li>Find Next: <code>Ctrl</code> + <code>k</code>, 將文字圈選後, 按下快捷鍵直接搜尋下一個</li>
<li>Last Edit Position: <code>Ctrl</code> + <code>Q</code>, 跳到整個 workspace 工作階段<strong>最後編輯</strong>的位置</li>
<li>Goto Line: <code>Ctrl</code> + <code>L</code>, 跳到某一行</li>
<li>Find Method/field: <code>Ctrl</code> + <code>o</code>, 搜尋 Class 的函式或屬性</li>
<li>Matching Brace: <code>Ctrl</code> + <code>Shift</code> + <code>p</code>, 找到對應的大中小括號</li>
<li>Column Edit Mode: <code>Shift</code> + <code>Alt</code> + <code>A</code>, 切換編輯模式</li>
</ul>
<h4>補充</h4>
<p>Windows8/Windows8.1 的內建新注音輸入法, 預設會啟用 <code>Ctrl</code> 來輸入標點符號, <br />
這會導致無法在 Eclipse 中使用 Block Comment (<code>Ctrl</code> + <code>Shift</code> <br />
+ <code>/</code>)的功能, 會變成輸入全形的問號 <code>?</code>, </p>
<ul>
<li>關掉的方法: 對右下角工作列的 <code>中</code>右鍵-><code>內容</code>-><code>進階</code>-><code>標點符號輸入</code>設為不使用 </li>
</ul>
<h4>InstaSearch</h4>
<p>另外分享一個程式碼全文搜尋用的 Plug-in: <code>InstaSearch</code></p>
<ul>
<li>Marketplace 連結: <a href="http://marketplace.eclipse.org/content/instasearch">http://marketplace.eclipse.org/content/instasearch</a></li>
<li>搜尋速度比 <code>Ctrl</code> + <code>h</code> 的全文檢索快上一大截</li>
<li>同樣能針對檔案型態進行搜尋: 例如: <code>*.java</code>, <code>*.xml</code>, <code>*.js</code> ...</li>
<li>但因為模糊比對, 常會出現太多結果而找不到, 所以有好有壞...<ul>
<li>(第一次在 workspace 使用 InstaSearch 時, 會花上一點時間製作索引)</li>
</ul>
</li>
</ul>
Eclipse 的啟動參數 data
https://nelluil.postach.io/post/eclipse-de-qi-dong-can-shu-data
2015-03-05T08:43:13.977000Z
2014-11-25T03:12:53Z
Liullen
<p>在 Windows 上, eclipse 的捷徑可以加上啟動參數 <code>-data ${workspace}</code>,</p>
<p>讓啟動時直接指定 Workspace 開啟</p>
<p>如此就不用每次打開會要先選 workspace, 選完還得跑個10秒才出現<br />
Ex: <code>C:\eclips\eclipse.exe -data "C:\workspace\WRA012345"</code></p>
<blockquote>
<p>若搭配 Launchy, 將捷徑名稱設定好, 整個就超方便<br />
例如: 捷徑命名為 <code>eclipse_WRA012345.lnk</code><br />
只要按下快捷鍵打開 launchy 並打 <code>WRA</code> 3個英文字就可以選到這個專案並開啟<br />
(因為 Launchy 有模糊比對的功能)<br />
<a href="http://www.launchy.net">Launchy</a> 在 Win8/8.1 上尤其好用!</p>
</blockquote>
刪除金山雲U盤 (我的電腦捷徑) (小米WiFi / 金山云U盘)
https://nelluil.postach.io/post/shan-chu-wo-de-dian-nao-jin-shan-yun-upan-jie-jing-xiao-mi-wifi
2015-03-05T08:43:13.981000Z
2014-11-20T01:40:02Z
Liullen
<h4>移除金山雲U盤方法(2015年1月6日更新)</h4>
<p>找到 <code>C:\Program Files (x86)\XiaoMi\MiWiFi\kuaipan</code> 目錄底下的 <code>uninstall.exe</code></p>
<p>執行它就是對雲U盤的完整移除, 如此就不需要處理我的電腦中的捷徑了</p>
<hr />
<ol>
<li>執行: <code>regedit</code></li>
<li>找到: <code>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{01249E9F-88FF-45d5-82DB-A1BEE06E123C}</code></li>
<li>然後刪掉它 (如果怕有問題可以先對它按右鍵->匯出, 將 reg 備份下來)</li>
<li>再重新啟動 <code>explorer.exe</code> 或是直接重開機, 應該就成功了</li>
</ol>
<h4>P.S.</h4>
<ul>
<li>我自己嘗試時, 雖然最後一個機碼不相同, 但刪除機碼後捷徑也會消失.</li>
<li>重新啟動後圖示又出現了, 但可對其移除.</li>
</ul>
<hr />
<h4>REF:</h4>
<ol>
<li><a href="http://bbs.xiaomi.cn/thread-10702622-1-1.html">小米論壇</a></li>
<li><a href="http://bbs.xiaomi.cn/thread-10615354-1-1.html">小米論壇</a></li>
</ol>
Tomcat 弱點 Apache Tomcat Default Error Page Version Detection 與修復方式
https://nelluil.postach.io/post/tomcat-ruo-dian-apache-tomcat-default-error-page-version-detection-yu-xiu-fu-fang-shi
2015-03-05T08:43:13.983000Z
2014-11-07T10:50:59Z
Liullen
<p>該弱點 <code>Apache Tomcat Default Error Page Version Detection</code><br />
意思是在 tomcat 的預設錯誤頁會呈現 Tomcat 版本, 可能讓攻擊者得知該版本有什麼弱點並藉此攻擊</p>
<p>這個弱點修復要替換 jar 檔 <code>catalina.jar</code> 中的檔案: <code>org/apache/catalina/util/ServerInfo.properties</code></p>
<p>原本這行是: <code>server.info=Apache Tomcat/7.042</code></p>
<p>把版本號拿掉變成: <code>server.info=Apache Tomcat</code></p>
<p>如附件截圖, 修改後就不會在 Default Error Page 出現 Tomcat 版本</p>
<p><img src="https://cdn-images.postach.io/w600_326bcd66a83112ef284f4a6c5951d9fa.png" style="cursor: default;"/><br />
<img src="https://cdn-images.postach.io/w600_1eaeb2923aa2f3eedfb1de5a18c2e227.png" style="cursor: default;"/></p>
MSSQL Server 對已經存在的 table 增加識別 id 欄位 (從1開始)
https://nelluil.postach.io/post/mssql-server-dui-yi-jing-cun-zai-de-table-zeng-jia-shi-bie-id-lan-wei-cong-1kai-shi
2015-03-05T08:43:13.985000Z
2014-11-07T03:47:24Z
Liullen
<h3>Sql Server add auto increment primary key to existing table</h3>
<p>No - you have to do it the other way around: add it right from the get go as <code>INT IDENTITY</code> - it will be filled with identity values when you do this:</p>
<pre><code class="sql">ALTER TABLE dbo.YourTable
ADD ID INT IDENTITY
</code></pre>
<p>and then you can make it the primary key:</p>
<pre><code class="sql">ALTER TABLE dbo.YourTable
ADD CONSTRAINT PK_YourTable
PRIMARY KEY(ID)
</code></pre>
<p>REF: <a href="http://stackoverflow.com">http://stackoverflow.com/questions/4862385/sql-server-add-auto-increment-primary-key-to-existing-table</a></p>
SQL Server:匯入資料遭遇“文字已截斷”錯誤
https://nelluil.postach.io/post/sql-server-hui-ru-zi-liao-zao-yu-wen-zi-yi-jie-duan-cuo-wu-lan-hua-xin-de-bao-gao-pi-ke-bang-pixnet
2015-03-05T08:43:13.987000Z
2014-11-07T02:54:57Z
Liullen
<p>匯入大檔, 錯誤大概都會長這樣...</p>
<p><img src="https://cdn-images.postach.io/w600_8f155d0783dc9380c3f4c4516af1f252.jpg" style="cursor: default;"/></p>
<h3>原文告訴大家改用一般檔案來源, 且匯入時對應的欄位型態要修改!</h3>
<h4>以下整理自原文的建議:</h4>
<ol>
<li>
<p>資料來源選擇: <code>一般檔案來源</code></p>
</li>
<li>
<p>選好欲匯入的檔案,左側點選 <code>進階</code></p>
</li>
<li>
<p>將文字欄位的 DataType 改成 <code>文字資料流[DT_TEXT]</code><br />
<img src="https://cdn-images.postach.io/w600_e8aec946e8e12736097ceccc278f27ba.jpg" style="cursor: default;"/></p>
</li>
<li>將整數欄位的 DataType 改成 <code>二位元組不帶正負號的整數[DT_UI2]</code></li>
</ol>
<p>圖片來源: <a href="蘭花心得報告">http://lanfar.pixnet.net</a></p>
<p>REF: <a href="http://lanfar.pixnet.net/blog/post/40707319-sql-server%EF%BC%9A%E5%8C%AF%E5%85%A5%E8%B3%87%E6%96%99%E9%81%AD%E9%81%87%E2%80%9C%E6%96%87%E5%AD%97%E5%B7%B2%E6%88%AA%E6%96%B7%E2%80%9D%E9%8C%AF%E8%AA%A4">SQL Server:匯入資料遭遇“文字已截斷"錯誤</a> from 蘭花❉心得報告</p>
在 Tomcat 關閉已被證實不安全的 SSLv3 protocol, 並改用 TLS
https://nelluil.postach.io/post/zai-tomcat-guan-bi-yi-bei-zheng-shi-bu-an-quan-de-sslv3-protocol-bing-gai-yong-tls
2015-03-05T08:43:13.989000Z
2014-10-23T08:15:42Z
Liullen
<ol>
<li>
<p>修改檔案 <code>Tomcat7\conf\server.xml</code></p>
</li>
<li>
<p>在 <code>connector</code> 增加 attribute: <code>sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2"</code> , 並拿掉 cipher 中非 TLS 的項</p>
</li>
</ol>
<h3>修改前</h3>
<pre><code class="xml">
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="tomcat.keystore" keystorePass="intumit"
ciphers="SSL_RSA_WITH_RC4_128_SHA,
TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA,
SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA" />
</code></pre>
<h3>修改後</h3>
<pre><code class="xml">
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="tomcat.keystore" keystorePass="intumit"
sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2"
ciphers="TLS_RSA_WITH_AES_128_CBC_SHA,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA" />
</code></pre>
<h3>修改前 sslscan 掃描</h3>
<pre><code> _
___ ___| |___ ___ __ _ _ __
/ __/ __| / __|/ __/ _` | &apos;_ \
\__ \__ \ \__ \ (_| (_| | | | |
|___/___/_|___/\___\__,_|_| |_|
Version 1.8.2-win
http://www.titania.co.uk
Copyright Ian Ventura-Whiting 2009
Compiled against OpenSSL 0.9.8m 25 Feb 2010
Testing SSL server 10.254.1.233 on port 443
Supported Server Cipher(s):
Rejected SSLv2 168 bits DES-CBC3-MD5
Rejected SSLv2 56 bits DES-CBC-MD5
Rejected SSLv2 128 bits IDEA-CBC-MD5
Rejected SSLv2 40 bits EXP-RC2-CBC-MD5
Rejected SSLv2 128 bits RC2-CBC-MD5
Rejected SSLv2 40 bits EXP-RC4-MD5
Rejected SSLv2 128 bits RC4-MD5
Rejected SSLv3 256 bits ADH-AES256-SHA
Rejected SSLv3 256 bits DHE-RSA-AES256-SHA
Rejected SSLv3 256 bits DHE-DSS-AES256-SHA
Rejected SSLv3 256 bits AES256-SHA
Rejected SSLv3 128 bits ADH-AES128-SHA
Accepted SSLv3 128 bits DHE-RSA-AES128-SHA
Rejected SSLv3 128 bits DHE-DSS-AES128-SHA
Accepted SSLv3 128 bits AES128-SHA
Rejected SSLv3 168 bits ADH-DES-CBC3-SHA
Rejected SSLv3 56 bits ADH-DES-CBC-SHA
Rejected SSLv3 40 bits EXP-ADH-DES-CBC-SHA
Rejected SSLv3 128 bits ADH-RC4-MD5
Rejected SSLv3 40 bits EXP-ADH-RC4-MD5
Accepted SSLv3 168 bits EDH-RSA-DES-CBC3-SHA
Rejected SSLv3 56 bits EDH-RSA-DES-CBC-SHA
Rejected SSLv3 40 bits EXP-EDH-RSA-DES-CBC-SHA
Rejected SSLv3 168 bits EDH-DSS-DES-CBC3-SHA
Rejected SSLv3 56 bits EDH-DSS-DES-CBC-SHA
Rejected SSLv3 40 bits EXP-EDH-DSS-DES-CBC-SHA
Accepted SSLv3 168 bits DES-CBC3-SHA
Rejected SSLv3 56 bits DES-CBC-SHA
Rejected SSLv3 40 bits EXP-DES-CBC-SHA
Rejected SSLv3 128 bits IDEA-CBC-SHA
Rejected SSLv3 40 bits EXP-RC2-CBC-MD5
Accepted SSLv3 128 bits RC4-SHA
Rejected SSLv3 128 bits RC4-MD5
Rejected SSLv3 40 bits EXP-RC4-MD5
Rejected SSLv3 0 bits NULL-SHA
Rejected SSLv3 0 bits NULL-MD5
Rejected TLSv1 256 bits ADH-AES256-SHA
Rejected TLSv1 256 bits DHE-RSA-AES256-SHA
Rejected TLSv1 256 bits DHE-DSS-AES256-SHA
Rejected TLSv1 256 bits AES256-SHA
Rejected TLSv1 128 bits ADH-AES128-SHA
Accepted TLSv1 128 bits DHE-RSA-AES128-SHA
Rejected TLSv1 128 bits DHE-DSS-AES128-SHA
Accepted TLSv1 128 bits AES128-SHA
Rejected TLSv1 168 bits ADH-DES-CBC3-SHA
Rejected TLSv1 56 bits ADH-DES-CBC-SHA
Rejected TLSv1 40 bits EXP-ADH-DES-CBC-SHA
Rejected TLSv1 128 bits ADH-RC4-MD5
Rejected TLSv1 40 bits EXP-ADH-RC4-MD5
Accepted TLSv1 168 bits EDH-RSA-DES-CBC3-SHA
Rejected TLSv1 56 bits EDH-RSA-DES-CBC-SHA
Rejected TLSv1 40 bits EXP-EDH-RSA-DES-CBC-SHA
Rejected TLSv1 168 bits EDH-DSS-DES-CBC3-SHA
Rejected TLSv1 56 bits EDH-DSS-DES-CBC-SHA
Rejected TLSv1 40 bits EXP-EDH-DSS-DES-CBC-SHA
Accepted TLSv1 168 bits DES-CBC3-SHA
Rejected TLSv1 56 bits DES-CBC-SHA
Rejected TLSv1 40 bits EXP-DES-CBC-SHA
Rejected TLSv1 128 bits IDEA-CBC-SHA
Rejected TLSv1 40 bits EXP-RC2-CBC-MD5
Accepted TLSv1 128 bits RC4-SHA
Rejected TLSv1 128 bits RC4-MD5
Rejected TLSv1 40 bits EXP-RC4-MD5
Rejected TLSv1 0 bits NULL-SHA
Rejected TLSv1 0 bits NULL-MD5
Prefered Server Cipher(s):
SSLv3 128 bits DHE-RSA-AES128-SHA
TLSv1 128 bits DHE-RSA-AES128-SHA
SSL Certificate:
Version: 2
Serial Number: -4294967295
Signature Algorithm: sha1WithRSAEncryption
Issuer: 馬賽克
Not valid before: Feb 19 07:35:50 2014 GMT
Not valid after: Feb 19 07:35:50 2016 GMT
Subject: 馬賽克
Public Key Algorithm: rsaEncryption
RSA Public Key: (1024 bit)
Modulus (1024 bit):
00:ad:e3:69:8a:78:d3:f3:fa:0d:60:33:ca:fe:25:
94:9b:1e:04:85:36:10:ac:76:63:82:62:61:f8:f5:
eb:0d:31:69:8c:80:54:91:3e:b5:a3:25:05:0a:22:
5e:5e:b1:c9:fa:9c:a6:08:71:3c:09:dc:22:7a:ee:
56:96:2c:b3:57:88:02:b0:9f:7b:7d:72:e7:79:bf:
1f:d6:a0:85:3f:b0:10:c3:dc:46:86:1c:e4:51:c8:
7c:d4:c2:fb:42:f7:6e:b3:63:f1:6c:2a:38:7a:29:
35:16:5a:ee:ff:a2:eb:31:0b:40:7e:96:66:8f:f2:
ac:5b:29:8b:33:74:cd:84:4b
Exponent: 65537 (0x10001)
X509v3 Extensions:
X509v3 Subject Key Identifier:
8B:E6:57:28:9C:DE:99:FE:A6:95:15:89:10:5C:85:AC:6F:3D:CB:90
X509v3 Authority Key Identifier:
keyid:0C:CE:36:BA:EB:3D:14:35:D7:C5:C3:CA:59:8B:27:81:8F:59:CD:6F
X509v3 CRL Distribution Points:
URI:馬賽克
URI:馬賽克
Authority Information Access:
CA Issuers - URI:馬賽克
CA Issuers - URI:馬賽克
1.3.6.1.4.1.311.20.2:
...W.e.b.S.e.r.v.e.r
X509v3 Basic Constraints: critical
CA:FALSE
X509v3 Key Usage:
Digital Signature, Key Encipherment
X509v3 Extended Key Usage:
TLS Web Server Authentication
Verify Certificate:
self signed certificate in certificate chain
</code></pre>
<h3>修改後 sslscan 掃描</h3>
<pre><code> _
___ ___| |___ ___ __ _ _ __
/ __/ __| / __|/ __/ _` | &apos;_ \
\__ \__ \ \__ \ (_| (_| | | | |
|___/___/_|___/\___\__,_|_| |_|
Version 1.8.2-win
http://www.titania.co.uk
Copyright Ian Ventura-Whiting 2009
Compiled against OpenSSL 0.9.8m 25 Feb 2010
Testing SSL server blahblah.com on port 443
Supported Server Cipher(s):
Rejected SSLv2 168 bits DES-CBC3-MD5
Rejected SSLv2 56 bits DES-CBC-MD5
Rejected SSLv2 128 bits IDEA-CBC-MD5
Rejected SSLv2 40 bits EXP-RC2-CBC-MD5
Rejected SSLv2 128 bits RC2-CBC-MD5
Rejected SSLv2 40 bits EXP-RC4-MD5
Rejected SSLv2 128 bits RC4-MD5
Failed SSLv3 256 bits ADH-AES256-SHA
Failed SSLv3 256 bits DHE-RSA-AES256-SHA
Failed SSLv3 256 bits DHE-DSS-AES256-SHA
Failed SSLv3 256 bits AES256-SHA
Failed SSLv3 128 bits ADH-AES128-SHA
Failed SSLv3 128 bits DHE-RSA-AES128-SHA
Failed SSLv3 128 bits DHE-DSS-AES128-SHA
Failed SSLv3 128 bits AES128-SHA
Failed SSLv3 168 bits ADH-DES-CBC3-SHA
Failed SSLv3 56 bits ADH-DES-CBC-SHA
Failed SSLv3 40 bits EXP-ADH-DES-CBC-SHA
Failed SSLv3 128 bits ADH-RC4-MD5
Failed SSLv3 40 bits EXP-ADH-RC4-MD5
Failed SSLv3 168 bits EDH-RSA-DES-CBC3-SHA
Failed SSLv3 56 bits EDH-RSA-DES-CBC-SHA
Failed SSLv3 40 bits EXP-EDH-RSA-DES-CBC-SHA
Failed SSLv3 168 bits EDH-DSS-DES-CBC3-SHA
Failed SSLv3 56 bits EDH-DSS-DES-CBC-SHA
Failed SSLv3 40 bits EXP-EDH-DSS-DES-CBC-SHA
Failed SSLv3 168 bits DES-CBC3-SHA
Failed SSLv3 56 bits DES-CBC-SHA
Failed SSLv3 40 bits EXP-DES-CBC-SHA
Failed SSLv3 128 bits IDEA-CBC-SHA
Failed SSLv3 40 bits EXP-RC2-CBC-MD5
Failed SSLv3 128 bits RC4-SHA
Failed SSLv3 128 bits RC4-MD5
Failed SSLv3 40 bits EXP-RC4-MD5
Failed SSLv3 0 bits NULL-SHA
Failed SSLv3 0 bits NULL-MD5
Rejected TLSv1 256 bits ADH-AES256-SHA
Rejected TLSv1 256 bits DHE-RSA-AES256-SHA
Rejected TLSv1 256 bits DHE-DSS-AES256-SHA
Rejected TLSv1 256 bits AES256-SHA
Rejected TLSv1 128 bits ADH-AES128-SHA
Accepted TLSv1 128 bits DHE-RSA-AES128-SHA
Rejected TLSv1 128 bits DHE-DSS-AES128-SHA
Accepted TLSv1 128 bits AES128-SHA
Rejected TLSv1 168 bits ADH-DES-CBC3-SHA
Rejected TLSv1 56 bits ADH-DES-CBC-SHA
Rejected TLSv1 40 bits EXP-ADH-DES-CBC-SHA
Rejected TLSv1 128 bits ADH-RC4-MD5
Rejected TLSv1 40 bits EXP-ADH-RC4-MD5
Rejected TLSv1 168 bits EDH-RSA-DES-CBC3-SHA
Rejected TLSv1 56 bits EDH-RSA-DES-CBC-SHA
Rejected TLSv1 40 bits EXP-EDH-RSA-DES-CBC-SHA
Rejected TLSv1 168 bits EDH-DSS-DES-CBC3-SHA
Rejected TLSv1 56 bits EDH-DSS-DES-CBC-SHA
Rejected TLSv1 40 bits EXP-EDH-DSS-DES-CBC-SHA
Rejected TLSv1 168 bits DES-CBC3-SHA
Rejected TLSv1 56 bits DES-CBC-SHA
Rejected TLSv1 40 bits EXP-DES-CBC-SHA
Rejected TLSv1 128 bits IDEA-CBC-SHA
Rejected TLSv1 40 bits EXP-RC2-CBC-MD5
Rejected TLSv1 128 bits RC4-SHA
Rejected TLSv1 128 bits RC4-MD5
Rejected TLSv1 40 bits EXP-RC4-MD5
Rejected TLSv1 0 bits NULL-SHA
Rejected TLSv1 0 bits NULL-MD5
Prefered Server Cipher(s):
TLSv1 128 bits DHE-RSA-AES128-SHA
</code></pre>
<h3>SSL/TLS 設定參考資料</h3>
<ol>
<li>http://en.wikipedia.org/wiki/Transport_Layer_Security#Cipher</li>
<li>http://security.stackexchange.com/questions/19096/how-to-determine-if-a-browser-is-using-an-ssl-or-tls-connection</li>
<li>http://askubuntu.com/questions/537196/how-do-i-patch-workaround-sslv3-poodle-vulnerability-cve-2014-3566</li>
<li>https://blog.eveoh.nl/2014/02/tls-ssl-ciphers-pfs-tomcat/</li>
<li>https://wiki.mozilla.org/Security/Server_Side_TLS</li>
</ol>
SQL Server Drop All The Tables
https://nelluil.postach.io/post/sql-server-drop-all-the-tables
2015-03-05T08:43:13.992000Z
2014-09-17T06:28:55Z
Liullen
<p>這就是 <code>Stored Procedures</code>, 不過這似乎要有權限才能完成!</p>
<pre><code>EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"
</code></pre>
How to fetch the row count for all tables in a SQL SERVER database
https://nelluil.postach.io/post/how-to-fetch-the-row-count-for-all-tables-in-a-sql-server-database
2015-03-05T08:43:14.002000Z
2014-09-16T03:28:00Z
Liullen
<p>The following SQL will get you the row count of all tables in a database:</p>
<pre><code>CREATE TABLE #counts
(
table_name varchar(255),
row_count int
)
EXEC sp_MSForEachTable @command1=&apos;INSERT #counts (table_name, row_count) SELECT &apos;&apos;?&apos;&apos;, COUNT(*) FROM ?&apos;SELECT table_name, row_count FROM #counts ORDER BY table_name, row_count DESC
</code></pre>
<p>The output will be a list of tables and their row counts.<br />
If you just want the total row count across the whole database, appending:</p>
<pre><code>SELECT SUM(row_count) AS total_row_count FROM #counts
</code></pre>
<p>will get you a single value for the total number of rows in the whole database.</p>
<p>REF: <br />
<a href="http://stackoverflow.com/questions/2221555/how-to-fetch-the-row-count-for-all-tables-in-a-sql-server-database">Fetch_row_count_for_all_tables_in_a_SQL_SERVER</a> by adrianbanks from <a href="stackoverflow.com">stackoverflow.com</a></p>
7za(7-zip commad-line) 壓縮備份
https://nelluil.postach.io/post/7za-7-zip-commad-line-ya-suo-bei-fen
2015-03-05T08:43:14.006000Z
2014-09-09T09:27:28Z
Liullen
<ol>
<li>藉由 Windows 排程每天執行一次</li>
<li>透過 7-zip 打包指定資料夾, 存在 local 端目錄</li>
<li>掛載網路磁碟機, 並上傳至指定位置</li>
<li>刪除 local 端目錄超過 7 天的備份檔</li>
</ol>
<h3>gist</h3>
<p><script src="https://gist.github.com/Liullen/69a09b94f97ef02b931b.js"></script></p>
Tomcat SSL 憑證產生教學
https://nelluil.postach.io/post/tomcat-ssl-ping-zheng-chan-sheng-jiao-xue
2015-03-05T08:43:14.012000Z
2014-09-04T03:53:15Z
Liullen
<h3>Step1. 建立 private key金鑰</h3>
<pre><code>C:\j2sdk1.4.2_05\bin>keytool -genkey -alias mykey( 別名 :可自設) -validity 720( 效期 ) -keyalg RSA -keysize 1024 -keystore tomcat.keystore(產出的 keystore檔名) -storepass mypassword( 密碼自設 ) –keypass mypassword(密碼自設)
</code></pre>
<h3>Step 2. 輸入憑證資訊</h3>
<p>一般名字與姓名會輸入該網站的 daman,若測試輸入localhost即可,其他資訊看客戶是否有要求,否則隨意填即可。<br />
<img src="https://cdn-images.postach.io/w600_34222908728385086b7ecfbd537ea8c9.png" style="cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;"/></p>
<h3>Step 3. 產出憑證要求的 CSR檔</h3>
<pre><code>C:\j2sdk1.4.2_05\bin>keytool -certreq -alias mykey(Step1 設定的別名 ) -file cert.csr(產出的csr 檔名 ) -keystore tomcat.keystore (Step1產出的 keystore檔) -storepass mypassword(Step1 keystore密碼 )
</code></pre>
<p><img src="https://cdn-images.postach.io/w600_be41a3cb47a43ed1debbe885581b3d73.png" style="cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;"/><br />
匯出的憑證內容</p>
<h3>Step 4. 匯入 CRE憑證檔</h3>
<p>利用 CSR檔產回CRE 憑證檔進行匯入。<br />
此時,請確認客戶產出 CRE檔的程式,是否有根憑證或中繼憑證,若有麻煩先匯入根憑證及中繼憑證,否則會無法匯入憑證。<br />
方法 1: 根憑證及中繼憑證匯入Java Security ,再匯入產出的 CRE憑證檔</p>
<h4>Step 4-1-1.匯入根憑證及中繼憑證</h4>
<pre><code>C:\j2sdk1.4.2_05\bin>keytool -import -trustcacerts -alias tomcat( 別名 :可自設) -file server.cer(根憑證、中繼憑證 ) -keystore %JAVA_HOME%/jre/lib/security/cacerts -storepass changeit(jre預設密碼是 changeit)
</code></pre>
<h4>Step 4-1-2.匯入產出的憑證</h4>
<pre><code>C:\j2sdk1.4.2_05\bin>keytool -import -trustcacerts -alias mykey(Step1 設定的別名 ) -file cert.cer(產出的憑證檔 ) -keystore tomcat.keystore(Step1產出的keystore 檔) -storepass mypassword(Step1 keystore密碼 )
</code></pre>
<p>方法 2:直接匯入keystore( 依信任關係,由最上層憑證,依序往下安裝 )</p>
<h4>Step 4-2-1.匯入根憑證及中繼憑證</h4>
<pre><code>C:\j2sdk1.4.2_05\bin> keytool -import -alias mykey(別名 :可自設) -file server.cer(根憑證、中繼憑證 ) -keystore tomcat .keystore(Step1產出的 keystore檔) -storepass mypassword(Step1 keystore密碼 )
</code></pre>
<h4>Step 4-2-2.匯入產出的憑證</h4>
<pre><code>C:\j2sdk1.4.2_05\bin>keytool -import -trustcacerts -alias mykey(Step1 設定的別名 ) -file cert.cer(產出的憑證檔 ) -keystore tomcat.keystore(Step1產出的keystore 檔) -storepass mypassword(Step1 keystore密碼 )
</code></pre>
<p><img src="https://cdn-images.postach.io/w600_19a7c27ea3d0a7ec519d532f53c6748f.png" style="cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;"/><br />
匯入完成的訊息</p>
<h3>Step 5.修改Tomcat server.xml 的設定</h3>
<p><script src="https://gist.github.com/Liullen/c699b1646e24b9b93338.js"></script></p>
<h3>PS.</h3>
<p>1.如果客戶是自己認證沒經過第三方大廠,匯入客戶的根憑證及中繼憑證是一定要的,不然匯不進去。<br />
2.記得要改成 <code>protocol="org.apache.coyote.http11.Http11Protocol"</code> ,APR 的方式測試都不成功,等有人成功可以分享一下。<br />
3.查詢keystore 資訊語法</p>
<pre><code>keytool -list -keystore tomcat.keystore(Step1 產出的 keystore檔) -storepass mypassword(Step1 keystore密碼 )
</code></pre>
<p><strong>感謝 Nick 教學</strong></p>
透過用 Gist 實現含版本控制代辦事項
https://nelluil.postach.io/post/tou-guo-yong-gist-shi-xian-han-ban-ben-kong-zhi-dai-ban-shi-xiang
2015-03-05T08:43:14.015000Z
2014-09-02T06:16:20Z
Liullen
<p>我一直找不到簡單的 todo 代辦事項工具, 後來被我翻到這個: <strong>gist</strong>, </p>
<p>如果妳會 markdown 又會 git 或許可以試試看</p>
<p>只要你擁有 github 帳號,<br />
並在 gist 建立一個 markdown (檔名設為 *.md 就會自動被判斷為 markdown)<br />
只要 .md 的內容按下圖規則輸入 (空隔 減號 空隔 左中刮號 空隔 右中括號 空隔 內容),</p>
<p><code>- [ ] 一個待辦事項</code><br />
<code>- [x] 一個勾選的代辦事項</code></p>
<p><img src="https://cdn-images.postach.io/w600_a98e478cc1567d0292e8e45b5e7c6533.png" style="cursor: default;cursor: default;"/></p>
<p>將該 markdown 儲存之後, 神奇的事情就發生了</p>
<p><img src="https://cdn-images.postach.io/w600_8d8c58422f489f9f9ae420d73e7098cb.png" style="cursor: default;cursor: default;"/></p>
<p>gist 將為依據你輸入的內容產出一個可以勾選的 todo list,<br />
重點是重點是重點是: <code>有版本控管</code><br />
任何勾選的操作都會自動儲存<br />
而且...每一次勾選都會是一個 commit, XDD</p>
<p><img src="https://cdn-images.postach.io/w600_2595ee77bc6c674f703f987c1bcd6896.png" style="cursor: default;cursor: default;"/></p>
<p>這邊有一個範例: <a href="https://gist.github.com/Liullen/4043af966d49236fce7e#seans-todo-list">seans-todo-list</a></p>
<p>但好像只有自己的 gist 帳號才能用對自己的 markdown 勾選編輯</p>
<p>REF: <a href="http://lifehacker.com/why-a-github-gist-is-my-favorite-to-do-list-1493063613">lifehacker_How to Turn GitHub into a To-Do List</a></p>
Windows Server 2012 .NET3.5 或 4.5 的安裝方法
https://nelluil.postach.io/post/windows-server-2012-net3-5-huo-4-5-de-an-zhuang-fang-fa
2015-03-05T08:43:14.016000Z
2014-08-20T02:05:41Z
Liullen
<p>由於一些安全性之類的問題,</p>
<p>所以某些 <code>Windows Server 2012</code> 預設是沒有安裝 <code>.net framework 3.5</code> 的<br />
若需要安裝:<br />
[控制台] > [程式集] > [程式和功能]<br />
在右邊有一個 [新增角色集功能精靈]<br />
按著精靈步驟, 勾選以安裝 .net 3.5 或 4.5</p>
<p>因為目前產品使用的轉檔的 *.exe 是由 C# 開發, <br />
故需要透過 .net, 故若沒安裝會導致 office 轉 pdf 失敗</p>
EditorViewer - A Eclipse plug-in of vertical tab view
https://nelluil.postach.io/post/editorviewer-a-eclipse-plug-in-of-vertical-tab-view
2015-03-05T08:43:14.032000Z
2014-07-03T01:39:40Z
Liullen
<div>
我常常因為 Eclipse 開了太多 tab,<br/>
導致一直需要在程式碼視窗堆裡一直切換 (`Ctrl`+`PageDown` / `PageUp` 或 `Ctrl`+`Tab`)<br/>
但這樣切換往往是很沒效率, 或又找不到,<br/>
就又重新用 Open Resource (`Ctrl`+`Shift`+`R`) 或 Open Class (`Ctrl`+`Shift`+`T`) 重新打開一次,<br/></div>
<div><br/></div>
<div><br/></div>
<div>因此我想找一個能夠在 View 中顯示目前開啟的程式碼檔案,</div>
<div><br/></div>
<div><br/></div>
<div>果然有的!</div>
<div><br/></div>
<div><br/></div>
<div>**[EditorViewer@Sourceforge](http://sourceforge.net/projects/editorviewer/)**</div>
<div>但這個專案似乎好一陣子沒有在維護與更新了</div>
<div><br/></div>
<div>Sourceforge 上有放幾張示意圖, 大概長這樣: </div>
<div><img src="https://cdn-images.postach.io/w600_3789f4dfb4664fb6f97ea667b2c8d450.png" height="708" style="cursor: default;" width="975"/></div>
<div><br/></div>
<div><br/></div>
<div>奇怪的是我裝好之後, 好像沒有如下圖的 *type view*</div>
<div><img src="https://cdn-images.postach.io/w600_0f444ad04bcc6f4495777b47c6df63b3.png" style="cursor: default;"/></div>
CKEditor 4.3 自訂功能 config
https://nelluil.postach.io/post/ckeditor-4-3-zi-ding-gong-neng-config
2015-03-05T08:43:14.050000Z
2014-06-17T01:59:42Z
Liullen
<div style="font-family: Courier,"><div><div>一些可能會在 CKEditor 會用到的自訂功能: </div>
<div><br/></div>
1. 包括新增字體 (要該 OS 底下擁有這個字體, 因為只是 apply css font-family)<br/>
2. 從 word 貼上保留各種樣式<br/>
3. 調整字體可以選擇的大小與單位<br/>
4. html tag 的黑名單與白名單</div><div> (若為 4.4 版直接使用 disallowedContent 即可, 不須從 allowedContent 砍掉)<br/>
5. Enter 換行的模式 p, br, div</div><div><br/></div>
<div><script src="https://gist.github.com/Liullen/ffb91de3bf75f07fcec9.js"></script></div>
<div><br/></div>
<div>幾乎都要回去看一下文件</div>
<div><br/></div>
<div>REF: [CKEditor 4 Documentation](http://docs.ckeditor.com/#!/guide)</div></div>
製作簡單的 JMeter 測試腳本
https://nelluil.postach.io/post/zhi-zuo-jian-dan-de-jmeter-ce-shi-jiao-ben
2016-09-07T03:39:09.349000Z
2014-06-12T07:52:37Z
Liullen
<div><div style="font-family: Courier,">jMeter 2.9</div></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_2bc8f2fedbc788d9322583a8d466b92d.png" style="cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">+ 開一個 **執行緒群組**</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_179ca0a8278343e16cf435ca5e27512e.png" height="383" style="cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;" width="651"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">+ 在底下加入 **錄製控制器**</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_fcaa810ed5e90961eb5339f851b8b06e.png" height="478" style="cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;" width="742"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">+ 對 http proxy server, 設定要被連接用的 **port** (給瀏覽器用), 要指定的 **錄製控制器** (指定剛剛建立的錄製控制器)</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_335e5038209d4ce49cd4b67be98a64c5.png" style="cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_1a028e093099197639a5861e4f4c5b86.png" height="759" style="cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;" width="1050"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">+ 到瀏覽器去設定 proxy 連接, 輸入剛剛的 proxy server port number (以 firefox 29 為例)</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_4ae9230081bc73d9ab3dba1d7eb8b74e.png" height="801" style="cursor: default;cursor: default;cursor: default;cursor: default;cursor: default;" width="1022"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">+ 回到 jMeter 剛剛建立的 http proxy server 按下 **開始**, 就可以開始在瀏覽器上操作了</div>
<div style="font-family: Courier,">+ 錄製好後可以回到 http proxy server 按下 **停止**</div>
<div style="font-family: Courier,">+ 所有操作就會跑到 **錄製控制器中**了</div>
<div style="font-family: Courier,">+ 之後可以自訂每個錄到的 request, 例如 header 或是 form params 等</div>
<div style="font-family: Courier,">+ 可以把該專案存下來 **.jmx **</div>
<div style="font-family: Courier,">+ 設定運行測試的參數: **一次跑幾個**, **跑幾次**, 用計時器設定 **開始結束時間** 或直接設定**跑多久**</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">> 若開始時間設定是比當前時間晚, 會變成像是*預約*執行測試一樣, 該執行緒群組便會等到開始時間到才會開始執行.</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_7b486c9794e2fa72c92cf511c5e2eb2a.png" height="486" style="cursor: default;cursor: default;cursor: default;cursor: default;" width="917"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">+ 若要模擬使用者在頁面中的停留, 可以使用 **固定值計時器** 或 **一致隨機計時器**, 計時器的功能是在每一個動作之前加上延遲</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_d56539cf535fe02231e852cea139059d.png" height="318" style="cursor: default;cursor: default;cursor: default;" width="748"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">+ 執行之前可以加入需要的報表以檢視測試結果, 以下是 **彙整報告**</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_26e28af86cf46e6cf9788d17299b77ce.png" height="678" style="cursor: default;cursor: default;cursor: default;" width="681"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">結果大概會長這樣, 記得可以匯出成 .csv 檔</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,"><img src="https://cdn-images.postach.io/w600_fdf5f0a930c6a88310ef8d819f53cf8c.png" height="581" style="cursor: default;cursor: default;cursor: default;" width="752"/></div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">之後有空再寫一下如何以多個帳號對某個 ap 登入 (這樣叫做 data driven?)</div>
在 SQL Server 2005 中取得所有欄位定義的方法(含備註欄位)
https://nelluil.postach.io/post/zai-sql-server-2005-zhong-qu-de-suo-you-lan-wei-ding-yi-de-fang-fa-han-bei-zhu-lan-wei
2015-03-05T08:43:14.058000Z
2014-06-05T02:59:13Z
Liullen
<div><div style="font-family: Courier, "Courier New", monospace;"><script src="https://gist.github.com/anonymous/78fa23e9636950a2bec0.js"></script></div></div>
<div style="font-family: Courier, "Courier New", monospace;"><br/></div>
<div style="font-family: Courier, "Courier New", monospace;"><br/></div>
<div style="font-family: Courier, "Courier New", monospace;">SQL 這個算超好用的... 如果要請客戶幫忙 debug</div>
<div style="font-family: Courier, "Courier New", monospace;"><br/></div>
<div style="font-family: Courier, "Courier New", monospace;">結果會把所有 table 以及各個欄位的資訊放在一起輸出</div>
<div style="font-family: Courier, "Courier New", monospace;"><br/></div>
<div style="font-family: Courier, "Courier New", monospace;"><img src="https://cdn-images.postach.io/w600_106615a6b906cad107633d38a549e7f5.png" height="380" style="cursor: default;" width="650"/></div>
<div style="font-family: Courier, "Courier New", monospace;"><br/></div>
<div style="font-family: Courier, "Courier New", monospace;">REF: [The Will Will Web](http://blog.miniasp.com/post/2007/11/05/How-to-get-detailed-Data-Dictionary-in-SQL-Server-2005.aspx)</div>
<div style="font-family: Courier, "Courier New", monospace;"><br/></div>
<div style="font-family: Courier, "Courier New", monospace;"><br/></div>
sql指令取得table內的欄位名稱
https://nelluil.postach.io/post/sqlzhi-ling-qu-de-tablenei-de-lan-wei-ming-cheng
2015-03-05T08:43:14.061000Z
2014-06-05T02:51:28Z
Liullen
<div><div style="font-family: Courier,">###MSSQL</div></div>
<div style="font-family: Courier,">``select name from syscolumns where id=object_id('tablename')``</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">###Oracle</div>
<div style="font-family: Courier,">```</div>
<div style="font-family: Courier,">select COLUMN_NAME from all_tab_columns</div>
<div style="font-family: Courier,">where owner='OWNER' --需要大寫,否則找不到</div>
<div style="font-family: Courier,">and table_name='DIS_PHON_ACC' --需要大寫,否則找不到</div>
<div style="font-family: Courier,">order by column_id</div>
<div style="font-family: Courier,">```</div>
<div style="font-family: Courier,"><br/></div>
<div style="font-family: Courier,">REF: [sql指令取得table內的欄位名稱](http://blog.roodo.com/fionscenery/archives/19070448.html)</div>
透過 js 檢查 input file 的檔案副檔名
https://nelluil.postach.io/post/tou-guo-js-jian-cha-input-file-de-dang-an-fu-dang-ming
2017-12-27T06:07:09.437000Z
2014-05-30T03:05:48Z
Liullen
<p>由於 html5 開始才支援 accept 屬性: <code>audio/*</code>, <code>video/*</code>, <code>image/*</code></p>
<p>可以用於檢查 input file 的檔案格式, </p>
<p>ex:</p>
<p><input accept="image/*" ></p>
<p>REF: <a href="http://www.w3schools.com/tags/att_input_accept.asp">w3schools</a></p>
<p>但若要支援較舊的瀏覽器, 似乎只能夠過檢查副檔名來判斷</p>
<p>這邊透過 <code>split('.')</code> 再用 array 的 <code>pop()</code> 取出最後一個點後方的字串, 也就是副檔名, </p>
<p>若是以單存取得副檔名的功能來說, 這個方法還滿簡潔的.</p>
<p>當然若要直接用 <code>RegExp.test()</code> 來驗證整個檔名也完全可以, 我想效能應該不會差太多.., 所以這篇只是想記錄取副檔名的用法: <code>split('.').pop()</code> XDD</p>
<p><script src="https://gist.github.com/Liullen/9ffd7067aa2436d558a5.js"></script></p>
<p><a href="http://jsfiddle.net/w65Cg/1/">A Simple DEMO@JSFiddle</a></p>
btoa(), atob() 支援中文的方法
https://nelluil.postach.io/post/btoa-atob-zhi-yuan-zhong-wen-de-fang-fa
2015-03-05T08:43:14.067000Z
2014-05-14T01:48:19Z
Liullen
<div><div>由於 btoa 只能以英文數字等非 unicode 組合作為輸入, 所以若要支援 unicode 字元(中文), 必須用替代方法, 先將內容 escape 再 encode, </div>
<div><br/></div>
<div><script src="https://gist.github.com/anonymous/1b543452f48091f98917.js"></script></div><br/></div><div>DEMO: [jsfiddle](http://jsfiddle.net/zrj9ydgc/)</div>
<div><br/></div>
<div>REF: [window.btoa(MDN)](https://developer.mozilla.org/en-US/docs/Web/API/window.btoa)</div>
Data Uri Schema
https://nelluil.postach.io/post/data-uri-schema
2015-03-05T08:43:14.069000Z
2014-05-12T02:14:52Z
Liullen
<div>藉由瀏覽器的 data uri schema, </div>
<div>使用 data type: application/octet-stream 就可以用來下載由 javascript 產生的資料,</div>
<div>不經由瀏覽器, 且大部分瀏覽器皆支援, (IE8 有 32KB 的 data 限制)</div>
<div>配合 download 的 tag attribute 就能夠指定下載名稱 (only support: ff, chrome)</div>
<div><br/></div>
<div>最明顯的缺點是效能, 無法 cache 且每次載入必須重新 decode 和 embed</div>
<div><br/></div>
<script src="https://gist.github.com/anonymous/e53d4f097407f8c5e74d.js"></script>
<div><br/></div>
<div>REF: [Data_URI_scheme (Wikipedia)](http://en.wikipedia.org/wiki/Data_URI_scheme)</div>
Css 無線轉圈圈 loading
https://nelluil.postach.io/post/css-wu-xian-zhuan-quan-quan-loading
2015-03-05T08:43:14.079000Z
2014-05-09T03:09:36Z
Liullen
<div><script src="https://gist.github.com/anonymous/738da5818d95c9362919.js"></script></div>
<div><br/></div>
<div><br/></div>
<div>DEMO: [JSFIDDLE](http://jsfiddle.net/aRgTP/)</div>
SolrServer.commit() 拋出 500 Server Error 的 RumtimeException
https://nelluil.postach.io/post/solrserver-commit-pao-chu-500-server-error-de-rumtimeexception
2015-03-05T08:43:14.080000Z
2014-04-09T01:57:15Z
Liullen
<div>Client 透過 SolrServer.commit() 將資料送到Solr Server 時, </div>
<div>若拋出 500 Server Error 的 RumtimeException, </div>
<div>但資料卻有正常存入 Solrm, </div>
<div>可能就是 web.xml 的 Filter 先後順序的問題, </div>
<div>Solr 希望 SolrDispatchFilter 可以優先被處裡, </div>
<div>故將以下 filter 放到最前面即可</div>
<div><br/></div>
<div><script src="https://gist.github.com/anonymous/10218970.js"></script></div>
<div><br/></div>
<div>----</div>
<div><br/></div>
<div>### 以下為 Server Error 時, Server 端的錯誤訊息</div>
<div><br/></div><div>> 10047764 [qtp2912633-15] ERROR<br/>
> org.apache.solr.servlet.SolrDispatchFilter - null:<br/>
> org.apache.solr.common.SolrException:<br/>
> Solr requires that request parameters sent using application/x-www-form-urlencoded content-type can be read through therequest input stream.</div><div>> Unfortunately, the stream was empty / not available.<br/>
> This may be caused by another servlet filter calling ServletRequest.getParameter*() before SolrDispatchFilter, please remove it.</div><div><br/></div>
How To Embed Gist In Postach.io
https://nelluil.postach.io/post/how-to-embed-gist-in-postach-io
2015-03-05T08:43:14.083000Z
2014-03-27T08:35:14Z
Liullen
<p>因為直接在 postach.io 貼 markdown 的 code block 總是無法很漂亮的有 color schema, </p>
<p>而且似乎對 xml 不支援... </p>
<p>所以找了一下, 原來官方也有建議的對策, 可以用 embedded gist !</p>
<p>gist 這個服務應該隨著 github 的流行, 滿多人都在用的<br />
不過沒想到 postach.io 也有支援, 真好 (Y)</p>
<p>postach.io 給的範例: </p>
<p><script src="https://gist.github.com/geekforbrains/5322895.js"></script></p>
<p>REF: <a href="http://blog.postach.io/how-to-embed-gist-in-postach-io">How To Embed Gist In Postach.io</a></p>
Solr 不斷字搜尋, Highlight
https://nelluil.postach.io/post/solr-bu-duan-zi-sou-xun-highlight
2015-03-05T08:43:14.085000Z
2014-03-27T08:21:53Z
Liullen
<p>修改檔案 <code>schema.xml</code></p>
<p>必須將 autoGeneratePhraseQueries 改為 true,<br />
若為 false, 則會將 query 字串斷成多個字元去交叉搜尋,<br />
雖然搜尋的到, 但並不會正確 Highlight 該完整關鍵字串</p>
<p>(好像要 schema 1.4 版才支援, 1.3版若加上去會導致 Solr Server 開不起來)</p>
<pre><code>autoGeneratePhraseQueries=true|false (in schema version 1.4 and later this now defaults to false)
</code></pre>
<ul>
<li>schema example:</li>
</ul>
<p><script src="https://gist.github.com/anonymous/9802935.js"></script></p>
<ul>
<li>另外一個做法是在 query 時加上 <code>hl.usePhraseHighlighter</code> 參數<ul>
<li><a href="http://wiki.apache.org/solr/HighlightingParameters#hl.usePhraseHighlighter">http://wiki.apache.org/solr/HighlightingParameters#hl.usePhraseHighlighter</a></li>
</ul>
</li>
</ul>
<pre><code>// 避免中文被斷詞 highlight
solrQuery .setParam ( "hl.usePhraseHighlighter", true );
</code></pre>
判斷 image 是否為 blank 和 判斷是否為 Empty
https://nelluil.postach.io/post/pan-duan-image-shi-fou-wei-blank-he-pan-duan-shi-fou-wei-empty
2015-03-05T08:43:14.087000Z
2014-03-27T04:14:40Z
Liullen
<div>這邊的 blank 指的是一張非常接近白色的圖片, 而 Empty 則是指一張 byte[].length == 0 的檔案</div>
<div><br/></div>
<div><script src="https://gist.github.com/anonymous/c249e706a5c24d49986e.js"></script></div>
<div><br/></div>
<div>這邊是 pdfbox 擷取圖片的範例, 簡單說就是以去計算 ByteArrayOutputStream 的 byte[] 的長度</div>
<div><br/></div>
<div><br/></div>
<div><script src="https://gist.github.com/anonymous/84671a7eefb068c053fd.js"></script></div>
<div><br/></div>
<div><br/></div>
<div>REF: [http://www.rgagnon.com/javadetails/java-0631.html](http://www.rgagnon.com/javadetails/java-0631.html)</div>
<div><br/></div>
<div><br/></div>
<div><br/></div>
<div><br/></div>
<div><br/></div>
快速建立 DB TABLE 測試的設定
https://nelluil.postach.io/post/kuai-su-jian-li-db-table-ce-shi-de-she-ding
2015-03-05T08:43:14.091000Z
2014-03-26T07:51:25Z
Liullen
<div><div align="left"><span style="text-align: -webkit-auto;"><script src="http:///spanhttps://gist.github.com/anonymous/a94bd3cff7d32a204b44span.js"></script></span></div></div>
<div align="left"><br/></div>
PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
https://nelluil.postach.io/post/pwc6345-there-is-an-error-in-invoking-javac-a-full-jdk-not-just-jre-is-required
2015-03-05T08:43:14.098000Z
2014-03-17T09:03:12Z
Liullen
<div>###PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required</div>
<div><br/></div>
當 Jetty Server 作為 JSP Web Container, Server 啟動並連線時發生以下錯誤訊息:<br/><br/>
> ...<br/>
> PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required<br/>
> <br/>
> Caused by:<br/>
> org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required<br/>
> ...<br/>
______<br/><br/>
<br/>
可以在 jetty9/start.ini 中, 加上:<br/><br/>
`-Dorg.apache.jasper.compiler.disablejsr199=true`
<div><br/></div><div>(文章提到 Jetty 應該是大於6都適用, 我自己是在 jetty9 遇到的)<br/><br/>
如果使用的是 embedded jetty 沒有 start.ini 可以修改的話, 可以直接在執行 jetty 的 method 之前加上:
<div><br/>
`System.setProperty("org.apache.jasper.compiler.disablejsr199", "true");`<br/><br/><br/>
詳細內容可以參考:</div><div><br/>
Ref: [Stackoverflow](http://stackoverflow.com/questions/9113346/pwc6345-there-is-an-error-in-invoking-javac-error-when-using-jetty-wtp-plugi)</div></div>