http://blog.sina.com.cn/huangjunhua[订阅]
个人资料
友情链接
Java Tutorial

Java Tutorial

人力资源管理

21世纪最重要的是人才

新浪相册

用图片记录生活

方兴东观察

中国博客之父

图片博客

图片博客 图我喜欢

牛根生

牛根生的BLOG

老周的博客

怀念霍去病

小侄女的博客

小侄女的博客

JDK1.6 DOC

JDK1.6 DOC

花儿

花儿

cleverpig

cleverpig

In Java

useful material

Jira

bug tracking

我的大学

北京物资学院

博文
博客搬家(2008-04-29 16:13)
博客搬家了
请访问:http://hi.baidu.com/hrhero
   
    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位.

 
雪中美景(2008-02-06 13:31)
西湖美景
 
直接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
 
北京大学校长许智宏演唱《隐形的翅膀》
 

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

公告
一丝不苟 认认真真 兢兢业业
黄俊华
 
大学之道在明明德,在亲民,在止於至善。知止而后有定;定而后能静;静而后能安;安而后能虑;虑而后能得。物有本末;事有终始。知所先後则近道矣。古之欲明明德於天下必先治其国。欲治其国者先齐其家。欲齐其家者先修其身。欲修其身者先正其心。欲正奇心者先诚其意。欲诚其意者先致其知。致知在格物。
 
联系方式:
MSN:huangjunhuahr@hotmail.com
QQ:380382755
 
 
分类
    内容读取中…
评论
读取中...
访客
读取中...