alfresco:3.4.5
深埋很久的bug,用javascript webscript/java backed都會產生暫存檔無法清除的問題
有找到一些討論的訊息 https://issues.alfresco.com/jira/browse/ALF-2363
=====
Alfresco QA Team added a comment - 19-May-10 03:23 PM
Validated against 3.3.0 beta 39.
Temp files are removed according to tempFileCleanerTrigger settings in scheduled-jobs-context.xml.
=====
alfresco會透過tempFileCleanerTrigger 來清除檔案,相關設定在scheduled-jobs-context.xml。
設定檔路徑在以下/usr/local/TOMCAT/webapps/alfresco/WEB-INF/classes/alfresco
星期三, 1月 30, 2013
星期五, 1月 25, 2013
[JSP] jsp session getAttribute跟setAttribute都爆炸了 XD
機器上測試用OpenJDK做的session操作整個爆掉(不能取/不能建session)。
都會噴以下二個exception:
setAttribute: Session already invalidated
getAttribute: Session already invalidated
以下是成功於正常的Oracle JDK成功操作session的測試碼,移到新的環境就會爆掉XD
都會噴以下二個exception:
setAttribute: Session already invalidated
getAttribute: Session already invalidated
以下是成功於正常的Oracle JDK成功操作session的測試碼,移到新的環境就會爆掉XD
//try{ HttpSession httpsession = request.getSession(false); if(httpsession == null){ System.out.println("HttpSession null"); }else{ System.out.println("HttpSession:" + httpsession.getId()); } if(httpsession.getAttribute("test") == null){ //throw getAttribute: Session already invalidated //if(session.getAttribute("test") == null) { System.out.println("Session not found"); try{ System.out.println("Start to craete session"); //request.getSession(true).setAttribute("test", "HelloSession"); //session.setAttribute("test", "HelloSession"); //httpsession.setAttribute("test", "HelloSession"); HttpSession newSession = request.getSession(true); if(newSession.isNew()){ System.out.println("isNew session id:" + newSession.getId()); }else{ System.out.println("old session id:" + newSession.getId()); } newSession.setAttribute("test", "HelloSession"); System.out.println("Suceed to craete session"); }catch(IllegalStateException illeagalStateEx){ System.out.println("Fail to craete session:" + illeagalStateEx.getMessage()); } }else{ System.out.println("Session found"); String sessionValue = (String)httpsession.getAttribute("test"); System.out.println("sessionValue:" + sessionValue); } //}catch(Exception ex){ //System.out.println("Global Exception:" + ex.getMessage()); //}
星期三, 1月 23, 2013
星期一, 1月 21, 2013
[jQuery API] beforeunload 偵測頁面關閉或刷新
有時候你需要偵測使用者刷新或關閉頁面進行一些處理,可以使用beforeunload事件。
//refesh page event
目前測試發現如果使用者按上一頁的話雖會執行這個事件,但卻會造成正在執行的連線中斷(例如:上傳) 不過眼尖發現這個confirm dialog的按鈕其實長的不一樣XD
$(window).bind("beforeunload", function() { return "Are you sure?"; });When you add return false, a confirmation dialog shows up, delaying the page unload. Meanwhile, the AJAX request finishes. When no return statement is included, the page will immediately unloads, terminating all active connections (and breaking your AJAX request).
目前測試發現如果使用者按上一頁的話雖會執行這個事件,但卻會造成正在執行的連線中斷(例如:上傳) 不過眼尖發現這個confirm dialog的按鈕其實長的不一樣XD
[jQuery API] 取得$元素的內容
有時候取要取得目前jquery物件的html是什麼,
目前找到以下解法,如果有其他方法就跪求了XD
var $container = $("<div/>"); var content = $container.append($TargetElem).clone()).html();
[TOMCAT] 設定 session逾期時間
如何設定tomcat的 session逾期時間
單位:分鐘!!
That's a strange question. Why do you want to do it?
Anyway, no, it's not possible. Not directly at least. You will have to
implement a session listener and call setMaxInactiveInterval on every
new session. There you can specify the interval in seconds
單位:分鐘!!
<session-config> <session-timeout>5</session-timeout> </session-config>如果要設定成秒數的話要另外實作,根據下述的資料參考
http://www.velocityreviews.com/forums/t146162-tomcat-5-0-config-timeout-in-seconds.html
Anyway, no, it's not possible. Not directly at least. You will have to
implement a session listener and call setMaxInactiveInterval on every
new session. There you can specify the interval in seconds
星期三, 1月 16, 2013
[jQuery plugin] jQuery File Upload
用了一陣子的jQuery File Upload,發現在FF使用小於2MB的檔案,Progress bar無法正常的讀取file bytes XD
See also:
https://github.com/blueimp/jQuery-File-Upload/issues/1905
See also:
https://github.com/blueimp/jQuery-File-Upload/issues/1905
星期二, 1月 15, 2013
星期五, 1月 11, 2013
[jQuery plugin] 秒 轉換 為時:分:秒格式
找到的秒數轉時分秒格式的範例
jQuery.fn.time_from_seconds = function() { return this.each(function() { var t = parseInt($(this).text(), 10); $(this).data('original', t); var h = Math.floor(t / 3600); t %= 3600; var m = Math.floor(t / 60); var s = Math.floor(t % 60); $(this).text((h > 0 ? h + ' hour' + ((h > 1) ? 's ' : ' ') : '') + (m > 0 ? m + ' minute' + ((m > 1) ? 's ' : ' ') : '') + s + ' second' + ((s > 1) ? 's' : '')); }); };加強一下可以支援多國語言
/** * Time from seconds * Refer from * @author ken tsai * @date 2013/1/13 **/ ;(function($) { $.fn.time_from_seconds = function() { return this.each(function() { var t = parseInt($(this).text(), 10); $(this).data('original', t); $(this).text($.timeFromSeconds(t)); }); }; $.timeFromSeconds = function(t){ var h = Math.floor(t / 3600); t %= 3600; var m = Math.floor(t / 60); var s = Math.floor(t % 60); // var conv = (h > 0 ? h + ' hour' + ((h > 1) ? 's ' : ' ') : '') + // (m > 0 ? m + ' minute' + ((m > 1) ? 's ' : ' ') : '') + // s + ' second' + ((s > 1) ? 's' : ''); var hour = "", minute = "", second = ""; if($.timeFromSeconds.defaults.plural){ hour = (h > 0 ? h + " " + $.timeFromSeconds.defaults.hours + ((h > 1) ? "s " : " ") : " "); minute = (m > 0 ? m + " " + $.timeFromSeconds.defaults.minutes + ((m > 1) ? "s " : " "):" "); second = (s > 0 ? s + " " + $.timeFromSeconds.defaults.seconds + ((s > 1) ? "s " : " "): " "); }else{ hour = (h > 0 ? h + " " + $.timeFromSeconds.defaults.hours: " "); minute = (m > 0 ? m + " " + $.timeFromSeconds.defaults.minutes: " "); second = (s > 0 ? s + " " + $.timeFromSeconds.defaults.seconds: " "); } return hour + minute + second; }; $.timeFromSeconds.setDefaults = function(defaults){ $.timeFromSeconds.defaults = defaults; }; $.timeFromSeconds.defaults = { hours:"hour", minutes:"minute", seconds:"second", plural:true }; })(jQuery);
星期四, 1月 03, 2013
[jQuery API] 指定selector不包含某些屬性
簡單的selector筆記
$("a:not([href*=word1],[href*=word2])").click(function() { //do something });