2007年7月12日星期四
log4j 简单配置
2.log4j.properties置于 classes 下
3.log4j.properties
log4j.rootCategory=ERROR, file,console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
#log4j.appender.console.layout.ConversionPattern= %t %p - %m %n
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=./example.log // D:\Program Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\bin
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern= %d{yyyy-MM-dd HH:mm:ss} : %t %p - %m %n
4. import=org.apache.commons.logging.Log;
% 3B import=org.apache.commons.logging.LogFactory;
5.Log logger = LogFactory.getLog(this.getClass());
logger.error("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
2007年6月7日星期四
静态页面-2006-05-27
http://www.flashnet.cn/bbs/dispbbs.asp?boardid=33&ID=553&replyID=553
为了减轻服务器压力,将原来的文章管理系统由JSP文件的从数据库中取数据显示改为由jsp生成静态html文件后直接访问html文件。下面是一个简单的示例
1.buildhtml.jsp
<%@ page contentType="text/html; charset=gb2312" import="java.util.*,java.io.*"%>
<%
try{
String title="This is Title";String content="This is Content Area";
String editer="LaoMao";
String filePath = "";
filePath = request.getRealPath("/")+"test/template.htm";
//out.print(filePath+"<br>");
String templateContent="";
FileInputStream fileinputstream = new FileInputStream(filePath);//读取模块文件
int lenght = fileinputstream.available();
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes);
fileinputstream.close();
templateContent = new String(bytes);
//out.print(templateContent);
templateContent=templateContent.replaceAll("###title###",title);
templateContent=templateContent.replaceAll("###content###",content);
templateContent=templateContent.replaceAll("###author###",editer);// 替换掉模块中相应的地方
//out.print(templateContent);
// 根据时间得文件名
Calendar calendar = Calendar.getInstance();
String fileame = String.valueOf(calendar.getTimeInMillis()) +".html";
fileame = request.getRealPath("/")+fileame;//生成的html文件保存路径
FileOutputStream fileoutputstream = new FileOutputStream(fileame);//建立文件输出流
byte tag_bytes[] = templateContent.getBytes();
fileoutputstream.write(tag_bytes);
fileoutputstream.close();
}
catch(Exception e){
out.print(e.toString());
}
%>
2. template.htm
<html>
<head>
<title>###title###</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css.css" rel=stylesheet type=text/css>
</head>
<body>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td align="center">###title###</td>
</tr>
<tr>
<td align="center">author:###author### </td>
</tr>
<tr>
<td>###content###
</td>
</tr>
</table>
</body>
</html>
oracle资料备份
# Generated by Oracle configuration tools.
GZJS_192.168.102.200 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.200)(PORT = 1521))
)
(CONNECT_DATA =
(SID = gzjs)
(SERVER = DEDICATED)
)
)
JLXT_192.168.201.2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.201.2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = jlxt)
(SERVER = DEDICATED)
)
)
系统升级错误-2006-11-23
A70DAF536070D3A1
W: You may want to run apt-get update to correct these problems
# gpg --keyserver wwwkeys.eu.pgp.net --recv-keys A70DAF536070D3A1 && gpg --armor --export A70DAF536070D3A1 | apt-key add -
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: requesting key 6070D3A1 from hkp server wwwkeys.eu.pgp.net
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 6070D3A1: public key "Debian Archive Automatic Signing Key (4.0/etch)
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
OK
装hp1022n打印机-2006-11-28
Printer : HP laserJet 1022n/network
$ sudo aptitude install hplip hplip-base hplip-data hplip-ppds cupsys-client cupsys foomatic-db-hpijs hpijs
$ sudo hp-setup
http://hplip.sourceforge.net/install/step1/apt.html
oracle客户端安装备忘-2006-12-06
oracle: 9.2.0.1.0
安装客户端
需要安装以下包:make compat-db compat-gcc-32 compat-gcc-32-c++ compat-oracle-rhel4 compat-libcwait compat-libgcc-296compat-libstdc++-296 compat-libstdc++-33 gcc gcc-c++ gnome-libs gnome-libs-devel libaio-devel libaio make openmotif21 xorg-x11-deprecated-libs-devel xorg-x11-deprecated-libs
更新以下包:up2date gnome-libs gnome-libs-devel
设置以下变量:export LD_ASSUME_KERNEL=2.4.19
可以在以下网站下载光盘上未提供的软件包:http://oss.oracle.com/projects/compat-oracle/files/RedHat/
如�
��出现以下错误:
DllGroup = false
Calling action unixActions2.2.0.6.0 createLink
source = /opt/ora9/jre/1.1.8/bin/.java_wrapper
destination = /opt/ora9/jre/1.1.8/bin/jre
overwriteExistingLink = true
则可能是 $LD_ASSUME_KERNEL 变量没有设置
参考文档:
http://www.puschitz.com/InstallingOracle9i.shtml
Oracle学习笔记-2007-01-17
>select log_mode from v$database;
>archive log list ;
2. 切换归档状态
>shutdown immediate;
>startup mount;
>alter database archivelog(noarchivelog)
>alter database open;
>archive log list;
3. 应用pfile修改
>create pfile from spfile
修改pfile(:\oracle\product\10.1.0\Db_1\database\INITtonydb.ORA)
>create spfile from pfile
or
>show all(parameters parametername)
>alter system set parameter=valuse;
4. 指定 pfile 启动
>shutdown immediate;
>startup pfile="";
5. 手动归档
>archive log all;
6. 数据库冷备份
备份
>select name from v$datafile;
%
09>shutdown immediate;
>$copy ... 复制目标文件
>startup;
恢复
恢复数据库的唯一方法是,从冷备份文件中恢复所有数据库文件,以使数据库处于一致状态
7. 数据库热备份
备份
>alter tablespace system begin backup;
>$copy ...
>alter tablespace system end backup;
恢复
>alter database datafile 'D:\ORACLE\PRODUCT\10.1.0\ORADATA\TONYDB\SYSTEM01.DBF' offline;
>alter database open;
>$copy ...
>recover datafile 'D:\ORACLE\PRODUCT\10.1.0\ORADATA\TONYDB\SYSTEM01.DBF'
>alter database datafile 'D:\ORACLE\PRODUCT\10.1.0\ORADATA\TONYDB\SYSTEM01.DBF' online;
>alter database open
8. 分析备份文件的可用性
F:\>dbv file=f:\SYSTEM01.DBF blocksize=8192
9. 控制文件备份
> alter database backup controlfile to trace;
==
> D:\oracle\product\10.1.0\admin\tonydb\udump\tonydb_ora_xxxx.trc
10. 表空间状态的切换
> alter tablespace
> alter tablespace
11. 数据库不完整恢复
基于取消
>startup mount;
>recover database until cancel;
基于时间
>startup mount;
>recover database until time '2000-01-01:01:01:01';//YYYY-MM-DD:HH:MI:SS
12. RMAN
cmd> rman
RMAN> connect target / //与默认目标数据库建立连接
RMAN> show all;
RMAN> configure retention policy clear; //恢复默认设置
13. RMAN backup
RMAN> report need backup;
RMAN> run {
allocate channel c1 type disk; //信道名和设备类型
backup full //备份类型
format 'd:\backup\%d_%p_%t' //文件格式
(tablespace system //备份对象
include current controlfile);} //备份对象
注: backup {full|incremental level=n|archivelog all|database} //archivelog
backup {database} //noarchivelog
14. RMAN 使用copy 备份
RMAN> run{
allocate channel c1 type disk;
copy level 0
datafile 1 to 'd:\2222\systemimg.dbf';} //4 指定文件, 可以使用 report schema 获取
15. RMAN restore
RMAN> run {
allocate channel c1 type disk;
restore database;
recover database;
}
16. RMAN 不完整恢复
基于时间
RMAN> run {
allocate channel c1 type disk;
set until time 'DD MON YYYY HH: MI: SS';
restore database;
recover database;
}
17. RMAN 维护
RMAN> crosscheck backup of database;
RMAN> crosscheck copy of database;
RMAN> list backup of database;
RMAN> list copy of database;
RMAN> change backupset i {unavailable|unavailable};
18. exp 与 imp
19. SQL*Loader
20. 服务器配置
.\oracle\product\10.1.0\Db_1\NETWORK\ADMIN\listener.ora
SID_LIST_LISTENER = //指定侦听SID, 指定监听服务器列表
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\product\10.1.0\Db_1)
(PROGRAM = extproc)
)
)
LISTENER = //LISTENER定义
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = TONYBOX)(PORT = 1521))
)
21. 客户端配置
.\oracle\product\10.1.0\Db_1\NETWORK\ADMIN\sqlnet.ora
有关xwindows的三个命令-2007-01-29
-> Red 1.000, Green 1.000, Blue 1.000
# xgamma -gamma 1.300
# xvidtune
# xrandr -q
# xrandr -s 1280 x 102 -r 75
重装系统-2007-02-02
2.6.17 以上内核均不能上网, 但是能ping通, 也不是都不能上, 比如google就可以
debian的sarge 又不能识别sata的硬盘 郁闷
解决:
# echo 0 > /proc/sys/net/ipv4/
编辑/etc/sysctl.conf 文件, 加入如下行:
net.ipv4.tcp_window_scaling=0
http://lwn.net/Articles/92727/
