Thursday, May 26, 2005

Quaqua Look And Feel

The Quaqua Look and Feel (Quaqua) is a Java implementation of Apple's Human Interface Guidelines (AHIG) for Mac OS X.

Wednesday, May 25, 2005

Bookmark Online

del.icio.us is a social bookmarks manager. It allows you to easily add web pages you like to your personal collection of links, to categorize those sites with keywords, and to share your collection not only among your own browsers and machines, but also with others.

Tuesday, May 24, 2005

Growl

Growl is a global notification system for Mac OS X. Any application can send a notification to Growl, which will display an attractive message on your screen.

Thursday, May 19, 2005

Sharing Big Files on the Internet

You send it is a nice website to send big files to friends.

Tuesday, May 17, 2005

Setup JDBC DataSources under Tomcat

Reference: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

  • server.xml before </host>
<!-- This is added for JDBC DataSource by zhibin -->
<Context path="/cpg" docBase="cpg" debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/bioDB" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/bioDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>30000</value>
</parameter>
<parameter>
<name>username</name>
<value>UHN</value>
</parameter>
<parameter>
<name>password</name>
<value>microarray</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/test</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
</ResourceParams>
</Context>
  • web.xml
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/bioDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
  • test code
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<sql:query var="rs" dataSource="jdbc/bioDB">
select id, cont from aainno;
</sql:query>

<html>
<head>
<title>DB Test</title>
</head>
<body>

<h2>Results</h2>

<c:forEach var="row" items="${rs.rows}">
Foo ${row.id}<br/>
Bar ${row.cont}<br/>
</c:forEach>

</body>
</html>
  • servlet
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

Context env = new InitialContext();
DataSource pool = (DataSource) env.lookup("java:comp/env/jdbc/bioDB");
Connection database = pool.getConnection();
  • Global Resources
If put JDBC resource under <GlobalNaming Resources> and put <ResourceLink name="jdbc/bioDB" global="jdbc/bioDB" type="javax.sql.DataSource" /> inside <DefaultContext>, the Database Pool can be used by every application under the server, which means globally.

Friday, May 13, 2005

mod_jk installation from source code under Mac OS X

[~/tmp/jakarta-tomcat-connectors-1.2.12-src/jk/native]$./configure --with-apxs=/usr/local/apache2/bin/apxs
cd apache-2.0
make -f Makefile.apxs
make -f Makefile.apxs install

cp workers.properties from jk/conf directory to apache/conf directory and make modification
make modification

add to http.conf

# Load mod_jk module
LoadModule jk_module modules/mod_jk.so

# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send servlet for context /examples to worker named worker1
JkMount /*/servlet/* ajp13
# Send JSPs for context /examples to worker named worker1
JkMount /*.jsp ajp13

Wednesday, May 11, 2005

5 Simple Steps to Integrate Tomcat 5.5 with Apache 2.0

The simplest configuration is described. It assumes you already have Tomcat 5.5 and Apache 2.0 (instructions for Apache 1.3 is also provided) installed and running.
The instructions are applicable (have been tested) for Windows as well as Linux platform.

Assume you want to map test directory of Apache to the mytest web application of Tomcat. Change the name appropriately to suit your configuration.

1. Shutdown Apache & Tomcat Server

2. Add the following lines to httpd.conf (in conf directory of Apache base directory)

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ProxyPass /test/ http://localhost:8081/mytest/
ProxyPassReverse /test/ http://localhost:8081/mytest/

Note: Replace localhost with the appropriate IP address or hostname of the server where Tomcat is installed.

Note 2: On older Apache 1.3 you will have to use libproxy.so instead:

LoadModule proxy_module modules/libproxy.so
AddModule mod_proxy.c

I copied this article from http://blog.taragana.com/index.php/archive/5-steps-to-integrate-tomcat-55-with-apache-20/, but I have not tried it yet.

Tuesday, May 10, 2005

Widgets Gone Wild

Amnesty Widget Browser is a utility for Mac OS X 10.4 Tiger that allows Dashboard widgets to live directly on your Desktop via a convenient icon in your system menu bar.

Thursday, May 05, 2005

Java Upload Bean

UploadBean is a JAVA™ component (JavaBean™) that allows to upload files. This bean could be integrated in any JSP/Servlets application. You can store uploaded files in a Folder, a ZIP archive, a Database or in Memory. Restrictions such as file size limit, blacklist/whitelist and max. uploaded files are available. You can also be notified when on upload events.