爱生活·爱Java

The edge of beauty~

逝者如斯
网志分类
· 所有网志 (7)
· Java (1)
· Oracle (0)
· 银行业务 (0)
· 收藏 (3)
· 时尚生活 (1)
· 未分类 (2)
最新评论
搜索本站
友情链接
· 我的歪酷

订阅 RSS

0003934

歪酷博客


Gypsyfish @ 2007-05-25 15:49

看各路明星如何打扮自己:
photos.i.cn.yahoo.com/album-UWeyWrAieqvX_eE60zmaI4DtPiM-



 
Gypsyfish @ 2006-07-24 13:41

  1. Sql Date与Date
    java.sql.Date 是针对SQL语句使用的,它只包含日期而没有时间部分;java.util.Date 是 java.sql.Date 的父类(注意拼写)前者是常用的表示时间的类,我们通常格式化或者得到当前时间都是用他.后者之后在读写数据库的时候用他,因为PreparedStament的setDate()的第2参数和ResultSet的getDate()方法的第2个参数都是java.sql.Date
    java.sql.Date date=new java.sql.Date();
    java.util.Date d=new java.util.Date (date.getTime());
    另:
    java.sql.Time sTime=new java.sql.Time(d.getTime());     
    java.sql.Timestamp stp=new java.sql.Timestamp(d.getTime());
  2. Java访问Oracle,设置动态SQL参数值Number类型的小数可用setString(), setBigDecimal()来设置. 用setFloat()会发生舍入误差.例如:9999999999.99 会变成10000000000.
  3. Java连接Oracle
      Connection conn = new OracleDriver().defaultConnection();
      String sql = "INSERT INTO user (id,name) " + "VALUES (?,?)";
      try {
          PreparedStatement pstmt = conn.prepareStatement(sql);
          pstmt.setString(1, id);
          pstmt.setString(2, name);
          pstmt.executeUpdate();
          pstmt.close();
        } catch (SQLException e) { }
  4. How to get current date string like '11-MAY-2006'
          Locale aLocale = new Locale("en");
          Calendar cal = new GregorianCalendar();
          Date date = cal.getTime();
          SimpleDateFormat sf = new SimpleDateFormat("dd-MMM-yyyy", aLocale);
          System.out.println("==============curdate="+sf.format(date));
  5. How to get the next day of a specified date?
    import java.util.GregorianCalendar;
    GregorianCalendar cal = new GregorianCalendar (2005, 8, 1, 0, 0,1);
    cal.add(GregorianCalendar.DAY_OF_MONTH, 1);
    Date nextday = cal.getTime();    
    -Please note that, the value used to set the MONTH time field in the calendar is 0-based. e.g., 0 for January.
  6. How to copy files
    import java.io.*;
    public class Copy {
      
    public static void main(String[] args) throws IOException {
        File inputFile 
    = new File("farrago.txt");
        File outputFile 
    = new File("outagain.txt");
        FileReader in 
    = new FileReader(inputFile);
        FileWriter out 
    = new FileWriter(outputFile);
        
    int c;
        
    while ((c = in.read()) != -1)
          out.write(c);
        in.close();
        out.close();
      }

    }


  7. How to use Properties
    Properties prop = new Properties();
    prop.setProperty(
    "abc""");
    Please note that, NullPointerException will be thrown: prop.setProperty(
    "abc"null); 
  8.  How to remove all '-' in the string
    System.out.println("str="+str.replaceAll("-"""));
  9.     How to trim a string
    String abc = " 300.00";
    System.out.println(
    "trim="+abc.trim());    
  10.  How to use StringTokenizer?
    String str = "'001','182-0-935722','',' 0.00',' 0.00','','20 Jul 2006','2','6','1820935722',''";
    StringTokenizer st 
    = new StringTokenizer(str.substring(str.indexOf("(")+1, str.indexOf(")")), ",");
    String[] strArray 
    = new String[11];
    System.out.println(st.countTokens());
    while (st.hasMoreElements()){
         String next 
    = st.nextToken();
         System.out.println(
    "next="+next);
          
    //remove ' '
         System.out.println("next="+next.substring(1, next.lastIndexOf("'")));      
    }



 
Gypsyfish @ 2006-07-21 18:01

摘自:http://www.5dblog.com/vip/flashhawk/200407/9403.html
作者:?

下面是五个在XML文档中预定义好的实体:

&lt; < 小于号
&gt; > 大于号
&amp; & 和
&apos; ' 单引号
&quot; " 双引号

实体必须以符号"&"开头,以符号";"结尾。
注意: 只有"<" 字符和"&"字符对于XML来说是严格禁止使用的。剩下的都是合法的,为了减少出错,使用实体是一个好习惯。



 
Gypsyfish @ 2006-07-21 17:28

一些特殊字的ascii码

%7 = ~
%09 表示 Tab
%20 表示 (1sp) 即一个space键
%22 表示 "
%23 表示 #
%25 表示 %
%26 表示 &
%28 表示 (
%29 表示 )
%2B 表示 +
%2C 表示 ,
%2F 表示 /
%3A 表示 :
%3B 表示 ;
%3C 表示 <
%3D 表示 =
%3E 表示 >
%3F 表示 ?
%40 表示 @
%5B 表示[
%5C 表示
%5D 表示]
%7C 表示 |
%7E 表示 ~



 
Gypsyfish @ 2006-07-12 14:55

外汇术语
http://www.ac-markets.com/cn/ressources.fx_glossary.asp#o

金融衍生品发展路径的国际借鉴
http://www.cfachina.org/media/content.php?id=17813

常用避险及投资工具
http://www.taishinbank.com.tw/b2b/product/product_10.jsp