博客搬家了
请访问:http://hi.baidu.com/hrhero
RSS中时间的格式化代码(2008-04-29 12:31)
public static String formatRssDate(Date date)
{
SimpleDateFormat sdf = new
SimpleDateFormat('EEE, d MMM yyyy HH:mm:ss z', Locale.US);
SimpleTimeZone zone = new
SimpleTimeZone(8, 'GMT');
sdf.setTimeZone(zone);
return
sdf.format(date);
}
需要删除掉已有的DocumentRoot DirectoryIndex
Directory,否则会报错,如果有rewrite一定要对应放在相应的VirtualHost 里面
NameVirtualHost ip
<VirtualHost ip>
DocumentRoot
/opt/qqq/html
DirectoryIndex
index.html index.htm
ServerName
www.a.com
<Directory
'/opt/caitanzi/html/'>
Options Indexes FollowSymLinks
AllowOverride None
Order
allow,deny
Allow
from all
</Directory>
<
在Linux系统中我一般采用编译源码的方式来安装Apache,有两种方法可以让Apache在系统启动时自动启动。
1.
在/etc/rc.d/rc.local中增加启动apache的命令,例如:/usr/local/httpd/bin/apachectl
start
2. 将apache注册为系统服务
首先将apachectl命令拷贝至/etc/rc.d/init.d目录下,改名为httpd
使用编辑器打开httpd文件,并在第一行#!/bin/sh下增加两行文字如下
# chkconfig: 35 70 30
# description: Apache
接着注册该服务
chkconfig --add httpd
一切OK了,启动服务
service httpd start
其中所增加的第二行中三个数字第一个表示在运行级别3和5下启动apache,第二、三是关于启动和停止的优先级配置,无关紧要。
前几天总结了使用JSVC来设置tomcat作为linux服务并
且开机自动启动,但是如果要更专业一点来控制tomcat的启动
,使用Java
Service Wrapper应该不失为一个好的选择,下面来总结一下Java Service
Wrapper在Linux中对于tomcat启动的设置:
1、安装JDK、Tomcat,此处略过。比如tomcat安装在
/
1.(double) (Math.round(sd3*10000)/10000.0);
这样为保持4位
(double) (Math.round(sd3*100)/100.0);
这样为保持2位.
2.另一种办法
import java.text.DecimalFormat;
DecimalFormat df2 = new
DecimalFormat('###.00');
DecimalFormat df2 = new
DecimalFormat('###.000');
System.out.println(df2.format(doube_var));
第一个为2位,第二个为3位.
MYSQL全备份和增量备份(2008-02-01 12:25)
直接copy shell脚本了,
BakDir=/usr/backup/mysql/
LogFile=/usr/backup/mysql/mysqlbak.log
if [ ! -d $BakDir ];
then
mkdir -p '$BakDir'
fi
DATE=`date +%Y%m%d-%H%M`
echo ' ' >> $LogFile
echo ' ' >> $LogFile
echo '-------------------------------------------' >>
$LogFile
echo $(date +'%y-%m-%d %H:%M:%S') >> $LogFile
echo '--------------------------' >> $LogFile
cd $BakDir
DumpFile=$DATE.sql
GZDumpFile=$DATE.sql.tgz
mysqldump --quick --opt mia --flush-logs --delete-master-logs
--lock-all-tables > $DumpFile
echo 'Dump Done' >> $LogFile
tar czvf $GZDumpFile $DumpFile >> $LogFile 2>&1
echo '[$GZDumpFile]Backup Success!' >> $LogFile
rm -f $DumpFile
echo 'Backup Done!'
echo 'pleas
北京大学校长许智宏演唱《隐形的翅膀》(2008-01-18 09:12)
linux下svn安装(转载)(2008-01-15 16:52)
linux 9 下 apache2.2.2+svn 1.3.1安装
apache的安装
httpd是web服务器,用来通过web访问subversion,我下载到httpd-2.2.2.tar.bz2。
解压该文件:
#tar xvf httpd-2.2.2.tar
//进入解压后的目录
# cd httpd-2.2.2
//配置apache安装,前两个参数是必须要加的,你还可以根据您的需要添加其他的参数。
//后面的参数制定你要把apache安装哪里
# ./configure --enable-module=so --enable-rewrite=shared
--enable-proxy --with-mpm=worker --with-threads=yes --enable-dav
--prefix=/usr/local/apache2/
# make
//安装
# make install
# cd /usr/local/apache2/bin
//启动apache服务
# ./apachectl start
ServerName 127.0.0.1 改成这样
//打开浏览器http://localhost/如果有测试页'It works!'出现则证明已经安装成功。
//打开浏览器http://localhost/如果有测试页'It works!'出现则证明已经安装成功。
//如果配置文件/apache2/conf/httpd.conf中,下面
java中加减时间(2008-01-07 12:49)
GregorianCalendar gc = new
GregorianCalendar();
SimpleDateFormat sf = new
SimpleDateFormat('yyyy年MM月dd日');
public String getLocalDate(Date d) {
return sf.format(d);
}
public String getStartDate(Date d,int
zhouci) {
gc.setTime(d);
gc.add(3, zhouci);
gc.set(gc.get(Calendar.YEAR), gc.get(Calendar.MONTH),
gc.get(Calendar.DATE));
return sf.format(gc.getTime());
}
public String getEndDate(Date d,int
zhouci) {
gc.setTime(d);
gc.add(5, 4);
gc.set(gc.get(Calendar.YEAR), gc.get(Calendar.MONTH),
gc.get(Calendar.DATE));
d= gc.getTime();
gc.setTime(d);
gc.add(3, zhouci);
gc.set(gc.get(Calendar.YEAR),
gc.get(Calendar.MO