• 今早发现以前检测数据库里是否存在某个表的代码(见下面)居然没有效果了,检查后发现代码一点都没有变,就怀疑是mysql的jdbc驱动问题(曾经有过与驱动相关的郁闷经历),把驱动从mysql-connector-java-3.1.8-bin.jar换成mysql-connector-java-3.0.16-ga-bin.jar,结果一切ok。
    mysql的jdbc驱动真不能让人放心,不知道什么时候在什么地方就会出问题。

    // 获取数据库的元数据

    DatabaseMetaData dma=conn.getMetaData();

    // 将数据库中的表的名称转储出来

    String[] types=new String[]{"TABLES"}; // 设置查询类型

    // 请注意通配符是 % 符号(而不是“*”)

    ResultSet results=dma.getTable(null,null,"%",types);

    while(results.next())

    {

      String tableName=results.getString("TABLE_NAME");

    System.out.println(tableName);

    }

  • 2005年06月13日

    wsh改名脚本

    Tag:

    应minnie的要求而写 //Author:Ivan Chen

    //Author:Ivan Chen

    //Licensed under LGPL

     

    //Enumerate files under current dir and open one by one, read first line of each file.

    //if FT* string is found, change its filename to FT*.DAT

    var fso, ts, line;

    var ForReading = 1;

    fso = new ActiveXObject("Scripting.FileSystemObject");

    var objRootFolder = fso.GetFolder(".");

    fc = new Enumerator(objRootFolder.files);

     

    var srcFile,dstFile;

    var re;

    var count=0;

    for (; !fc.atEnd(); fc.moveNext())

    {

          srcFile = fc.item();

          if(srcFile.name.indexOf("rename.js")!=-1||srcFile.name.indexOf("rename.bat")!=-1)continue;

          ts = fso.OpenTextFile(srcFile, ForReading);

          line = ts.ReadLine();

          re = /FT\d+/;                   

      dstFile = line.match(re); 

          //WScript.Echo(dstFile);

          ts.Close();

          if(dstFile==null)continue;

          //WScript.Echo(srcFile);

          fso.MoveFile(srcFile,dstFile+".DAT");

          count++;

    }

    objRootFolder = null;

    objFS = null;

     

    WScript.Echo("Rename done! Total files: "+count);

  • eclipse里面,如果你删除了一个文件或文件夹,则eclipse会认为除了删除本地的文件(文件夹),你也要删除服务器上的文件(文件夹),当你commit的时候,就会帮你删除掉服务器上的文件(文件夹)。这是eclipse的智能之处,但eclipse新手老是会忘了这一点,从而误删服务器上的文件(文件夹)。

    在TortoiseCVS中,如果直接通过资源管理器删除文件(文件夹),TortoiseCVS是不会帮你删掉CVS服务器上的文件(文件夹)的。要删除服务器上的文件(文件夹),必须通过TortoiseCVS的菜单进行删除操作,再commit。

    Wincvs与TortoiseCVS类似。

  •  "When java tries to deserialize an object, it compares the serialized object's serialVersionUID with that of the class the JVM  is using for deserializing the object. ...
    If the two numbers don't match, the JVM assumes the class is not compatible with the previously-serialized object, and you'll get an exception during deserialization.
    So, the solution is to put a serialVersionUID in your class, and then as the class evolves, the serialVersionUID will remain the same and the JVM will say, "Ok, cool, the class is compatible with this serialized object." even though the class has actually changes"

    If the class has been changed and you want the JVM to not to load the previously serialized classes then the serialVersionUID . Otherwise leave it alone.

  • 2005年05月20日

    mysql备份脚本

    Tag:MySQL DB

    FOR /F "tokens=1-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%F%%G%%H)
    FOR /F "tokens=1-4 DELIMS=: " %%F IN ('time /T') DO (set v_time=%%F%%G%%H)
    set fname=fireshort_%v_date%_%v_time%.sql
    echo %v_time%
    echo %fname%
    mysqldump.exe  fireshortdb > %fname%

    将上面的内容保存为backupfireshortdb.bat,执行时就可以得到fireshortdb的备份,形如fireshort_2005-05-20星期五_840.sql。