To setup an Oracle Datasource in Glassfish

Posted by chenyue on 7月 30th, 2009

To setup an Oracle Datasource in Glassfish, follow these steps:

1. Copy the Oracle JDBC drivers to /glassfish/domains/domain1/lib/ext directory. You may need to change the directory /glassfish/domains/domain1 to match your installation of Glassfish and the domain name.

2. Start Glassfish.

3. Login to the admin interface and create a JDBC Connection Pool.
Delete all properties, and add following properties:
user - set this to Oracle userid
password - set this to Oracle password
URL - set this to the URL, example jdbc:oracle:thin:@localhost:1521:xe.
xa-driver-does-not-support-non-tx-operations - set this to true.
Test the connection pool using ping.

4. Create a JDBC DataSource using the Connection Pool.

php 设置默认语言和数据接口默认Charset

Posted by chenyue on 7月 24th, 2009

// SET ENV - Umgebungsvariablen fuer Sprache setzen

putenv(’LC_ALL=de_DE.UTF-8′);

putenv(’LANGUAGE=de_DE.UTF-8′);

putenv(’NLS_LANG=GERMAN_GERMANY.UTF8′);

或者在

 

SetEnv 指令

说明
设置环境变量

语法
SetEnv env-variable value

作用域
server config, virtual host, directory, .htaccess

覆盖项
FileInfo

状态
基本(B)

模块
mod_env

设置一个环境变量,该变量将会传送到CGI脚本和SSI页面。例如:

示例

SetEnv SPECIAL_PATH /foo/bin

这样在 $APACHE_HOME/conf/httpd.conf 中加入

PassEnv ORACLE_HOME
PassEnv LD_LIBRARY_PATH
PassEnv LANG
PassEnv NLS_LANG

SetEnv LANG zh_CN.UTF-8
SetEnv NLS_LANG American_America.zhs16cgb231280
SetEnv ORACLE_HOME /home/oracle/oracle/product/10.2.0/client_1
SetEnv LD_LIBRARY_PATH /home/oracle/oracle/product/10.2.0/client_1/lib:$LD_LIBRARY_PATH

NetBeans:UTF-8 Character Set

Posted by chenyue on 7月 23rd, 2009

Here are instructions for setting the default character set in Netbeans to UTF-8 (in Windows):

  1. Go to C:\Program Files\netbeans-x.x\etc
  2. Open netbeans.conf in Notepad.
  3. On the netbeans_default_options add: -J-Dfile.encoding=UTF-8. (make sure to put it within the quotation marks)
  4. Project properties -> Build -> Compiling ->
    Additional compiler options) text box.- add: -encoding UTF-8
  5. You can also check to make sure that you have increased the memory allocation for Netbeans by looking at the netbeans_default_options line. The default max is 128MB. We have increased this to 256MB.

References:

http://wp.uberdose.com/2007/05/07/netbeans-and-utf-8/

http://www.techienuggets.com/Comments?tx=619

JSP注释和字符引用约定

Posted by chenyue on 7月 15th, 2009

下面是一些特殊的标记或字符,你可以利用它们插入注释或可能被视为具有特殊含义的字符。 语法 用途
<%– comment –%> JSP注释,也称为“隐藏注释”。JSP引擎将忽略它。标记内的所有JSP脚本元素、指令和动作都将不起作用。
<!– comment –> HTML注释,也称为“输出的注释”,直接出现在结果HTML文档中。标记内的所有JSP脚本元素、指令和动作正常执行。
<\% 在模板文本(静态HTML)中实际上希望出现“<%”的地方使用。
%\> 在脚本元素内实际上希望出现“%>”的地方使用。
\’ 使用单引号的属性内的单引号。不过,你既可以使用单引号也可以使用双引号,而另外一种引号将具有普通含义。
\” 使用双引号的属性内的双引号。参见“\’”的说明。

js动态调用function

Posted by chenyue on 7月 8th, 2009

判断 函数是否存在:

  • 1      try
  • 2       {
  • 3         if(typeof(eval(funcName))==”function”)
  • 4         {
  • 5             funcName();
  • 6         }
  • 7       }catch(e)
  • 8       {
  • 9       //alert(”not function”);
  • 10       }

函数名存在变量里,调用动态的函数名:

  • var   f=   “functionA”;
  • eval(f   +”()”)