星期一, 十一月 29, 2004

Java Session setAttribute 不能传递HTML tag的问题.

解决方法.1
1.服务器Servlet里,使用:
request.getSession().setAttribute("statusMsg",
java.net.
URLEncoder.encode(
debugMsg.toString(), "UTF-8"));

2.在JSP 里使用:
<%=java.net.URLDecoder.decode((String)request.getSession().getAttribute("statusMsg"),"UTF-8")%>

JAVA中如何计算时间差.

基本算法:

得到两个时间之间的所差时钟数目(MillionSecond ,nanoseconds),然后根据需要输出的结果
计算并格式化数据.


Example:


import java.util.*;
import java.text.*;

public class Timecalc2 {

public static long MS_SECOND = 1000L;
public static long MS_MINUTE = 60L * MS_SECOND;
public static long MS_HOUR = 60L * MS_MINUTE;
public static long DAY = 24L;

public static long parseDT(String s1, String s2) throws ParseException
{
DateFormat formatter = new SimpleDateFormat("MM.dd.yy HHmm");
Date d1 = formatter.parse(s1);
Date d2 = formatter.parse(s2);
long dateDiff = d2.getTime() - d1.getTime();
return dateDiff;
}

public static String formatMilli(long value)
{
//DecimalFormat is used to display at least two digits
DecimalFormat nf = new DecimalFormat( "00" );

//calculate hours, minutes
long remainder = 0;
long hours = (value / MS_HOUR);
remainder = value % MS_HOUR;
long minutes = remainder / MS_MINUTE;

//build "hh:mm:ss"
StringBuffer buffer = new StringBuffer();
buffer.append(nf.format(hours));
buffer.append( ":" );
buffer.append(nf.format(minutes));

return buffer.toString();
}

public static void main(String[] args)
{
String start = "01.14.03 1730";
String end = "01.17.03 1927";
try
{
long dateDiff = parseDT(start, end);
String answer = formatMilli(dateDiff);
System.out.println(answer);
} catch (ParseException pe)
{
System.out.println("You must use the format: MM.dd.yy HHmm");
}
}
}

星期四, 十一月 25, 2004

如何修改Intel 主板开机画面

Modify Intel Bios MainBoard boot splash .
1.下载定制工具包:Intel? Integrator Toolkit

URL:
http://www.intel.com/design/motherbd/itk.htm

2.下载对应主板的可生机BIOS.
http://developer.intel.com/design/motherbd/rl/rl_bios.htm
在DOS下执行的.exe文件里有后缀为.TLK的文件.可以用winrar打开.
我的Intel 865PERL主板对应的BIOS为:ftp://download.intel.com/design/motherbd/rl/RL86510A.86A.0085.P19.IB.EXE

3.按照操作.


星期三, 十一月 24, 2004

MySQL 常用命令(1)

MySQL 4.1.7 Tune Performance Common Command
1. SHOW INNODB STATUS and the InnoDB Monitors
mysql> SHOW INNODB STATUS\G (Caution:must be end with \G);

2. insert into table(column_name) select clause...
INSERT INTO Table1 (latin1_column) SELECT USER();
3.显示当前MYSQL Version
select version()

星期一, 十一月 22, 2004

书写跨平台代码的一些小技巧

1.目录分隔符号.
使用File.separator
2.Text文件Line-carriage
Reader in=new Reader(..)
in.readLine().repace(System.getProperty("line.separator"),"&");
System.getProperty("line.separator")在window下为\n\r
Unix/Linux下为:\n

星期六, 十一月 20, 2004

MySQL 4.1 Production Level release!

真没想到.MySQL 4.1 从Development-->Production,时间如此之短.
看来MySQL 加强了开发力量了.真是值的祝贺的事情.
现在可以支持DBCS了通过UTF8和UCS2两种方式.

啊.想当初为了用ISO8859-1来保存DBCS的痛苦了.真是可惜啊.大量的来做ISO-8859-1->UTF8
和UTF8->ISO-8859-1的代码没用了

:(.

星期四, 十一月 11, 2004

JavaRanch Big Moose Saloon: How can MDB listen a remote queue ?

JavaRanch Big Moose Saloon: How can MDB listen a remote queue ?

Re: [JBoss-user] How to get messages from a remote JMS server

Re: [JBoss-user] How to get messages from a remote JMS server: "> Hello all, > I am trying to set up deployment descriptors for some MDB in jboss. I need to > subscribe to topics from a remote JMS server. I have added the remote JMS MBean > into jboss.jcml as was described in the documentation : > > name=':service=JMSProviderLoader,name=RemoteJMSProvider'> > RemoteJMSProvider > org.jboss.jms.jndi.JBossMQProvider > remote.com:1099 > > > and I got the server to start. The only thing I have left to do is to actually > write the deployment descriptor to look up the topics in the remote server. > I know that the syntax for doing so for topics in jboss.xml is : > > > topic/MyTopicj > > is this the same syntax for all such servers?"
另外一篇文章,详细描述了如何用Jboss MDB 访问webSphere的消息bean
http://sourceforge.net/tracker/index.php?func=detail&aid=753022&group_id=22866&atid=376687

Business Process Management (BPM) Tutorial - What is BPM?

Business Process Management (BPM) Tutorial - What is BPM?: "What is Business Process Management (BPM)?"

星期一, 十一月 08, 2004

如何在Javascript中得到多纬数族字符串下标

在Javascript中所有Object都是Hashtable对象的包装.
常用的数组用法:
一纬数组用法:
遍历数组:
MyObject=new Array();
MyObject=["a","b","c"];
for(var i=0;i<g;MyObject.length;i++)document.write(Myobject[i]);

多纬数组用法:
遍历数组:
MyObject = new Array();
MyObject[0]=["a","b","c"];
MyObject[10]=["a1","b1","c1"];

for(var i=0;i<g;MyObject[0].length;i++)document.write(Myobject[0][i]);

得到以定义的所有多纬数组的下标:
MyObject = new Array();
MyObject["name"]=["a","b","c"];
MyObject["high"]=["a1","b1","c1"];

用for..in 得到name,和high下标
for (var i in MyObject) {
document.write(i);
结果为:name,high

星期五, 十一月 05, 2004

Amazon Search Bar for FireFOx Enabled.

AmaZon的搜索条为FireFox的定做已经发布了,很好看.
不过在中国暂时无法使用.

遗憾.

下载地址:
http://toolbar.a9.com/