java

Thursday, October 23, 2008

線上筆記系統安裝注意事項

一,Tomcat:
1.請注意路徑名稱ROOT與WEB-INF與META-INF是否皆為大寫,若為小寫Tomcat將會不認得。(這是linux與windows不同之處)
2.記得要把mysql-connector-java-5.0.3-bin.jar置於apache-tomcat-6.0.18/lib
3.請檢察apache-tomcat-6.0.18/work/LifeManager是否有寫入權限

二,mysql:
1.在my.cnf中,[mysqld]段,請勿設定skip-networking(rpm會自動設定);若發現有,請加#註解或直接刪除。

以上我花費了近乎三天的努力才得以解決,特記錄之。

// Usher. 2008/10/24

Wednesday, September 13, 2006

MySql的核心價值

Revenue Model

MySQL AB has three main sources of revenue:

1. Online support and subscription services sold globally over the MySQL.com website to all users of the MySQL server.
2. Sales of commercial MySQL licenses to users and developers of software products and of products that contain software.
3. Franchise of MySQL products and services under the MySQL brand to value-added partners.

We provide our customers and partners with support services they can depend on, consulting services, training programs, and more.
Our Values

We want the MySQL server to be:

* The best and the most used database in the world
* Available and affordable for all
* Easy to use
* Continuously improved while remaining fast and safe
* Fun to use and improve
* Free from bugs

MySQL AB and the people of MySQL AB:

* Subscribe to the Open Source philosophy
* Aim to be good citizens
* Prefer partners that share our values and mindset
* Answer email and give support
* Are a virtual company, networking with others

Thursday, September 07, 2006

Java vs. .Net

從java回過頭來看.Net
才會更瞭解.Net在做什麼
.Net包裝了很多東西
讓人很容易上手
初學者較會接受

有了.Net開發經驗再來接觸java
才發現原來java這麼迷人
java自有一套設計哲學
很多東西你都必須自己來
但會覺得心情愉快
因為可以左右許多東西與想法

原本在.Net想不到的
在java竟本來就存在了

Logout

logout機制
1.以servlet將該session設為無效
2.在web.xml中設定監控session的listener
3.從listener 中找到session,從session找到loginUser,記錄登出時間
4.從listener 中找到session,從session找到context.config,從context.config找到session總數,減一

Authentication

每個程式都要做一次身份認證是件麻煩的事
最好就是挷一個filter在應用程式上
由filter去check是否session中仍有該login的資料
若session已無,表示該user已logout或session expired
若aession正常,再導向原本要執行的程式
如此,程式本身就不必再費心使用身分的問題了

exception

怎麼架構例外處理
在bean中所發生的例外
先catch住,不論發生何種例外
都throw成一般例外
加入自己所要的資訊往外抛

一層一層往外抛
多一層都多加了一些相關的例外說明

最後由web.xml中的<error-page>所指定的error.jsp
去處理即可

Context

Context代表一個Application
其下會有很多request所引發的session
在Tomcat 5.x的版本
Context被置於Meta-Inf\下
檔名為context.xml
要有了這個JNDI的DataSource才lookup得到
試了好久...終於喔

根目錄的設定

根目錄的設定必需要以ROOT為目錄名
ex. e:\WebSite 是80 port所對應的entry
根目錄並不在e:\WebSite
而在e:\WebSite\ROOT
這是Tomcat的規定吧
但很少書上有寫到....