| Message |
|
|
OLAT 6.2.2出來了一陣子,昨天開始嘗試升級,除了壓縮檔解壓縮出來的目錄命名方式跟之前不同外,執行到ant build時還遇到了下面這樣的錯誤
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError: Java heap space
後來查了一下OLAT mailing list裡面,有人也遇到了這樣的問題,解法就是加上一個
export ANT_OPTS=-Xmx128m
宣告再執行ant build就可以了,底下直接給整個執行的shell script,有需要的人請自行參考並修改。
# get OLAT source
cd ~/download
wget http://www.olat.org/downloads/stable/OLAT-6.2.2.zip
unzip OLAT-6.2.2.zip
mv olat3 OLAT-6.2.1
mv OLAT-6_2_2-PUBLIC-* olat3
cd olat3
# config build.properties
sed -e "s/\/usr\/local\/opt\/olat\/olat3/\/home\/andowson\/download\/olat3/g" \
-e "s/\/usr\/local\/opt\/olat\/olatdata/\/home\/andowson\/data\/olatdata/g" \
-e "s/\/usr\/local\/opt\/tomcat/\/var\/tomcat6/g" \
-e "1,$$s/www.myolat.com/www.andowson.com/g" \
-e "1,$$s/myolat.com/andowson.com/g" \
-e "1,$$s/myolat/andowson/g" \
-e "s/server.modjk.enabled=false/server.modjk.enabled=true/g" \
-e "55a\server.modjk.jvmRoute=worker1" \
-e "s/defaultcharset=ISO-8859-1/defaultcharset=UTF-8/g" \
-e "s/registration.enableNotificationEmail=false/registration.enableNotificationEmail=true/g" \
-e "s/smtp.host=smtp.andowson.com/smtp.host=smtp.other.com/g" \
-e "s/smtp.user=/smtp.user=username/g" \
-e "s/smtp.pwd=/smtp.pwd=password/g" \
-e "121,143d" \
-e "1,$$s/#db/db/g" \
-e "1,$$s/net.sf.hibernate/org.hibernate/g" \
-e "s/instantMessaging.server.name=jabber.andowson.com/instantMessaging.server.name=www.andowson.com/g" \
-e "s/instantMessaging.db.name=wildfire/instantMessaging.db.name=openfire/g" \
-e "s/instantMessaging.db.user=wildfire/instantMessaging.db.user=openfire/g" \
-e "s/instantMessaging.db.pass=wildfire/instantMessaging.db.pass=openfire/g" \
-e "s/cluster.catalinaport=8006/cluster.catalinaport=8105/" \
-e "s/cluster.ajpport=8009/cluster.ajpport=8109/" build.properties.default > build.properties
# adjust the original template config files
# enable zh_CN and zh_TW on the top right menu
sed -i -e "s/<enabledLanguages>en,de,fr,it,es<\/enabledLanguages>/<enabledLanguages>en,de,fr,it,es,zh_CN,zh_TW<\/enabledLanguages>/g" ~/download/olat3/webapp/WEB-INF/olat_config.xml.in
# change domain name in email address
sed -i -e "1,$$s/olat-newinstallation.org/andowson.com/g" ~/download/olat3/webapp/WEB-INF/olat_config.xml.in
# fix the commnet style in XML
sed -i -e "13c\ <\!-- default session timeout -->" ~/download/olat3/webapp/WEB-INF/web.xml.in
# remove findbugs setting
sed -i -e "1348,1361d" build.xml
ant config-all
# to avoid OutOfMemoryError
export ANT_OPTS=-Xmx128m
ant build
# stop Tomcat
sudo /etc/init.d/tomcat stop
# backup db
sudo -u postgres pg_dump olat > /tmp/olat.bak
# copy to the target directory
sudo mv ~/www/olat /tmp/olat-6.2.1
cp -rf ~/download/olat3/webapp ~/www/olat
cp -rf ~/download/olat3/htdocs/* ~/www/olat
sudo chmod 775 ~/www/olat/static
sudo chmod 775 ~/www/olat/WEB-INF
sudo chmod 775 -R ~/data/olatdata
# start Tomcat
sudo /etc/init.d/tomcat start
|
 |
|
|
本站今天正式升級至JForum 2.1.9版。如果有發現任何問題請回報給我。
|
 |
|
|
|
|
 |
|
|
今天遇到了一個問題,就是如果想要在網站關閉時將正在連線的session手動斷線後再關閉資料庫連線,需要取得session物件,但之前對連線資料只有紀錄到sessionId而已。要由sessionId字串去建構出一個HttpSession物件對Java而言似乎不是合法的方法。
搜尋了一下,找到一篇文章,建議的作法是可以將session物件紀錄到ServletContext物件(其實就是一個Map物件)去,用sessionId當作key, session物件當作value,則要取回session時用ServletContext.getAttribute(sessionId)即可。而session進入和離開ServletContext的時間點可以用一個HttpSessionListener來管理,改寫sessionCreated、sessionDestroyed這兩個methods即可:
加入及移除session
@Override public void sessionCreated(final HttpSessionEvent se) { final HttpSession session = se.getSession(); final ServletContext context = session.getServletContext(); context.setAttribute(session.getId(), session); } @Override public void sessionDestroyed(final HttpSessionEvent se) { final HttpSession session = se.getSession(); final ServletContext context = session.getServletContext(); context.removeAttribute(session.getId()); }
取回session物件
private HttpSession getSession(final String sessionId) { final ServletContext context = getServletContext(); final HttpSession session = (HttpSession) context.getAttribute(sessionId); return session; }
參考資料:
http://stackoverflow.com/questions/1499581/how-can-i-manually-load-a-java-session-using-a-jsessionid
|
 |
|
|
一般我們要註冊網域名稱時都會先查詢一下這個網域是否已經被註冊了,使用的工具就是WHOIS。現在有個網站就叫做
https://who.is/
只要在上面輸入網域名稱就可以查詢出一堆資訊,除了WHOIS外,還包括DNS Records。
Information內有內容資訊、連入連結數及分時統計之流量排名。
Web Search則是有出現網域名稱的連結,有時會有意外的發現。
DNS Records就是域名內的細部主機資訊了,還真是一覽無遺啊!
|
 |
|
|
|
|
 |
|
|
在Eclipse中對build.xml檔案按滑鼠右鍵選擇Run As->Ant Build...時,如果看到一堆build.xml, build.xml(1), build.xml(2), ...的選擇視窗,可以利用下面的方法來解決:
在Eclipse中點選上方選單的Run->External Tools-> External Tools Configurations… ,會跳出一個Create, manage, run configuration對話框,然後將左邊的Ant Build下面列出的build.xml, build.xml(1), build.xml(2)...刪除,再關閉該對話框即可。
參考資料:
http://www.spacebug.com/removing_ant_configuration_selection_in_eclipse.html
|
 |
|
|
感謝二楞子的提醒,原始文章的連結已經修正。另外也歡迎二楞子發表一下使用這些軟體的心得或安裝過程喔。
|
 |
|
|
最近一部很久沒人理它的Windows 2000 Server主機CPU跑到一直維持100%,C槽空間剩下64KB。發現開個DOS視窗比開檔案總管還快,看來是需要複習一下DOS指令了。以下是我找到的一個網址,供大家參考:
http://teach.mcsh.kh.edu.tw/sheu5711/eg/dos.htm
有時候,還是得在文字介面下工作的。
|
 |
|
|
Matthew您好:
歡迎您的加入。之前我看簡體中文的進度還落後繁體中文,看來繁體中文這邊得加油了。
|
 |
|
|
最近花了好長一段時間將JForum的網頁修改為支援XHTML 1.0 Transitional標準,並以W3C的 網頁驗證工具來檢測。
主要修正的項目大致如下:
1.將網頁加上XHTML 1.0 Transitional文件格式宣告。
2.將<br><hr><img><input>加上結尾標籤
3.將原本沒有值的屬性重複一次屬性名稱,如selected改為selected="selected",checked改為checked="checked",disabled改為disabled="disabled",multiple改為multiple="multiple"
4.<form>需要設定action=
5.<form>需在<table>之外,且<form>內不能再有</form>
6.有些標籤不能放在<span>內,改用<div>取代<span>
7.JavaScript要改為<script type="text/javascript">並用<![CDATA[]]> 包起來,例如:
<script type="text/javascript">
/* <![CDATA[ */
var CONTEXTPATH = "";
var SERVLET_EXTENSION = ".page";
/* ]]> */
</script>
8.JavaScript的字串中如果遇到/字元需要做跳脫,例如"</option>"改為"<\/option>"。
9.<style>設定需要放到<head>內,不然就是改為放到style.css中。
10.<img>需要加上alt。
11.<img>需要加上src。
12.&需要替換為&
13.標籤的id值不能是數字開頭。
14.<tr>和<tr>之間不能插入<input>或<script>標籤,可改為放<td>去。
15.<embed>標籤不能再使用了。
為了加速這個過程,我是使用Firefox的plugin - Web Developer 及 HTML Validator ( http://users.skynet.be/mgueury/mozilla/)來進行。
在Web Developer方面,利用瀏覽器工具列上的工具->顯示驗證工具列,可以看到是否通過W3C驗證的綠色或有幾項不符合,按下去便可連結到W3C的網頁。
用HTML Validator則會在瀏覽器的右下角出現一個顯示網頁是否符合標準的綠色或紅色圖示。按下它可以顯示整個網頁原始檔,並會告知有問題的行數及參考的修改方法。
整個過程下來,發現原先的網頁樣版檔的HTML標籤還真是有些小問題。有了這兩個工具希望以後大家在開發網頁應用程式時可以更符合W3C的標準。
參考資料
http://jane-wu.blogspot.com/2007/04/w3c-xhtml.html
|
 |
|
|
缺少的部分補充如下:
UserModel.selectAllByGroup = SELECT TOP %d \
user_email, u.user_id, user_posts, user_regdate, username, deleted, user_karma, user_from, \
user_website, user_viewemail \
FROM jforum_users u, jforum_user_groups ug \
WHERE u.user_id = ug.user_id \
AND ug.group_id = ?
/**
* @see net.jforum.dao.UserDAO#selectAllByGroup(int, int, int)
*/
public List selectAllByGroup(int groupId, int startFrom, int count)
{
String sql = SystemGlobals.getSql("UserModel.selectAllByGroup");
sql = sql.replaceAll("%d", String.valueOf(startFrom + count));
PreparedStatement p = null;
ResultSet rs = null;
try {
p = JForumExecutionContext.getConnection().prepareStatement(sql);
p.setInt(1, groupId);
rs = p.executeQuery();
return this.processSelectAll(rs);
}
catch (SQLException e) {
throw new DatabaseException(e);
}
finally {
DbUtils.close(rs, p);
}
}
|
 |
|
|
hannibal0416您好:
基本上您給的資訊太少,並不足以判斷問題出在哪裡,可能得請您再花點耐性,把Tomcat的log檔內容看一下,也許就可以找到原因了。
|
 |
|
|
只要在form標籤的後面加上style="margin: 0px; padding: 0px;"即可。
<form name="loginform" method="post" style="margin: 0px; padding: 0px;">
<table>
...
</table>
</form>
參考資料:
http://www.webdevelopersnotes.com/tips/html/removing_space_padding_from_form_tag.php3
|
 |
|
|
最近發現很多網站開始加上這三種推文按鈕,本站也參考了一下別人的作法,在原來文章主題旁邊的RSS按鈕旁,加上分享到其他網站的按鈕,讓大家可以將本站的文章分享到facebook, plurk, 或twitter去。
參考資料:
http://0123456789.tw/?p=909
|
 |
|
|