<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    俊星的BLOG

    #

    Angela's Ashes 天使的孩子

    今天偶然在一片博客上看到了《Angela's Ashes》的介紹,又在YOUKU上發現了一段原聲音樂,帶點憂傷,很合我胃口。
    不過,在網上沒有找到能免費看的,那就上淘寶買一張吧。

    posted @ 2009-05-29 16:43 俊星 閱讀(102) | 評論 (0)編輯 收藏

    MYSQL Access denied 問題的解決

    今天嘗試通過JDBC連接局域網的另一臺機器,拋出了如下異常:
    com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Access denied for user 'root'@'%' to database 'wiki'
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:
    936)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:
    2985)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:
    885)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:
    3421)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:
    1247)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:
    2775)
        at com.mysql.jdbc.Connection.<init>(Connection.java:
    1555)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:
    285)
        at java.sql.DriverManager.getConnection(DriverManager.java:
    525)
        at java.sql.DriverManager.getConnection(DriverManager.java:
    171)
        at test.tool.WikiStat.getConn(WikiStat.java:
    18)
        at test.tool.WikiStat.main(WikiStat.java:
    23)

    具體的解決方法為,授予相關用權限,如:
    mysql> grant select on *.* to 'root'@'%' identified by 'password';
    Query OK, 0 rows affected (0.00 sec)

    mysql> flush privileges
    ;
    Query OK, 0 rows affected (0.00 sec)

    mysql> exit
    Bye

    命令“grant select on *.* to 'root'@'%' identified by 'password'”所作的事情其實就是在“mysql.user”表中添加了一行記錄,
    因此如果需要刪除某個授權,直接找到user表執行刪除就OK了。

    posted @ 2009-05-27 19:54 俊星 閱讀(2345) | 評論 (0)編輯 收藏

    JAVA小工具之文件查找

    需要在一堆文件夾中查找一個exe文件,實在無法忍受windows的查找功能,自己寫了一個簡單的JAVA類,實現了查找:
    package test.tool;

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;

    /**
     * 
     * 
    @author kinkding
     * @history 2009-5-26
     
    */

    public class FindFile {
        
    private String fileName = "";
        
    private String dir = "";
        
    private Matcher m = null;
        
    private int count = 0;

        
    public FindFile() throws IOException {
            String f 
    = FindFile.class.getResource("findfile.properties").getFile();
            BufferedReader read 
    = new BufferedReader(new FileReader(f));
            dir 
    = read.readLine().trim();
            fileName 
    = read.readLine().trim();
            Pattern p 
    = Pattern.compile(fileName);
            m 
    = p.matcher("");
        }


        
    public void find() {
            File root 
    = new File(dir);
            
    for (File f : root.listFiles()) {
                
    if (f.isDirectory()) {
                    dir 
    = f.getAbsolutePath();
                    find();
                }
     else {
                    m.reset(f.getName());
                    
    if (m.find()) {
                        count
    ++;
                        System.out.println(f.getAbsolutePath());
                    }

                }

            }

        }


        
    public static void main(String[] args) {
            
    try {
                FindFile ff 
    = new FindFile();
                ff.find();
                System.out.println(
    "\n共找到文件數目:" + ff.count);
            }
     catch (IOException e) {
                e.printStackTrace();
            }

        }

    }


    findfile.properties:
    F:\download
    vod.
    *.exe

    運行效果如下:
    F:\download\firefox\vodplayer.exe
    F:\download\ie\vodplayer.exe

    共找到文件數目:
    2

    相關說明:
    之所以加載配置文件時不采用java.util.Properties類,是因為配置的路徑“F:\download”通過getProperty方法取得時候,去掉了文件分割符,所以直接就采用流的方式讀取,第一行默認目錄,第二行默認文件名,并且對文件名采用正則匹配。

    posted @ 2009-05-26 22:54 俊星 閱讀(847) | 評論 (0)編輯 收藏

    IE修復的相關命令

    IE修復的相關命令:
    "%ProgramFiles%\Internet Explorer\iexplore.exe" /rereg

    regsvr32 Shdocvw.dll
    regsvr32 Oleaut32.dll
    regsvr32 Actxprxy.dll
    regsvr32 Mshtml.dll
    regsvr32 Urlmon.dll
    regsvr32 browseui.dll

    regsvr32 hhctrl.ocx

    posted @ 2009-05-26 20:22 俊星 閱讀(112) | 評論 (0)編輯 收藏

    JAVA字符編碼

    測試代碼:
        public static void main(String[] args) {
            Locale.setDefault(Locale.US);
            String str 
    = "中G中";
            String codes[] 
    = "iso8859-1""utf-8""utf-16""unicode""gbk""gb2312" };
            
    try {
                System.out.println(str);
                System.out.println(
    "default code:" + System.getProperty("file.encoding"));
                
    for (String s : codes) {
                    System.out.println(s 
    + "" + toHex(str.getBytes(s)));
                }

            }
     catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }

        }


        
    private static String toHex(byte[] buffer) {
            StringBuffer sb 
    = new StringBuffer(buffer.length * 3);

            
    for (int i = 0; i < buffer.length; i++{
                sb.append(Character.forDigit((buffer[i] 
    & 0xf0>> 416));
                sb.append(Character.forDigit(buffer[i] 
    & 0x0f16));
                sb.append(
    " ");
            }


            
    return sb.toString();
        }

    輸出如下:
    中G中
    default code:GBK
    iso8859-
    1: 3f 47 3f 
    utf-
    8: e4 b8 ad 47 e4 b8 ad 
    utf-
    16: fe ff 4e 2d 00 47 4e 2d 
    unicode: ff fe 2d 4e 
    47 00 2d 4e 
    gbk: d6 d0 
    47 d6 d0 
    gb2312: d6 d0 
    47 d6 d0 

    相關說明:
    1、通過System.getProperty("file.encoding")獲取到當前JVM的默認字符編碼方式,如GBK
    2、iso8859-1則是應用于英文和歐洲其他語言的單字節編碼字符集,“3f”其實對應就是“?”。
    3、utf-8則是unicode編碼的一種轉換方式(Unicode Transformation Format),兼容于ASCII編碼,如對于中文則使用3個字節來存儲,對于英文使用一個字節存儲。
    4、utf-16是unicode編碼的另一種轉換方式,每個直接都采用2個字節來存儲,所以不兼容于ASCII;
          其中“fe ff”是Byte Order Mark(BOM)表示采用的編碼方式為utf-16。
    5、此處的unicode輸出和utf-16本質相同,只不過大小尾序的問題導致單個字節輸出順序相反;
          其中對于windows和linux平臺的utf-16默認采用小尾序(LE little Endion),mac平臺采用大尾。
    6、gbk和gb2312是中文字符集,對于每個字符均采用2個字節存儲,其中gbk兼容gb2312并且還可表示繁體。

    關于存儲字節的計算,假設現在有N個中文和M個英文字符,則如下的計算方式(編碼方式:字節數):
    GBK:2*N+M
    UTF-8:3*N+M
    UTF-16:2*(N+M+1)
    ISO8859-1:N+M

    posted @ 2009-05-26 00:12 俊星 閱讀(220) | 評論 (0)編輯 收藏

    僅列出標題
    共10頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 Last 
    主站蜘蛛池模板: 综合自拍亚洲综合图不卡区| 亚洲精品国产美女久久久| 亚洲精品欧洲精品| 在线观看免费视频网站色| 亚洲综合国产精品第一页| 无码日韩人妻AV一区免费l| 亚洲 自拍 另类小说综合图区| 美女被暴羞羞免费视频| 亚洲国产一区二区三区| 三根一起会坏掉的好痛免费三级全黄的视频在线观看 | 亚洲免费日韩无码系列| 亚洲精品视频免费| 亚洲AV无码码潮喷在线观看 | 精品免费久久久久久久| 亚洲一区二区三区久久| 免费无码成人AV片在线在线播放| 亚洲国产精品无码第一区二区三区| 精品国产免费观看| 男女作爱免费网站| 亚洲人成人无码网www电影首页| 免费一区二区三区| 亚洲Av无码一区二区二三区 | 国产亚洲成AV人片在线观黄桃| 无码国产精品一区二区免费16 | 亚洲宅男永久在线| 成人免费毛片视频| 一区二区三区免费视频播放器| 国产亚洲精品国看不卡| 99久热只有精品视频免费观看17| 激情综合亚洲色婷婷五月APP| 国产网站在线免费观看| 国产做国产爱免费视频| 亚洲乱码在线视频| 亚洲AV无码一区二三区| 亚洲视频在线免费观看| 亚洲爆乳无码专区www| 亚洲欧洲国产精品香蕉网| 噼里啪啦电影在线观看免费高清 | 亚洲国产精品综合久久一线| 日韩精品免费视频| 猫咪免费人成网站在线观看入口|