2010年9月26日 星期日

Mac OS Server 服務的相關 Port

Remote Login (SSH) - 22
Screen Sharing Service (VNC) - 5900
AddressBook Service - 8800, 8843
iChat Service - 5222, 5223, 5060, 5269, 7777
Mail Service (SMTP, IMAP, POP) - 25, 110, 143, 587, 993, 995
Web Service - 80, 443
VPN Service (L2TP) - 500, 1701, 4500
VPN Service (PPTP) - 1723
File Sharing Service (AFP, SMB) - 548, 139

參考URL
http://support.apple.com/kb/TS2963

2010年9月16日 星期四

Setting Debugging PHP with Xdebug

1. download xdebug 

2. copy xdebug's dll to php\ext\ (ex. C:\Program Files\PHP\ext)

3. modify php.ini add xdebug define (if xdebug's dll name is php_xdebug-2.0.5-5.2.dll)
    zend_extension_ts="C:\Program Files\PHP\ext\php_xdebug-2.0.5-5.2.dll"
    xdebug.remote_enable=1 
    xdebug.remote_handler=dbgp 
    xdebug.remote_host=127.0.0.1 
    xdebug.remote_port=9000 
    xdebug.remote_mode=req 
    xdebug.idekey=default 
    xdebug.remote_log="c:\tmp\xdebug\xdebug.log" 
    xdebug.show_exception_trace=0 
    xdebug.show_local_vars=9 
    xdebug.show_mem_delta=0 
    xdebug.trace_format=0 
    xdebug.profiler_enable  = 1 
    xdebug.profiler_output_dir ="c:\tmp\xdebug"

4. Make sure you create the folder c:\tmp\xdebug\

5. restart apache

6. look phpinfo()
  















Reference URL : http://www.webcheatsheet.com/php/debug_php_with_xdebug.php

2010年9月4日 星期六

設定Input只能輸入數值


在Script Tag之中加入限制的方法

<Script>

...

$(function() 
{
$('#InputID').bind('keypress', filterWithOutNumber)
});



//限制只能輸入數值的方法
function filterWithOutNumber(e) 
{
if(e.which!=8 && e.which!=0 && (e.which<48 || e.which>57))
return false;
else
return true;
}

...

</Script>

<body>
<Input type="text" id="InputID"></Input>
</body>


2010年8月12日 星期四

How to Delete a Windows Service

Command 語法如下
    sc delete [ServiceName]

Ex.
    sc delete "GlassfishService"

2010年7月27日 星期二

c3p0 的屬性設定

acquireIncrement 
    當Connection Pool中的連線用盡時所批次新增Connection的數量. Default: 3

acquireRetryAttempts 

    定義從Databases取新Connection時失敗後重覆嘗試次數. Default: 30


acquireRetryDelay 
    兩次連接中間隔時間, 單位毫秒. Default: 1000


autoCommitOnClose 
    Connection Close時預設將所有未Commit的交易RollBack. Default: false


automaticTestTable
    c3p0將建立一個名為Test的空資料表, 並使用其自帶的查詢語句進行測試.
    如果定義了這個參數那麼屬性preferredTestQuery將被忽略. 無法在此Test
    資料表進行任何作業, Test只提供c3p0測試使用. Default: null


breakAfterAcquireFailure
    取Connection失敗將會引起所有等待Connection Pool來取Connection的
    Thread拋出異常.但是Databases仍有效保留, 並在下次調用getConnection()
    的時候繼續嘗試取得Connection, 如果設為true, 那麼在嘗試取Connection
    失敗後該DataSource將申明已斷開並永久關閉. Default: false


checkoutTimeout
    從Connection Pool等待取得新的Connection的時間, 超過此時間後, 將拋
    出SQLException, 如設為0則無限期等待. 單位毫秒. Default: 0


connectionTesterClassName
    通過實現Connection Tester或QueryConnectionTester的類別來測試
    Connection. 類別名稱需為全路徑. 
    Default: com.mchange.v2.c3p0.impl.DefaultConnectionTester


factoryClassLocation
    指定c3p0 Libraries的路徑, 如果在Local端就無需設定, 預設null即可, 
    Default: null


forceIgnoreUnresolvedTransactions
    Strongly disrecommended. Setting this to true may lead to 
    subtle and bizarre bugs. 


idleConnectionTestPeriod
    設定每多少秒檢查所有Connection Pool中的閒置Connection. 
    Default: 0


initialPoolSize
    初始化時建立多少Connection, 值應在minPoolSize與maxPoolSize之間
    , Default: 3


maxIdleTime
    最大閒置時間, 每多少秒內未使用Connection則丟棄. 若為0則永不丟棄. 
    Default: 0


maxPoolSize
    Connection Pool中保留最大Connection Count. Default: 15


maxStatements
    JDBC的標準參數, 用來控制Datasource內加載的PreparedStatements
    數量. 如果maxStatements與maxStatementsPerConnection均為0, 
    則暫存被關閉. Default: 0


maxStatementsPerConnection
    定義Connection Pool內單個Connection所擁有的最大暫存statements
    數. Default: 0


numHelperThreads
    c3p0是非同步操作的, 緩慢的JDBC操作通過幫助程式完成. 擴展這些操作
    可以有效的提升性能通過Thread實現多個操作同時被執行. Default: 3


overrideDefaultUser
    當用戶調用getConnection()時使用root用戶成為去取Connection的用戶.
    主要用於Connection Pool 連接非c3p0的Datasource. Default: null


overrideDefaultPassword
    與overrideDefaultUser參數對應使用的一個參數. Default: null


password
    密碼. Default: null


preferredTestQuery
    定義所有Connection測試都執行的測試語法, 注意:測試的表必須在初始
    Datasource的時候就存在. Default: null


propertyCycle
    用戶修改系統配置參數執行前最多等待的秒數, Default: 300


testConnectionOnCheckout
    如果設為true那麼在每個Connection Commit的時候都將驗證有效性. 建
    議使用idleConnectionTestPeriod或automaticTestTable等方法來提升
    連接測試的性能Default: false


testConnectionOnCheckin
    如果設為true那麼在取得連接的同時將驗證連接的有效性. Default: false


user
    用戶名. Default: null

2010年6月7日 星期一

Setting Access Log for Tomcat

打開 Tomcat 下的 Server.xml
新加入二個 Tag

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="combined" resolveHosts="false"/>

<Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>

重新啟動 Tomcat

瀏覽 Tomcat 網站後

在 log forder 下將會出現 access log file