Javaphua Blog

BlogJava 首页 新随笔 联系 聚合 管理
  46 Posts :: 5 Stories :: 46 Comments :: 0 Trackbacks

#

利用脚本操作Excel文件,一些基础的东西,主要涉及到生成Excel文件,和写入单元格内容,设置字体、宽高等,以及如何合并单元格,更高级的可以通过录制宏来查看。
     
  1. <SCRIPT LANGUAGE='JavaScript'>
     
  2. <!--
     
  3. var xlCenter=-4108;
     
  4. var xlbottom=-4107;
     
  5. var xlRight=-4152;
     

  6.  
  7. var oSheet;
     
  8. var oActiveSheet;
     
  9. var oApplication;
  10. //初始化Excel对象
  11. try 
  12.       oApplication    = new ActiveXObject 'Excel.Application' );
  13.       }
  14. catch(e) { 
  15. alert('您必须安装Excel电子表格软件,同时浏览器须使用“ActiveX 控件”!');
  16.     return '';
  17.   }       
  18. oApplication.visible true;       
  19. var xlBook oApplication.Workbooks.Add;
  20. oActiveSheet xlBook.Worksheets(1); 
  21. //设置行高
  22. oActiveSheet.Rows('1:1').RowHeight 30;
  23. //设置列宽
  24. oActiveSheet.Columns('A:A').ColumnWidth 8;
  25. //设置单元格的内容
  26. oActiveSheet.Cells(4,1).FormulaR1C1='日  期'//第4行第1列
  27. //单元格选择
  28. oActiveSheet.Range('A2:G2').Select();
  29. //另外一种高级的选择方法
  30. oActiveSheet.Range(oActiveSheet.cells(5,3),oActiveSheet.Cells(6,4)).Select;
  31. //设置文字格式
  32. oApplication.Selection.Font.Size=15;
  33. oApplication.Selection.Font.boldtrue
  34. oApplication.Selection.Font.Name='宋体';
  35. //合并选取的单元格
  36. oApplication.Selection.Merge();
  37. //设置选取单元格的垂直对齐和水平对齐
  38.  oApplication.Selection.HorizontalAlignment xlCenter;
  39.  oApplication.Selection.VerticalAlignment xlCenter;
  40. //注意,对selection的操作都适用于cells

  41. //设置自动换行
  42. oApplication.Selection.WrapText=true;
  43. //-->
  44. </SCRIPT>
posted @ 2006-06-12 12:39 Javaphua 阅读(207) | 评论 (0)编辑 收藏

在使用String.split方法分隔字符串时,分隔符如果用到一些特殊字符,可能会得不到我们预期的结果。

我们看jdk doc中说明

public String[] split(String regex)

Splits this string around matches of the given regular expression.

参数regex是一个 regular-expression的匹配模式而不是一个简单的String,他对一些特殊的字符可能会出现你预想不到的结果,比如测试下面的代码:

用竖线 | 分隔字符串,你将得不到预期的结果

  String[] aa = "aaa|bbb|ccc".split("|");
  //String[] aa = "aaa|bbb|ccc".split("\\|"); 这样才能得到正确的结果

  for (int i = 0 ; i <aa.length ; i++ ) {
    System.out.println("--"+aa);
  }

用竖 * 分隔字符串运行将抛出java.util.regex.PatternSyntaxException异常,用加号 + 也是如此。

  String[] aa = "aaa*bbb*ccc".split("*");
  //String[] aa = "aaa|bbb|ccc".split("\\*"); 这样才能得到正确的结果  

  for (int i = 0 ; i <aa.length ; i++ ) {
    System.out.println("--"+aa);
  }

显然,+ * 不是有效的模式匹配规则表达式,用"\\*" "\\+"转义后即可得到正确的结果。

"|" 分隔串时虽然能够执行,但是却不是预期的目的,"\\|"转义后即可得到正确的结果。

还有如果想在串中使用"\"字符,则也需要转义.首先要表达"aaaa\bbbb"这个串就应该用"aaaa\\bbbb",如果要分隔就应该这样才能得到正确结果:

String[] aa = "aaa\\bbb\\bccc".split("\\\\");

posted @ 2006-05-30 13:37 Javaphua 阅读(171) | 评论 (0)编辑 收藏

语法
						ArrayObj
						.splice(
						start, deleteCount, [item1[, item2[, ... [,itemN]]]])
ArrayObj 必填参数 Array 对象
start 必填参数 指定从数组中移除元素的开始位置,这个位置是从 0 开始计算
deleteCount 必填参数 要移除的元素的个数,为 0 时不删除任何元素
item1... 可选参数 在所移除元素的位置上插入的新元素
说明
  splice 方法可以移除从 start 位置开始的指定个数的元素并插入新元素,从而修改 ArrayObj。返回值是一个由所移除的元素组成的新 Array 对象

  注:当只删除一个元素时,在 Navigator 4 里会出现一个 BUG:这个方法不是返回一个包含删除了元素后的数组,而只是返回一个元素.另外,如果数组中没有元素被删除,则返回 null 而不是空数组
posted @ 2006-05-30 13:25 Javaphua 阅读(445) | 评论 (0)编辑 收藏

   
//格式化日期为指定的格式
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");

format.format(rs.getTimestamp("birth"))

//将字串符转换成日期类型
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 java.util.Date date = format.parse("1981-10-25 10:20:25");

//在数据库中将字符串转成日期存入数据库
birth=to_date(?,'YYYY-MM-DD HH24:MI:SS')

//发送SQL语句,执行存储过程
java.sql.CallableStatement cs = con.prepareCall("{call addAge}")

//更新时使用数据库的系统时间(sysdate)
"update student set birth=sysdate"

//IO的几种常用通信方法---------------采用对象方式进行传输数据-------------------------
java.io.BufferedReader in = new java.io.BufferedReader(
  new java.io.InputStreamReader(socket.getInputStream()//System.in));


java.io.PrintWriter out = new java.io.PrintWriter(
 new java.io.OutputStreamWriter(new java.io.BufferedOutputStream(
 socket.getOutputStream())));

java.io.ObjectOutputStream out  = new java.io.ObjectOutputStream(
  new java.io.BufferedOutputStream(new java.io.FileOutputStream("t.dat")));
out.writeObject(s);
  out.flush();
  out.close();
java.io.ObjectInputStream in = new java.io.ObjectInputStream(
  new java.io.BufferedInputStream(new java.io.FileInputStream("t.dat")));
 Student ss = (Student)in.readObject();

--------------------------------------------------------------
//给按钮添加事件 按钮触发数字自动滚动

this.button.addActionListener(
  new java.awt.event.ActionListener(){
     
  public void actionPerformed(java.awt.event.ActionEvent e){
   new Thread(){
        
    public void run(){
       while(true){
       String s=txt.getText();
       char c=s.charAt(s.length()-1);
       String cs=s.substring(0,s.length()-1);
       txt.setText(c+cs);
       try{
       Thread.sleep(1000);
       }catch(Exception y){}
      } 
    }
   }.start();
  }
 }
);

----------------------------------------

另一种添加事件的方法
button1.addActionListener( new CalculationListener());

//在剪切时候,它在一个内部类
class CalculationListener implements java.awt.event.ActionListener{
 public void actionPerformed(java.awt.event.ActionEvent e){
  javax.swing.JButton button  = (javax.swing.JButton)e.getSource();
   calc.calculate(button.getText());
  }
}

-----------------------------------------
启动线程的几种方法..
----------------------------

  R1 r = new R1();
  R1 w = new R1();
  Thread t = new Thread(r);
  Thread q = new Thread(w);
  t.start();
  q.start();

  new Thread(new W(socket)).start();

class R1 implements Runnable{
 public void run(){
  
 }
}
-----------------------------------
Thread1 t1 =new Thread1();
t1.start();

class Thread1 extends Thread{
 public void run(){
  
 }
}

命名线程://Thread t2 = new Thread(new Thread3(10),"线程名")
得到线程序号:System.out.println (t2.getPriority());


 applet框架
-----------------------------
public class TestApplet extends javax.swing.JApplet{
 public  void init(){
  super.init();
 }

}

//设置窗口关闭时自动退出
this.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);

------------------------------------------在lesson中有一个鼠标事件还没有看通,有点复杂(day16)

//给按钮添加事件的一种方法
   //按钮调用
 button.addActionListener(new count2());
 //事件类继承监听器
 class count2 implements java.awt.event.ActionListener{
   public void actionPerformed(java.awt.event.ActionEvent e){
    counter(); 
   }
  
 }
 //方法与其分开
 public void counter(){
  String s = jt1.getText();
  String m = jt2.getText();
  int n = Integer.parseInt(m);
  int u = Integer.parseInt(s);
  int w = n+u;
 
  jt3.setText(""+w);
 }


//为了代码与窗体进行分开合作工作,因此将方法嵌入窗体中(“你中用我 我中有你”)
如:LotteryFunction lf = new LotteryFunction(this);

LotteryFunction 为功能类

将this作为工功能类构造的参数可很方便的在窗体显示计算结果

------------------------------------------------------------------------------

如面板上有多个控件时,可用以下方法将其加入面板中
class MyPanel extends javax.swing.JPanel{
   javax.swing.JTextField[] texts = new javax.swing.JTextField[7];
   
   MyPanel(){
    this.setLayout(new java.awt.GridLayout(1,7,3,3));
    
    for(int i=0;i<texts.length;i++){
     texts[i] = new javax.swing.JTextField();
     texts[i].setBackground(java.awt.Color.green);
     this.add(texts[i]);
    }
   }
}

------------------------------------------------------------
排序的代码:

static int t;
int[] r ={8,9,7,6,5,4,3};
for(int i=0;i<r.length;i++){
 for(int j=1;j<r.length-i;j++){
  if(r[j]<r[j-1]){
    t=r[j];
    r[j]=r[j-1];
    r[j-1]=t; 
  }
 }
}

--------------------------

如何给文件进行锁定


public static void lock()throws Exception{
    java.io.FileOutputStream out = new java.io.FileOutputStream("c:\\TestIO.txt",true);
    java.nio.channels.FileChannel f = out.getChannel();
    
    java.nio.channels.FileLock lock = f.tryLock();
    
    if (lock!=null){
     System.out.println ("正在锁定");
     Thread.sleep(100000);
     System.out.println ("解除完毕");
     lock.release(); 
    }
 }

------------------------------
java.nio 如何进行文件传输的

java.io.FileInputStream in  = new java.io.FileInputStream("TestNIO.java");
   java.nio.channels.FileChannel ch = in.getChannel();
   java.nio.ByteBuffer buff  = java.nio.ByteBuffer.allocate(1024);
   while((ch.read(buff))!=-1){
    buff.flip();
    java.nio.charset.Charset ca = java.nio.charset.Charset.forName("gb2312");
     //对缓存进行编码设置后,再进行解析
    java.nio.CharBuffer cb = ca.decode(buff);
    System.out.println (cb);
    buff.clear();
  }

---------------文件传输
public static void copyfile()throws Exception{
    java.io.FileInputStream in  = new java.io.FileInputStream("TestNIO.java");
    java.nio.channels.FileChannel ch = in.getChannel();
    
    java.io.FileOutputStream out = new java.io.FileOutputStream("c:\\TestIO.java");
    java.nio.channels.FileChannel outch = out.getChannel();
    
    java.nio.ByteBuffer buff = java.nio.ByteBuffer.allocate(32);
    
    while((ch.read(buff))!=-1){
     buff.flip();
     outch.write(buff);
     buff.clear();
     
    }
    in.close();
    out.close();
    
  }
-------------------------------???关于java.nio.buff中的一些缓冲区的管理代码还没有看懂??


几种IO通信方法
1---------
java.io.BufferedInputStream in =new java.io.BufferedInputStream(
         new java.io.FileInputStream("TestIO.java"));
   
java.io.BufferedOutputStream out =new java.io.BufferedOutputStream(
         new java.io.FileOutputStream("c:\\t.txt"));

byte[] b =new byte[32];
  
  int len= 0 ;
  while((len=in.read(b))!=-1){
   out.write(b,0,len);
     
  }
  out.flush();
  in.close();
  out.close();

2-----------

java.io.FileReader f =new java.io.FileReader("c:\\t.txt");
  char[] c = new char[32];
  int len=0;
  while((len=f.read(c))!=-1){
   System.out.println (new String(c,0,len));
  }
  
 f.close();

3------------------
java.io.BufferedReader r= new java.io.BufferedReader(new java.io.FileReader("TestIO.java"));
 
java.io.PrintWriter w= new java.io.PrintWriter(new java.io.BufferedWriter(new java.io.FileWriter("c:\\t.txt")));
 
 
 String line=null;
 
 while((line =r.readLine())!=null){
  w.println(line);
  
 }
  w.flush();
  r.close();
  w.close();

4-----------------------
java.io.PrintWriter p = new java.io.PrintWriter(new java.io.BufferedWriter(
         //是否在文件后进行追加数据(true)
     new java.io.FileWriter("c:\\t.txt",true)));
  p.print("12");
  p.flush();

5------------------------
java.io.FileOutputStream out  = new java.io.FileOutputStream("c:\\t.txt");
   
   java.io.OutputStreamWriter write = new java.io.OutputStreamWriter(out,"UTF-8");
   
   write.write("2222222222");
   
   write.close();
5---------------------------从控制台读取数据
java.io.BufferedReader r  = new java.io.BufferedReader(
      new java.io.InputStreamReader(System.in));
      
  String s=r.readLine();
  System.out.println (s);

6-------------------------------向文件写入数字
int i = 0;
  java.io.DataOutputStream out  =new java.io.DataOutputStream(
      new java.io.BufferedOutputStream(new java.io.FileOutputStream("c:\\t.txt"))); 
  
  out.writeInt(1);
  out.writeChar('a');
  out.writeInt(2);
  out.writeChar('b');
  //out.writeInt(4);
  out.flush();
  out.close();
  
  java.io.DataInputStream in =new java.io.DataInputStream(
      new java.io.BufferedInputStream(new java.io.FileInputStream("c:\\t.txt")));
  while(i!=-1){
   System.out.println (i=in.readInt());
   //System.out.println (in.readDouble());
   System.out.println (in.readChar()); 
  } 

7---------------------------------未看懂的代码????????????
java.io.RandomAccessFile r = new java.io.RandomAccessFile("c:\\t.txt","r");
   
   System.out.println (r.readInt());
   r.seek(0);
   System.out.println (r.readInt());
   r.seek(r.length()-8);
   System.out.println (r.readDouble());
   r.seek(r.length()-11);
   System.out.println (r.readUTF());  

//压缩解压文件的代码--还未看

 public static void ZipFile()throws Exception{
   java.io.BufferedInputStream b = new java.io.BufferedInputStream(
    new java.io.FileInputStream("c:\\t.txt"));
    
   java.util.zip.ZipOutputStream z = new java.util.zip.ZipOutputStream(
    new java.io.BufferedOutputStream(new java.io.BufferedOutputStream(
     new java.io.FileOutputStream("c:\\t.zip"))));
     
   z.putNextEntry(new java.util.zip.ZipEntry("test.txt"));
   
   byte[] t = new byte[32];
   int len = 0;
   while((len=b.read(t))!=-1){
    z.write(t,0,len);//z.write(t);
   }
   
   z.flush();
   b.close();
   z.close();
 } 

----------
public static void unzip()throws Exception{
   java.util.zip.ZipFile  zip = new java.util.zip.ZipFile("c:\\t.zip");
   
   java.util.Enumeration enu = zip.entries();
   
   while(enu.hasMoreElements()){
     java.util.zip.ZipEntry entry = (java.util.zip.ZipEntry)enu.nextElement();
     java.io.InputStream in = zip.getInputStream(entry);
     
     java.io.BufferedOutputStream out = new java.io.BufferedOutputStream(
       new java.io.FileOutputStream("c:\\test.txt"/*+entry.getName()*/));
       
     byte[] b = new byte[32];
     int len =0;
     while((len=in.read(b))!=-1){
       out.write(b,0,len);
     }
   }
  }

------------------从控制台向文件输入数据

java.io.BufferedReader  in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
    java.io.PrintStream out =new java.io.PrintStream(new java.io.BufferedOutputStream(new java.io.FileOutputStream("test.log")));
   // System.setErr(out);//可以使输入转向
   // System.setOut(out);//可以使输入转向
    while(true){
     out.println(in.readLine());
     out.flush();

---------------------添加多的一个“\”表示转义符
java.io.File f2 = new java.io.File("c:\\test\\a\\b\\c");

实现文件类型的过滤方法-------1

String[] list = f2.list();
 System.out.println (java.util.Arrays.asList(list));
 list = f2.list(
  new java.io.FilenameFilter(){
   public boolean accept(java.io.File dir,String name){
    return name.endsWith(".java");
   } 
  }
 );

----------------------------2( 多个过滤方式)
String[] list = f2.list();
  list =f2.list(
  new java.io.FilenameFilter(){
   public boolean accept(java.io.File dir,String names){
      
    boolean java= names.endsWith(".java");
    boolean txt = names.endsWith(".txt");
    return java || txt;
   }
  } 
 );

//String[] list = f2.list();
java.util.Arrays.asList(list)将数组转成ArrayList

--------------------------------------------------删除有文件的目录实用代码

public static void delDir(java.io.File dir){
 if(dir.isFile()){
  dir.delete();
 }else{
  java.io.File[] fis = dir.listFiles();
   for(int i=0;i<fis.length;i++){
    delDir(fis[i]);
   }
  dir.delete();
 }
}
------------------------------------------------------计算文件夹大小代码

 System.out.println ("文件大小 "+s/1024+"  kB"+" = "+(float)s/1024/1024+"M");


 public  static double len(java.io.File dir){
  double s=0,len=0;
   if(dir.isFile()){
    s=dir.length();
   }else{
    java.io.File[] file = dir.listFiles();
    for(int i=0;i<file.length;i++){
     len+=len(file[i]);
    }
   }
   return len+s;
 }

--------------------------------------------------------几种集合类的使用

java.util.ArraryList list=new java.util.ArraryList();
     list.add("abc");
  list.size();
  list.iterator();

java.util.HashSet set = new java.util.HashSet();
  for(int i=0;i<10;i++){
   set.add("abc"+i);
  }
  
java.util.Iterator it = set.iterator();
  while(it.hasNext()){
   System.out.println (it.next());
  }
 
java.util.HashMap map = new java.util.HashMap();
  map.put(new Integer(1),"002");
  map.put(new Integer(4),"001");
  System.out.println (map.get(new Integer(1)));
  System.out.println (map.get(new Integer(4)));
  
java.util.Set keys = map.keySet();//返回一个SET集合
  it=keys.iterator();
 while(it.hasNext()){
  Object o = it.next();
   System.out.println (o+":"+map.get(o));
 }
-------------系统属性的操作

java.util.Properties p = new java.util.Properties();
  FileInputStream f = new FileInputStream("c:\\a.properties");
  
  p.load(f);
  System.out.println (p.get("test.author"));
  System.out.println (p.get("test.version"));
  
  p.setProperty("test.author","llldiadsfsa");
  p.setProperty("test.address","meimei");
  p.setProperty("test.version","10.0");
  
  java.io.FileOutputStream out = new FileOutputStream("c:\\a.properties");
  p.save(out,"ruanwei");
  
  //p.store(out,"test");
  out.close();
---------------------------------------------------------------未懂代码:以后再看????////
 String str1 = args[0];
  String str2 = args[1];                 
  
  if("int".equals(System.getProperty("precition"))){
   int i1 = Integer.parseInt(str1);
   int i2 = Integer.parseInt(str2);
   System.out.println ("i1"+"/"+"i2"+"="+divide(i1,i2));
  }else if("double".equals(System.getProperty("precition"))){
   double d1 = Double.parseDouble(str1);
   double d2 = Double.parseDouble(str2);
   System.out.println ("d1"+"/"+"d2"+"="+divide(d1,d2));
  }else if("你好".equals(System.getProperty("precition"))){
   System.out.println ("你好");
  }
 
 
 }
  public static int divide(int i1,int i2){
   return i1/i2;
  }
  public static double divide(double d1,double d2){
   return d1/d2;
  }
---------------------------------------------------------------------------------猜数字游戏代码
class GuessGame{
 
 public static  void main(String[] args){
  outer:
  while(true){
    
    int num =1 + (int)(Math.random()*100);
    int num1=20 ;
    System.out.println ("输入数字"+num);
     
       inner:
       while(num!=num1){
        
        java.io.BufferedReader in = new java.io.BufferedReader(
          new java.io.InputStreamReader(System.in));

        try{
       num1 = Integer.parseInt(in.readLine());
           if(num1>100 || num1<1){
            throw new java.lang.NumberFormatException();
          } 
          
       }catch(java.io.IOException e){
          System.out.println ("io error"+e);
        }catch(java.lang.NumberFormatException e2){
         System.out.println ("请输入正确的数字[1-100]");
         continue ;
        }
         if(num>num1){
          System.out.println ("is too small");
         }else if(num<num1){
         System.out.println ("is too large");
        }else{
         System.out.println ("ok");
         
         System.out.print ("还玩么? (y/n)");
         
          try{
           if("y".equalsIgnoreCase(in.readLine())){
            continue outer;
           }
          }catch(java.io.IOException e){}
            break outer;
        }
     }

    }
  } 
  
  
}
---------------------------------------------------------------------从随机数据取出与输入相等的数据

static char[] getText(String s){
    int w = s.length();
    char[] cc =new char[w];
    
    int  index=0;
    while(true){
     char  c = (char)(Math.random()*65536);
     if(c==s.charAt(index)){
      cc[index]=c;
      index++;
      if (index>=w){
       break;
        
      } 
     }
    }
   return cc;
  }
-----------------------------------------------------------------------多维数组的赋值------

  int[][] in= new int[5][];
  in[0]  = new int[]{0,1,2,3};
  in[1] = new  int[]{1,2};
--------------------------------------------------------覆盖垃圾收集方法
public void finalize(){
 System.out.println ("000");
}
-----------------------------------------------------移位)

3>>1 正数移位 0011---》 0001  为1(正数移位在前面加0)
-3>>1 负数移位 1011 -》1100--》1101 移位得 1110 --》1101--》1010 为-2(负数移位在前面加1)
-3>>>1  (这种移位以后再看???????????????未懂)
-

-----------描述注释文档----------------javadoc -d 文件绝对路径 -author -version private/public/protected

/**
 *
 *描述学生信息
 *@author 阮卫
 *@version 1.1
 *@docroot e:\lesson\day02\indexz
 */

/**
*无参数据构造函数
*/

/**
* 有参数据构造函数
*@param n  表示姓名
*/

/**
*方法说明
*/
-----------------------------------------------
Integer.MIN_VALUE
Short.MAX_VALUE
-----------------------------------
//在一常量池中引用的是同一地址
    q="sss";
    w="sss";

posted @ 2006-05-26 14:05 Javaphua 阅读(350) | 评论 (0)编辑 收藏

□html页面技巧大全
□fuhj02 发表于 2005-11-6 20:31:00

 
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table

2. <body onselectstart="return false"> 取消选取、防止复制

3. onpaste="return false" 不准粘贴

4. oncopy="return false;" oncut="return false;" 防止复制

5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标

6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标

7. <input style="ime-mode:disabled"> 关闭输入法

8. 永远都会带着框架
<script language="JavaScript"><!--
if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页
// --></script>

9. 防止被人frame
<SCRIPT LANGUAGE=J***ASCRIPT><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>

10. <noscript><iframe src="/*.html>";</iframe></noscript> 网页将不能被另存为

11. <input type=button value=查看网页源代码
onclick="window.location = ''view-source:''+ ''http://www.csdn.net/''">

12. 怎样通过asp的手段来检查来访者是否用了代理
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
response.write "<font color=#FF0000>您通过了代理服务器,"& _
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
%>

13. 取得控件的绝对位置

//Javascript
<script language="Javascript">
function getIE(e){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert("top="+t+"\nleft="+l);
}
</script>

//VBScript
<script language="VBScript"><!--
function getIE()
dim t,l,a,b
set a=document.all.img1
t=document.all.img1.offsetTop
l=document.all.img1.offsetLeft
while a.tagName<>"BODY"
set a = a.offsetParent
t=t+a.offsetTop
l=l+a.offsetLeft
wend
msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"
end function
--></script>

14. 光标是停在文本框文字的最后
<script language="javascript">
function cc()
{
var e = event.srcElement;
var r =e.createTextRange();
r.moveStart(''character'',e.value.length);
r.collapse(true);
r.select();
}
</script>
<input type=text name=text1 value="123" onfocus="cc()">

15. 判断上一页的来源
asp:
request.servervariables("HTTP_REFERER")

java script:
document.referrer

16. 最小化、最大化、关闭窗口
<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Minimize"></object>
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize"></object>
<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME="Command" VALUE="Close"></OBJECT>

<input type=button value=最小化 onclick=hh1.Click()>
<input type=button value=最大化 onclick=hh2.Click()>
<input type=button value=关闭 onclick=hh3.Click()>
本例适用于IE

17.
<%
''定义数据库连接的一些常量
Const adOpenForwardOnly = 0 ''游标只向前浏览记录,不支持分页、Recordset、BookMark
Const adOpenKeyset = 1 ''键集游标,其他用户对记录说做的修改将反映到记录集中,但其他用户增加或删除记录不会反映到记录集中。支持分页、Recordset、BookMark
Const adOpenDynamic = 2 ''动态游标功能最强,但耗资源也最多。用户对记录说做的修改,增加或删除记录都将反映到记录集中。支持全功能浏览(ACCESS不支持)。
Const adOpenStatic = 3 ''静态游标,只是数据的一个快照,用户对记录说做的修改,增加或删除记录都不会反映到记录集中。支持向前或向后移动

Const adLockReadOnly = 1 ''锁定类型,默认的,只读,不能作任何修改
Const adLockPessimistic = 2 ''当编辑时立即锁定记录,最安全的方式
Const adLockOptimistic = 3 ''只有在调用Update方法时才锁定记录集,而在此前的其他操作仍可对当前记录进行更改、插入和删除等
Const adLockBatchOptimistic = 4 ''当编辑时记录不会被锁定,而更改、插入和删除是在批处理方式下完成的

Const adCmdText = &H0001
Const adCmdTable = &H0002
%>

18. 网页不会被缓存
HTM网页
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
或者<META HTTP-EQUIV="expires" CONTENT="0">
ASP网页
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"
PHP网页
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
19. 检查一段字符串是否全由数字组成
<script language="Javascript"><!--
function checkNum(str){return str.match(/\D/)==null}
alert(checkNum("1232142141"))
alert(checkNum("123214214a1"))
// --></script>

20. 获得一个窗口的大小
document.body.clientWidth,document.body.clientHeight

21. 怎么判断是否是字符
if (/[^\x00-\xff]/g.test(s)) alert("含有汉字");
else alert("全是字符");

22.TEXTAREA自适应文字行数的多少
<textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">


页面很简单,就是一个文本框keyword和一个图片按钮doit,功能是,点击doit这个图片弹出新窗口显示查找的结果。

我原来做法是在按钮的doit_click过程中使用response.write("<script>window.open('search.aspx?keywork="&keyword.text&"',_blank)</script>")
功能是实现了,可就是会被广告拦截程序拦掉。

后来又使用onclick="window.open('search.aspx')"的方式来打开,用session("keyword")来传递参数。但碰到个问题:我在doit_click里给session("keyword")赋值,可oncick比doit_click先执行,即先打开新页面,再给session赋值,这就使查找的关键字是前一次输入的keyword。又不能解决问题。

A:
在onclick的里面获取文本框的值,然后作为url参数传到search.aspx

var keyword = document.getElementById('Keyword');

window.open('search.aspx?Keyword=' + encodeURI(var.value));

////
Q:
datagrid超链接打开定制新窗口的问题时出现的错误????
DataNavigateUrlFormatString="Javascript:window.open('CourseDetails.aspx?CourseCode={0}','','width=600,height=400,toolbar=0,menubar=0')"

但点击链接后除了弹出想要得窗口外,另弹出一个窗口。该窗口页面只有[object]字样,窗口标题为Javascript:window.open('CourseDetails.aspx?CourseCode={0}','','width=600,height=...

A:
private void projectinfo_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {
  
   if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
   {
   
     //邦定连接字段
     string NavigaterUrl = PargetUrl+"?id="+e.Item.Cells[1].Text;
     //定制客户端属性
     StringBuilder ClientTitle = new StringBuilder();
     ClientTitle.Append("this.bgColor='#ffefe5'");
     e.Item.Attributes.Add("onmouseover",ClientTitle.ToString());
     e.Item.Attributes.Add("onmouseout","this.bgColor='#ffffff'");
     //e.Item.Cells[0].Attributes.Add("onclick","javascript:show()");
     e.Item.Attributes.Add("onclick","javascript:window.open('"+NavigaterUrl+"','MainFrameSetMain'),this.bgColor='#C1D2EE'");
     //不换行显示
    
   
    
   
   }
 
  }

///
谁帮我用javascript写一个打开一个340*340的新窗口的程序。

A:window.open('a.aspx','','toolbar,menubar,scrollbars,resizable,status,location,directories,copyhistory,height=340,width=340')

window.open('a.aspx','','toolbar=no, menubar=no, scrollbars=no, resizable=1, location=no, status=no',height=340,width=340');
所有的弹出广告都是这样做的,看看新浪的主页就知道了。
<script language=javascript>
<!-- Hide
var newWindow = null
function windowOpener(loadpos)
{      
        if (! newWindow || newWindow.closed)
        {
        newWindow = window.open(loadpos,"surveywin","toolbar,resizable,scrollbars,dependent,width=400,height=280");
        }else
        {
                newWindow.focus();
        }
}

//end-->
</SCRIPT>


///
Q:
请教关于window.open的问题。我在验证后用window.open打开了新窗口,怎么把现在的窗口关闭呢?谢谢! Response.Write("<script language='javascript'>window.open('SystemConfig/Index.aspx','','width=1012,height=710,left=0,top=0,resizable=yes');window.close();</" + "script>");

这样用window.close()会弹出提示框,提示是不是关闭,请问怎么才能不提示就关闭呢?或是通过别的方法。谢谢@!

A:
window.opener=null;
window.close();
A2:
Response.Write("<script language='javascript'>window.open('SystemConfig/Index.aspx','','width=1012,height=710,left=0,top=0,resizable=yes');window.opener=null;window.close();</" + "script>");

////
open
打开一个新窗口,并装载URL指定的文档,或装载一个空白文档,如果没提供URL的话。
适用于
窗口
语法
widow = object.open([URL[,name[,features[,replace]]]])
参数         说   明
URL     规定要显示的文档URL的串。如果规定了URL,就显示带有about:blank的新窗口。name选项。规定窗口名字的串。这个名字用于FORM上的或用于A。选项。规定显示窗口装饰物的串。
下面的表列出所支持的特征语法说明
fullscreen={yes | no | 1 | 0 }规定是在全屏幕上还是在正常窗口中显示浏览器。默认值是no。使用全屏幕模式要当心。因为这种模式把浏览器的标题栏和菜单都隐蔽起来,你应当提供一个按钮或其他线索,帮助用户关闭这个窗口。Alt+F4也关闭这个新窗口。
channelmode=         { yes | no | 1 | 0 }规定是否以剧场模式显示窗口,并显示通道带。
toolbar={yes | no | 1 | 0 }规定是否显示浏览器toolbar、makingbutton,例如可用的Back、Forward、Stop
location={yes | no | 1 | 0 }规定是否显示用于把URL直接键入浏览器的输入字段

directories={yes | no | 1 | 0 }规定是否添加目录按钮,默认值是no
status={yes | no | 1 | 0 }规定是否在窗口底部添加状态条。默认是no
menubar={yes | no | 1 | 0 }规定是否显示菜单条。默认是no
scrollbars={yes | no | 1 | 0 }规定是否显示水平和垂直滚动条。默认是no
resizeble={yes | no | 1 | 0 }规定是否在窗口的角落上显示重定尺寸处理程序
width=number设置窗口的宽度,单位是像素
height=number规定窗口的高度,单位是像素。最小值是100
top=number规定顶位置,单位是像素。这个值是相对于屏幕的左上角的
left=number规定左位置,单位是像素。这个值是相对于屏幕左上角的
replace选项。是一个布尔值,规定要装入新页面上的URL是否在窗口浏览历史中要建立一个新条目,或者取代浏览历史中的当前条目。如果是真,就不建立新历史条目。

返回值
返回一个到新窗口的引用。
使用这个引用,在新窗口上脚本属性和方法上。说明新窗口的一个名字可以作为一种形式或一个A元素的目标。按照默认,open( )方法创建一个窗口。这个窗口有默认宽度和高度、标准的菜单、工具条,和其他Internet Explorer特征。你可以使用特征参数改变这组特征。这个参数是由一个或多个特征设定组成的串。替换参数便控制新窗口是否放到浏览器历史列表中。作为例子,下边创建一个包含Sample.htm的新窗口。新窗口为200乘400像素,有一个状态条,但是没有工具条、菜单或地址字段。
window.open("ample.html",null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");


/////Q:
在datagird中,在链接字段上面点击弹出窗口,up者有分
<asp:HyperLinkColumn Text="&gt;&gt;GO" DataNavigateUrlField="OperId" DataNavigateUrlFormatString="javascript:showModalDialog()"></asp:HyperLinkColumn>
这样可以实现弹出窗口,请问用window.open,和showModalDialog怎么实现?然后如何新窗口中弹出对话框?
A:
後台:
for (int j = 0; j < dg.Items.Count; j ++)
    {
     str1="MM_openBrWindow('06digital_view.aspx?e='"+dg.DataKeys[j].ToString()+",'作品瀏灠','width=550,height=400')";
     hlink = (HyperLink)dg.Items[j].Cells[4].FindControl("hlink");
     hlink.Attributes.Add("OnClick",str1);
    }


前台:


 <meta http-equiv="Content-Type" content="text/html; charset=big5">
   <script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//-->
   </script>


A2:
如果用DataNavigateUrlFormatString弹出窗口效果不好的话,可以使用以下方法:

<columns>     
 <asp:TemplateColumn runat="server">
 <itemtemplate>        <a href='' onClick='return f_open1("<%# DataBinder.Eval(Container.DataItem,"filename")%>")'><%# DataBinder.Eval(Container.DataItem,"title") %></a>
 </itemtemplate>


<SCRIPT language="JavaScript">
function f_open1(name)
{
window.open('infoshow.aspx?name='+name,'','scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,top=0, left=0,width=480%,height=400%');
return false;
window.opener=null;
window.close();
}
</SCRIPT>


//
我的在aspx里写,不在.cs里

<asp:HyperLinkColumn Text="&gt;&gt;GO" NavigateUrl="javascript:window.open('a.aspx?id=<%# DataBinder.Eval(Container.DataItem,"OperId")%>','','toolbar=no');"></asp:HyperLinkColumn>

<asp:HyperLinkColumn Text="&gt;&gt;GO" DataNavigateUrlField="OperId" DataNavigateUrlFormatString="javascript:window.open('a.aspx?id={0}','','toolbar=no');"></"></asp:HyperLinkColumn>


/////
用datagrid的超级链接打开新页面,在新页面修改数据后怎么刷新父页面?
我使用了Response.Write("<script language='javascript'>window.parent.location.reload();</script>");
却不好用?为什么?

Response.Write("<script language='javascript'>self.close();</script>");
可以执行!
A1:
如果你是用Javascript的window.open()方法打开的,可以试试:

window.opener.location.reload();

如果你是用超链接 <a href="mypage.aspx" target="_blank">在新窗口打开</a> 这样打开的,那么两个窗口之间没有任何关系,所以无法实现刷新打开新页面的窗口的要求。
A2:
使用Response.Write("<script language='javascript'>window.opener.location.href = window.opener.location.href;window.close();</script>");

A2:
这个问题,呵呵~~~~其实是老问题了~~~~~

1 首先如果你父页面中,提交过,有本页提交,即IsPostBack = ture .那么子窗体中用javaScript 的
window.opener.location.reload();方法就会出现IE讨厌的网页刷新重试按钮.

2 .除非你父窗体中没有本页提交,都是通过href = ....._blank 出去的,在子页面中使用
reload()是没有问题.

A3:
这个问题我这几天在研究,关于刷新父页面的法子是可以办到的。我是使用打开模态对话框提交自动关闭然后自动刷新父页面。
因为我不知道你说的“用datagrid的超级链接”这个链接文本是数据绑定的还是固定的链接。这两个链接要用到不同的事件处理模块。
假设你的这个链接是你的DataGrid的第三列,是修改按钮。代码如下:

html代码中加入:
<script language="javascript">
<!--
  function OpenEditWin(strID)
  {
     var url; // 定义你要打开的页面位置,假设是editdata.aspx
     url = 'editdata.aspx?ID=" + strID;
     var me;
     // 把父页面窗口对象当作参数传递到对话框中,以便对话框操纵父页自动刷新。
     me = window;
     // 打开对跨框的第三个参数要设定与editdata.aspx一样的大小。
     window.showModalDialog(url,me,'dialogWidth:580px;dialogHeight:520px;help:no;status:no')
   }
//-->
</script>
上面的js代码是让DataGrid的超链接调用的,参数是查询字符串关键字,让editdata.aspx获得。

然后是后台代码:
假设使用<asp:HyperLink)标签,name 是lnkEdit
首先必须在“Web 窗体设计器生成的代码”的“InitializeComponent()”中加入DataGrid的事件处理程序(DataGrid名称为MyDataGrid):
this.MyDataGrid.ItemDataBound += new DataGridItemEventHandler(this.MyDataGrid_ItemDataBound);
然后vs.net会自动生成一个MyDataGrid_ItemCreated方法,在里面添加:

private void MyDataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
    if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {
        for(int i=0;i<MyDataGrid.Items.Count;i++) // 循环查找所有DataGrid所有行
        {
         HyperLink lnk;
         lnk = (HyperLink)MyDataGrid.Items[i].Cells[2].FindControl("lnkEdit");
         // 现在,找到了链接,可以加东西了。
         // 首先获得记录主健
         string str = MyDataGrid.DataKeys[i].ToString();
         lnk.NavigateUrl = "#"; //表示内部链接
         // 注意,下面这行代码调用写好的js,并且把参数传递进去。
         lnk.Attributes.Add("onclick","javascript:OpenEditWin('" + str + "')");
         }
    }

上面的方法就是在DataGrid数据绑定后,强行修改链接字段的内容。

下面是dataedit.aspx的内容:
这个页面实际上是一个模态对话框,这种对话框要注意两个难点:
1 提交自动打开新窗口
2 对父窗口的引用无效(即使用window.opener操作无效)

接上:
解决第一个问题花了我好长时间,我在网上查找了好多资料,解决办法无非是下面两种:
1 在<head></head>内加入:<base target="_self">
2 在打开的模态对话框中使用<iframe>框架,在框架内使用.aspx文件,文件的提交target使用<iframe>的名称。即模态对话框不直接打开.aspx文件,而是打开含有框架的文件,在框架里面使用aspx文件。
以上两种办法我都用了,不管用。第一种办法我用了,表单提交的时候仍然打开新窗口。第二种办法也不可取,因为我要向模态对话框打开的文件传递查询字符串,而这个文件无法把这个字符串传递到框架内包含的文件中。
我解决这个问题还是使用js脚本,模态对话框直接打开.aspx文件,正常使用.aspx?ID=XXX这样的方式,在这个.aspx文件中加入js代码:
<script language="javascript">
<!--
   function onsubmit() // 定义表单提交事件发生的时候怎样处理
   {
      document.Form1.target="_self";
   }
//-->
</script>
上面的代码就是当表单提交的时候强制提交目标为本页,即使用对话框处理提交,而不是打开新页面。我注意到了,所有模态对话框自动打开新页面都是标单提交造成的。
然后就可以加入<asp:button>控件,处理数据库操作了,操作完毕以后,与贴主一样,向页面写入js代码,关闭本对话框并刷新父页面
后台代码
private void btnSubmit_Click(object sender,EvengArgs e)
{
   // 前面是数据库操作
   // 成功后,写
   Response.Write("<script language=\"javascript\">\r\n");
   Response.Write("<!--\r\n");
   Response.Write("if(dialogArguments != null){\r\n");
   // 注意上面的dialogArguments,就是父页面showModalDialog()的第二个参数。
   // 就是父页面的window对象引用。
   Response.Write("dialogArguments.location.reload(true);\r\n");
   // 上面就是刷新父页的代码,相当于在父页上使用
   // window.location.reload(true);代码
   // Response.Write("window.close();}"); // 关闭对话框
   // Response.Write("//-->\r\n</script>"); //关闭脚本块
}
上面的代码就是关闭对话框和刷新父页的代码,这段代码也可以直接写入editdata.aspx的html中,然后在后台cs中调用。
对不起,代码有点错。
最后两行代码
// Response.Write("window.close();}"); // 关闭对话框
// Response.Write("//-->\r\n</script>"); //关闭脚本块
不是注释,应该是
 Response.Write("window.close();}"); // 关闭对话框
 Response.Write("//-->\r\n</script>"); //关闭脚本块
 

posted @ 2006-05-26 14:02 Javaphua 阅读(742) | 评论 (0)编辑 收藏

<HTML>
  <HEAD>
    <title>WEB页面导出为EXCEL文档的方法
    </title>
  </HEAD>
<body>
<BR>
<table id = "PrintA" width="100%" border="1" cellspacing="0" cellpadding="0" bgcolor = "#61FF13">
<TR style="text-align : center;">
 <TD>单元格A</TD>
 <TD>单元格A</TD>
 <TD>单元格A</TD>
 <TD>单元格A</TD>
</TR>
<TR>
 <TD colSpan=4 style="text-align : center;"><font color="BLUE" face="Verdana">单元格合并行A</FONT></TD>
</TR>
</TABLE>
<BR>
<table id = "PrintB" width="100%" border="1" cellspacing="0" cellpadding="0">
<TR style="text-align : center;">
 <TD>单元格B</TD>
 <TD>单元格B</TD>
 <TD>单元格B</TD>
 <TD>单元格B</TD>
</TR>
<TR>
 <TD colSpan=4 style="text-align : center;">单元格合并行B</TD>
</TR>
</TABLE>
<br><br><br>
<input type="button" onclick="javascript:AllAreaWord();" value="导出页面指定区域内容到Word">
<input type="button" onclick="javascript:AllAreaExcel();" value="导出页面指定区域内容到Excel">
<input type="button" onclick="javascript:CellAreaExcel();" value="导出表单单元格内容到Excel">
<SCRIPT LANGUAGE="javascript">
 //指定页面区域内容导入Excel
 function AllAreaExcel()
 {
  var oXL = new ActiveXObject("Excel.Application");
  var oWB = oXL.Workbooks.Add();
  var oSheet = oWB.ActiveSheet; 
  var sel=document.body.createTextRange();
  sel.moveToElementText(PrintA);
  sel.select();
  sel.execCommand("Copy");
  oSheet.Paste();
  oXL.Visible = true;
 }
 //指定页面区域“单元格”内容导入Excel
 function CellAreaExcel()
 {
  var oXL = new ActiveXObject("Excel.Application");
  var oWB = oXL.Workbooks.Add();
  var oSheet = oWB.ActiveSheet;
  var Lenr = PrintA.rows.length;
  for (i=0;i<Lenr;i++)
  {
   var Lenc = PrintA.rows(i).cells.length;
   for (j=0;j<Lenc;j++)
   {
    oSheet.Cells(i+1,j+1).value = PrintA.rows(i).cells(j).innerText;
   }
  }
  oXL.Visible = true;
 }

 //指定页面区域内容导入Word
 function AllAreaWord()
 {
  var oWD = new ActiveXObject("Word.Application");
  var oDC = oWD.Documents.Add("",0,1);
  var oRange =oDC.Range(0,1);
  var sel = document.body.createTextRange();
  sel.moveToElementText(PrintA);
  sel.select();
  sel.execCommand("Copy");
  oRange.Paste();
  oWD.Application.Visible = true;
  //window.close();
 }
</SCRIPT>
</body></html>

posted @ 2006-05-18 20:07 Javaphua 阅读(334) | 评论 (0)编辑 收藏

Java实现汉字转换为拼音 
 

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Set;

/**
 *
 汉字转化为全拼
 *
 JDK版本: 1.4

public class CnToSpell {
    private static LinkedHashMap spellMap = null;

    static {
        if (spellMap == null) {
            spellMap = new LinkedHashMap(400);
        }
        initialize();
        System.out.println("Chinese transfer Spell Done.");
    }

    private CnToSpell() {
    }

    private static void spellPut(String spell, int ascii) {
        spellMap.put(spell, new Integer(ascii));
    }

    private static void initialize() {
        spellPut("a", -20319);
        spellPut("ai", -20317);
        spellPut("an", -20304);
        spellPut("ang", -20295);
        spellPut("ao", -20292);
        spellPut("ba", -20283);
        spellPut("bai", -20265);
        spellPut("ban", -20257);
        spellPut("bang", -20242);
        spellPut("bao", -20230);
        spellPut("bei", -20051);
        spellPut("ben", -20036);
        spellPut("beng", -20032);
        spellPut("bi", -20026);
        spellPut("bian", -20002);
        spellPut("biao", -19990);
        spellPut("bie", -19986);
        spellPut("bin", -19982);
        spellPut("bing", -19976);
        spellPut("bo", -19805);
        spellPut("bu", -19784);
        spellPut("ca", -19775);
        spellPut("cai", -19774);
        spellPut("can", -19763);
        spellPut("cang", -19756);
        spellPut("cao", -19751);
        spellPut("ce", -19746);
        spellPut("ceng", -19741);
        spellPut("cha", -19739);
        spellPut("chai", -19728);
        spellPut("chan", -19725);
        spellPut("chang", -19715);
        spellPut("chao", -19540);
        spellPut("che", -19531);
        spellPut("chen", -19525);
        spellPut("cheng", -19515);
        spellPut("chi", -19500);
        spellPut("chong", -19484);
        spellPut("chou", -19479);
        spellPut("chu", -19467);
        spellPut("chuai", -19289);
        spellPut("chuan", -19288);
        spellPut("chuang", -19281);
        spellPut("chui", -19275);
        spellPut("chun", -19270);
        spellPut("chuo", -19263);
        spellPut("ci", -19261);
        spellPut("cong", -19249);
        spellPut("cou", -19243);
        spellPut("cu", -19242);
        spellPut("cuan", -19238);
        spellPut("cui", -19235);
        spellPut("cun", -19227);
        spellPut("cuo", -19224);
        spellPut("da", -19218);
        spellPut("dai", -19212);
        spellPut("dan", -19038);
        spellPut("dang", -19023);
        spellPut("dao", -19018);
        spellPut("de", -19006);
        spellPut("deng", -19003);
        spellPut("di", -18996);
        spellPut("dian", -18977);
        spellPut("diao", -18961);
        spellPut("die", -18952);
        spellPut("ding", -18783);
        spellPut("diu", -18774);
        spellPut("dong", -18773);
        spellPut("dou", -18763);
        spellPut("du", -18756);
        spellPut("duan", -18741);
        spellPut("dui", -18735);
        spellPut("dun", -18731);
        spellPut("duo", -18722);
        spellPut("e", -18710);
        spellPut("en", -18697);
        spellPut("er", -18696);
        spellPut("fa", -18526);
        spellPut("fan", -18518);
        spellPut("fang", -18501);
        spellPut("fei", -18490);
        spellPut("fen", -18478);
        spellPut("feng", -18463);
        spellPut("fo", -18448);
        spellPut("fou", -18447);
        spellPut("fu", -18446);
        spellPut("ga", -18239);
        spellPut("gai", -18237);
        spellPut("gan", -18231);
        spellPut("gang", -18220);
        spellPut("gao", -18211);
        spellPut("ge", -18201);
        spellPut("gei", -18184);
        spellPut("gen", -18183);
        spellPut("geng", -18181);
        spellPut("gong", -18012);
        spellPut("gou", -17997);
        spellPut("gu", -17988);
        spellPut("gua", -17970);
        spellPut("guai", -17964);
        spellPut("guan", -17961);
        spellPut("guang", -17950);
        spellPut("gui", -17947);
        spellPut("gun", -17931);
        spellPut("guo", -17928);
        spellPut("ha", -17922);
        spellPut("hai", -17759);
        spellPut("han", -17752);
        spellPut("hang", -17733);
        spellPut("hao", -17730);
        spellPut("he", -17721);
        spellPut("hei", -17703);
        spellPut("hen", -17701);
        spellPut("heng", -17697);
        spellPut("hong", -17692);
        spellPut("hou", -17683);
        spellPut("hu", -17676);
        spellPut("hua", -17496);
        spellPut("huai", -17487);
        spellPut("huan", -17482);
        spellPut("huang", -17468);
        spellPut("hui", -17454);
        spellPut("hun", -17433);
        spellPut("huo", -17427);
        spellPut("ji", -17417);
        spellPut("jia", -17202);
        spellPut("jian", -17185);
        spellPut("jiang", -16983);
        spellPut("jiao", -16970);
        spellPut("jie", -16942);
        spellPut("jin", -16915);
        spellPut("jing", -16733);
        spellPut("jiong", -16708);
        spellPut("jiu", -16706);
        spellPut("ju", -16689);
        spellPut("juan", -16664);
        spellPut("jue", -16657);
        spellPut("jun", -16647);
        spellPut("ka", -16474);
        spellPut("kai", -16470);
        spellPut("kan", -16465);
        spellPut("kang", -16459);
        spellPut("kao", -16452);
        spellPut("ke", -16448);
        spellPut("ken", -16433);
        spellPut("keng", -16429);
        spellPut("kong", -16427);
        spellPut("kou", -16423);
        spellPut("ku", -16419);
        spellPut("kua", -16412);
        spellPut("kuai", -16407);
        spellPut("kuan", -16403);
        spellPut("kuang", -16401);
        spellPut("kui", -16393);
        spellPut("kun", -16220);
        spellPut("kuo", -16216);
        spellPut("la", -16212);
        spellPut("lai", -16205);
        spellPut("lan", -16202);
        spellPut("lang", -16187);
        spellPut("lao", -16180);
        spellPut("le", -16171);
        spellPut("lei", -16169);
        spellPut("leng", -16158);
        spellPut("li", -16155);
        spellPut("lia", -15959);
        spellPut("lian", -15958);
        spellPut("liang", -15944);
        spellPut("liao", -15933);
        spellPut("lie", -15920);
        spellPut("lin", -15915);
        spellPut("ling", -15903);
        spellPut("liu", -15889);
        spellPut("long", -15878);
        spellPut("lou", -15707);
        spellPut("lu", -15701);
        spellPut("lv", -15681);
        spellPut("luan", -15667);
        spellPut("lue", -15661);
        spellPut("lun", -15659);
        spellPut("luo", -15652);
        spellPut("ma", -15640);
        spellPut("mai", -15631);
        spellPut("man", -15625);
        spellPut("mang", -15454);
        spellPut("mao", -15448);
        spellPut("me", -15436);
        spellPut("mei", -15435);
        spellPut("men", -15419);
        spellPut("meng", -15416);
        spellPut("mi", -15408);
        spellPut("mian", -15394);
        spellPut("miao", -15385);
        spellPut("mie", -15377);
        spellPut("min", -15375);
        spellPut("ming", -15369);
        spellPut("miu", -15363);
        spellPut("mo", -15362);
        spellPut("mou", -15183);
        spellPut("mu", -15180);
        spellPut("na", -15165);
        spellPut("nai", -15158);
        spellPut("nan", -15153);
        spellPut("nang", -15150);
        spellPut("nao", -15149);
        spellPut("ne", -15144);
        spellPut("nei", -15143);
        spellPut("nen", -15141);
        spellPut("neng", -15140);
        spellPut("ni", -15139);
        spellPut("nian", -15128);
        spellPut("niang", -15121);
        spellPut("niao", -15119);
        spellPut("nie", -15117);
        spellPut("nin", -15110);
        spellPut("ning", -15109);
        spellPut("niu", -14941);
        spellPut("nong", -14937);
        spellPut("nu", -14933);
        spellPut("nv", -14930);
        spellPut("nuan", -14929);
        spellPut("nue", -14928);
        spellPut("nuo", -14926);
        spellPut("o", -14922);
        spellPut("ou", -14921);
        spellPut("pa", -14914);
        spellPut("pai", -14908);
        spellPut("pan", -14902);
        spellPut("pang", -14894);
        spellPut("pao", -14889);
        spellPut("pei", -14882);
        spellPut("pen", -14873);
        spellPut("peng", -14871);
        spellPut("pi", -14857);
        spellPut("pian", -14678);
        spellPut("piao", -14674);
        spellPut("pie", -14670);
        spellPut("pin", -14668);
        spellPut("ping", -14663);
        spellPut("po", -14654);
        spellPut("pu", -14645);
        spellPut("qi", -14630);
        spellPut("qia", -14594);
        spellPut("qian", -14429);
        spellPut("qiang", -14407);
        spellPut("qiao", -14399);
        spellPut("qie", -14384);
        spellPut("qin", -14379);
        spellPut("qing", -14368);
        spellPut("qiong", -14355);
        spellPut("qiu", -14353);
        spellPut("qu", -14345);
        spellPut("quan", -14170);
        spellPut("que", -14159);
        spellPut("qun", -14151);
        spellPut("ran", -14149);
        spellPut("rang", -14145);
        spellPut("rao", -14140);
        spellPut("re", -14137);
        spellPut("ren", -14135);
        spellPut("reng", -14125);
        spellPut("ri", -14123);
        spellPut("rong", -14122);
        spellPut("rou", -14112);
        spellPut("ru", -14109);
        spellPut("ruan", -14099);
        spellPut("rui", -14097);
        spellPut("run", -14094);
        spellPut("ruo", -14092);
        spellPut("sa", -14090);
        spellPut("sai", -14087);
        spellPut("san", -14083);
        spellPut("sang", -13917);
        spellPut("sao", -13914);
        spellPut("se", -13910);
        spellPut("sen", -13907);
        spellPut("seng", -13906);
        spellPut("sha", -13905);
        spellPut("shai", -13896);
        spellPut("shan", -13894);
        spellPut("shang", -13878);
        spellPut("shao", -13870);
        spellPut("she", -13859);
        spellPut("shen", -13847);
        spellPut("sheng", -13831);
        spellPut("shi", -13658);
        spellPut("shou", -13611);
        spellPut("shu", -13601);
        spellPut("shua", -13406);
        spellPut("shuai", -13404);
        spellPut("shuan", -13400);
        spellPut("shuang", -13398);
        spellPut("shui", -13395);
        spellPut("shun", -13391);
        spellPut("shuo", -13387);
        spellPut("si", -13383);
        spellPut("song", -13367);
        spellPut("sou", -13359);
        spellPut("su", -13356);
        spellPut("suan", -13343);
        spellPut("sui", -13340);
        spellPut("sun", -13329);
        spellPut("suo", -13326);
        spellPut("ta", -13318);
        spellPut("tai", -13147);
        spellPut("tan", -13138);
        spellPut("tang", -13120);
        spellPut("tao", -13107);
        spellPut("te", -13096);
        spellPut("teng", -13095);
        spellPut("ti", -13091);
        spellPut("tian", -13076);
        spellPut("tiao", -13068);
        spellPut("tie", -13063);
        spellPut("ting", -13060);
        spellPut("tong", -12888);
        spellPut("tou", -12875);
        spellPut("tu", -12871);
        spellPut("tuan", -12860);
        spellPut("tui", -12858);
        spellPut("tun", -12852);
        spellPut("tuo", -12849);
        spellPut("wa", -12838);
        spellPut("wai", -12831);
        spellPut("wan", -12829);
        spellPut("wang", -12812);
        spellPut("wei", -12802);
        spellPut("wen", -12607);
        spellPut("weng", -12597);
        spellPut("wo", -12594);
        spellPut("wu", -12585);
        spellPut("xi", -12556);
        spellPut("xia", -12359);
        spellPut("xian", -12346);
        spellPut("xiang", -12320);
        spellPut("xiao", -12300);
        spellPut("xie", -12120);
        spellPut("xin", -12099);
        spellPut("xing", -12089);
        spellPut("xiong", -12074);
        spellPut("xiu", -12067);
        spellPut("xu", -12058);
        spellPut("xuan", -12039);
        spellPut("xue", -11867);
        spellPut("xun", -11861);
        spellPut("ya", -11847);
        spellPut("yan", -11831);
        spellPut("yang", -11798);
        spellPut("yao", -11781);
        spellPut("ye", -11604);
        spellPut("yi", -11589);
        spellPut("yin", -11536);
        spellPut("ying", -11358);
        spellPut("yo", -11340);
        spellPut("yong", -11339);
        spellPut("you", -11324);
        spellPut("yu", -11303);
        spellPut("yuan", -11097);
        spellPut("yue", -11077);
        spellPut("yun", -11067);
        spellPut("za", -11055);
        spellPut("zai", -11052);
        spellPut("zan", -11045);
        spellPut("zang", -11041);
        spellPut("zao", -11038);
        spellPut("ze", -11024);
        spellPut("zei", -11020);
        spellPut("zen", -11019);
        spellPut("zeng", -11018);
        spellPut("zha", -11014);
        spellPut("zhai", -10838);
        spellPut("zhan", -10832);
        spellPut("zhang", -10815);
        spellPut("zhao", -10800);
        spellPut("zhe", -10790);
        spellPut("zhen", -10780);
        spellPut("zheng", -10764);
        spellPut("zhi", -10587);
        spellPut("zhong", -10544);
        spellPut("zhou", -10533);
        spellPut("zhu", -10519);
        spellPut("zhua", -10331);
        spellPut("zhuai", -10329);
        spellPut("zhuan", -10328);
        spellPut("zhuang", -10322);
        spellPut("zhui", -10315);
        spellPut("zhun", -10309);
        spellPut("zhuo", -10307);
        spellPut("zi", -10296);
        spellPut("zong", -10281);
        spellPut("zou", -10274);
        spellPut("zu", -10270);
        spellPut("zuan", -10262);
        spellPut("zui", -10260);
        spellPut("zun", -10256);
        spellPut("zuo", -10254);
    }

    /**
     * 获得单个汉字的Ascii.
     * @param cn char
     * 汉字字符
     * @return int
     * 错误返回 0,否则返回ascii
     */
    public static int getCnAscii(char cn) {
        byte[] bytes = (String.valueOf(cn)).getBytes();
        if (bytes == null || bytes.length > 2 || bytes.length <= 0) { //错误
            return 0;
        }
        if (bytes.length == 1) { //英文字符
            return bytes[0];
        }
        if (bytes.length == 2) { //中文字符
            int hightByte = 256 + bytes[0];
            int lowByte = 256 + bytes[1];

            int ascii = (256 * hightByte + lowByte) - 256 * 256;

//System.out.println("ASCII=" + ascii);

            return ascii;
        }

        return 0; //错误
    }

    /**
     * 根据ASCII码到SpellMap中查找对应的拼音
     * @param ascii int
     * 字符对应的ASCII
     * @return String
     * 拼音,首先判断ASCII是否>0&<160,如果是返回对应的字符,
     *
     否则到SpellMap中查找,如果没有找到拼音,则返回null,如果找到则返回拼音.
     */
    public static String getSpellByAscii(int ascii) {
        if (ascii > 0 && ascii < 160) { //单字符
            return String.valueOf((char) ascii);
        }

        if (ascii < -20319 || ascii > -10247) { //不知道的字符
            return null;
        }

        Set keySet = spellMap.keySet();
        Iterator it = keySet.iterator();

        String spell0 = null; ;
        String spell = null;

        int asciiRang0 = -20319;
        int asciiRang;
        while (it.hasNext()) {

            spell = (String) it.next();
            Object valObj = spellMap.get(spell);
            if (valObj instanceof Integer) {
                asciiRang = ((Integer) valObj).intValue();

                if (ascii >= asciiRang0 && ascii < asciiRang) { //区间找到
                    return (spell0 == null) ? spell : spell0;
                } else {
                    spell0 = spell;
                    asciiRang0 = asciiRang;
                }
            }
        }

        return null;

    }

    /**
     * 返回字符串的全拼,是汉字转化为全拼,其它字符不进行转换
     * @param cnStr String
     * 字符串
     * @return String
     * 转换成全拼后的字符串
     */
    public static String getFullSpell(String cnStr) {
        if (null == cnStr || "".equals(cnStr.trim())) {
            return cnStr;
        }

        char[] chars = cnStr.toCharArray();
        StringBuffer retuBuf = new StringBuffer();
        for (int i = 0, Len = chars.length; i < Len; i++) {
            int ascii = getCnAscii(chars[i]);
            if (ascii == 0) { //取ascii时出错
                retuBuf.append(chars[i]);
            } else {
                String spell = getSpellByAscii(ascii);
                if (spell == null) {
                    retuBuf.append(chars[i]);
                } else {
                    retuBuf.append(spell);
                } // end of if spell == null
            } // end of if ascii <= -20400
        } // end of for

        return retuBuf.toString();
    }

    public static String getFirstSpell(String cnStr) {
        return null;
    }

    public static void main(String[] args) {
        String str = null;
        str = "小红帽";
        System.out.println("Spell=" + CnToSpell.getFullSpell(str));  }
}

 

posted @ 2006-05-18 19:40 Javaphua 阅读(386) | 评论 (0)编辑 收藏

                                                            Jbuilder中光标错位的解决方法

 大家常常说JBuilder在中文系统中存在光标错位的问题,都认为这是JBuilder的一个Bug,其实这实在是冤枉JBuilder了!大家讨论出来的解决方法无外乎两种:
  1、将编辑器的字体改为宋体,用这种方法带来的问题是,在宋体下的英文字体实在难看,阅读起来不太顺眼;
  2、就是将编辑器字体的粗体属性去掉,这样也影响代码的可读性。其实,造成JBuilder光标错位的问题并不是Borland的错误,而是Java的宗师——Sun的罪过!大家一定知道i18n吧?在不同的区域设置中,JDK自动调用与之相对应的properties文件,而在JDK中,Sun所推出的与中文系统相对应的properties文件存在问题,在它之中没有区分英文字体的正常、粗体和斜体,从而导致了以上所说的问题,解决的方法很简单,只要将这个properties文件修改正确就可以了,修改方法如下:

就是要修改jre/lib目录中的font.properties.zh文件

不过在最近编程中,发现修改font.properties.zh之后,

原本在某些组件中应该正常显示的中文变成了方格

对比前后两个文件,发现上次给出的修改内容有问题,不完整

再发如下:


# @(#)font.properties.zh        1.10 02/03/07
#
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
#

# Component Font Mappings
#
dialog.plain.0=Arial,ANSI_CHARSET
dialog.plain.1=\u5b8b\u4f53,GB2312_CHARSET
dialog.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialog.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

dialog.bold.0=Arial Bold,ANSI_CHARSET
dialog.bold.1=\u5b8b\u4f53,GB2312_CHARSET
dialog.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialog.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

dialog.italic.0=Arial Italic,ANSI_CHARSET
dialog.italic.1=\u5b8b\u4f53,GB2312_CHARSET
dialog.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialog.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

dialog.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
dialog.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
dialog.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialog.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

dialoginput.plain.0=Courier New,ANSI_CHARSET
dialoginput.plain.1=\u5b8b\u4f53,GB2312_CHARSET
dialoginput.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

dialoginput.bold.0=Courier New Bold,ANSI_CHARSET
dialoginput.bold.1=\u5b8b\u4f53,GB2312_CHARSET
dialoginput.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

dialoginput.italic.0=Courier New Italic,ANSI_CHARSET
dialoginput.italic.1=\u5b8b\u4f53,GB2312_CHARSET
dialoginput.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED



dialoginput.bolditalic.0=Courier New Bold Italic,ANSI_CHARSET
dialoginput.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
dialoginput.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

serif.plain.0=Times New Roman,ANSI_CHARSET
serif.plain.1=\u5b8b\u4f53,GB2312_CHARSET
serif.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
serif.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED


serif.bold.0=Times New Roman Bold,ANSI_CHARSET
serif.bold.1=\u5b8b\u4f53,GB2312_CHARSET
serif.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
serif.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

serif.italic.0=Times New Roman Italic,ANSI_CHARSET
serif.italic.1=\u5b8b\u4f53,GB2312_CHARSET
serif.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
serif.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

serif.bolditalic.0=Times New Roman Bold Italic,ANSI_CHARSET
serif.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
serif.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
serif.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

sansserif.plain.0=Arial,ANSI_CHARSET
sansserif.plain.1=\u5b8b\u4f53,GB2312_CHARSET
sansserif.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

sansserif.bold.0=Arial Bold,ANSI_CHARSET
sansserif.bold.1=\u5b8b\u4f53,GB2312_CHARSET
sansserif.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

sansserif.italic.0=Arial Italic,ANSI_CHARSET
sansserif.italic.1=\u5b8b\u4f53,GB2312_CHARSET
sansserif.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

sansserif.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
sansserif.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
sansserif.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

monospaced.plain.0=Courier New,GB2312_CHARSET
monospaced.plain.1=\u5b8b\u4f53,GB2312_CHARSET
monospaced.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

monospaced.bold.0=Courier New Bold,GB2312_CHARSET
monospaced.bold.1=\u5b8b\u4f53,GB2312_CHARSET
monospaced.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

monospaced.italic.0=Courier New Italic,GB2312_CHARSET
monospaced.italic.1=\u5b8b\u4f53,GB2312_CHARSET
monospaced.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

monospaced.bolditalic.0=Courier New Bold Italic,GB2312_CHARSET
monospaced.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
monospaced.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

# Font File Names
#
filename.\u5b8b\u4f53=SIMSUN.TTC

filename.Arial=ARIAL.TTF
filename.Arial_Bold=ARIALBD.TTF
filename.Arial_Italic=ARIALI.TTF
filename.Arial_Bold_Italic=ARIALBI.TTF

filename.Courier_New=COUR.TTF
filename.Courier_New_Bold=COURBD.TTF
filename.Courier_New_Italic=COURI.TTF
filename.Courier_New_Bold_Italic=COURBI.TTF

filename.Times_New_Roman=TIMES.TTF
filename.Times_New_Roman_Bold=TIMESBD.TTF
filename.Times_New_Roman_Italic=TIMESI.TTF
filename.Times_New_Roman_Bold_Italic=TIMESBI.TTF

filename.WingDings=WINGDING.TTF
filename.Symbol=SYMBOL.TTF

# Missing Glyph Character
#
default.char=2751

# Component Font Character Encodings

#
fontcharset.dialog.1=sun.io.CharToByteGBK
fontcharset.dialog.2=sun.awt.windows.CharToByteWingDings
fontcharset.dialog.3=sun.awt.CharToByteSymbol

fontcharset.dialoginput.1=sun.io.CharToByteGBK
fontcharset.dialoginput.2=sun.awt.windows.CharToByteWingDings
fontcharset.dialoginput.3=sun.awt.CharToByteSymbol

fontcharset.serif.1=sun.io.CharToByteGBK
fontcharset.serif.2=sun.awt.windows.CharToByteWingDings
fontcharset.serif.3=sun.awt.CharToByteSymbol

fontcharset.sansserif.1=sun.io.CharToByteGBK
fontcharset.sansserif.2=sun.awt.windows.CharToByteWingDings
fontcharset.sansserif.3=sun.awt.CharToByteSymbol

fontcharset.monospaced.0=sun.io.CharToByteGBK
fontcharset.monospaced.1=sun.io.CharToByteGBK
fontcharset.monospaced.2=sun.awt.windows.CharToByteWingDings
fontcharset.monospaced.3=sun.awt.CharToByteSymbol

# Exclusion Ranges
#
exclusion.dialog.0=0100-20ab,20ad-f8ff

exclusion.dialoginput.0=0100-20ab,20ad-f8ff
exclusion.serif.0=0100-20ab,20ad-f8ff
exclusion.sansserif.0=0100-20ab,20ad-f8ff
exclusion.monospaced.0=0100-20ab,20ad-f8ff

# Text Input Character Set
#
inputtextcharset=GB2312_CHARSET

posted @ 2006-01-04 09:44 Javaphua 阅读(230) | 评论 (0)编辑 收藏

一句SQL语句搞定
SELECT OWNER,COUNT(*) FROM ALL_TABLES GROUP BY OWNER;
posted @ 2005-12-14 16:33 Javaphua 阅读(1508) | 评论 (1)编辑 收藏

问题:请问oracle里的oracle managermant server 在哪?怎么启动?oracle控制台怎么连接上它?
答:oracle managermant server 服务在控制面板/管理工具/服务中,右键--启动即可。
连接oracle控制台,首先,你必须自己配置EMC(enterprise manager configuration),具体步骤是使用【开始】菜单中的【oracle-oracle】-->【configuration and migration tools】-->【enterprise manager configuration assistant】进入配置enterprise manager 的界面进行配置;配置完成后,使用 控制台登录界面的时候选择【登录到oracle management server】,输入用户名、口令和配置好的enterprise manager 名称即可登录
posted @ 2005-11-29 15:54 Javaphua 阅读(458) | 评论 (0)编辑 收藏

仅列出标题
共5页: 上一页 1 2 3 4 5 下一页