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

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

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

    posts - 25,comments - 0,trackbacks - 0
    http://hllvm.group.iteye.com/group/wiki?category_id=316 
    posted @ 2012-07-08 10:17 周磊 閱讀(295) | 評(píng)論 (0)編輯 收藏
    再看看<effective java> ,對(duì)前半年寫的代碼進(jìn)行一下反思
    慢慢看《Hadoop實(shí)戰(zhàn)中文版》,了解分布式系統(tǒng)
    認(rèn)真閱讀《設(shè)計(jì)模式之禪》,加深對(duì)自己已經(jīng)在實(shí)際項(xiàng)目中運(yùn)用的模式的理解。
    閱讀《java解惑》的后半部分(2年前讀過前幾十條建議),了解編碼中的陷阱。
    posted @ 2012-06-29 15:07 周磊 閱讀(290) | 評(píng)論 (0)編輯 收藏

    State of the Lambda

    http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-4.html 

    jdk快點(diǎn)出吧lambdba把,一直用op4j和lambdbaj這些jar包很蛋疼。。
    posted @ 2012-06-27 11:47 周磊 閱讀(312) | 評(píng)論 (0)編輯 收藏
    spring配置該方法只讀了。

    <bean id="txProxyTemplate" abstract="true"
           class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
           <property name="transactionManager" ref="transactionManager"/>
           <property name="transactionAttributes">
               <props>
                  <prop key="affirm*">PROPAGATION_REQUIRED</prop>
                  <prop key="gen*">PROPAGATION_REQUIRED</prop>
                   <prop key="save*">PROPAGATION_REQUIRED</prop>
                   <prop key="update*">PROPAGATION_REQUIRED</prop>
                   <prop key="create*">PROPAGATION_REQUIRED</prop>
                   <prop key="process*">PROPAGATION_REQUIRED</prop>                               
                   <prop key="delete*">PROPAGATION_REQUIRED</prop>               
                   <prop key="remove*">PROPAGATION_REQUIRED</prop>
                   <prop key="send*">PROPAGATION_REQUIRED</prop>
      <prop key="upload*">PROPAGATION_REQUIRED</prop>               
                   <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
               </props>
           </property></bean>

    posted @ 2012-05-24 09:59 周磊 閱讀(3359) | 評(píng)論 (0)編輯 收藏
    十進(jìn)制轉(zhuǎn)成十六進(jìn)制: 
    Integer.toHexString(int i) 
    十進(jìn)制轉(zhuǎn)成八進(jìn)制 
    Integer.toOctalString(int i) 
    十進(jìn)制轉(zhuǎn)成二進(jìn)制 
    Integer.toBinaryString(int i) 
    十六進(jìn)制轉(zhuǎn)成十進(jìn)制 
    Integer.valueOf("FFFF",16).toString() 
    八進(jìn)制轉(zhuǎn)成十進(jìn)制 
    Integer.valueOf("876",8).toString() 
    二進(jìn)制轉(zhuǎn)十進(jìn)制 
    Integer.valueOf("0101",2).toString() 

    有什么方法可以直接將2,8,16進(jìn)制直接轉(zhuǎn)換為10進(jìn)制的嗎? 
    java.lang.Integer類 
    parseInt(String s, int radix) 
    使用第二個(gè)參數(shù)指定的基數(shù),將字符串參數(shù)解析為有符號(hào)的整數(shù)。 
    examples from jdk: 
    parseInt("0", 10) returns 0 
    parseInt("473", 10) returns 473 
    parseInt("-0", 10) returns 0 
    parseInt("-FF", 16) returns -255 
    parseInt("1100110", 2) returns 102 
    parseInt("2147483647", 10) returns 2147483647 
    parseInt("-2147483648", 10) returns -2147483648 
    parseInt("2147483648", 10) throws a NumberFormatException 
    parseInt("99", throws a NumberFormatException 
    parseInt("Kona", 10) throws a NumberFormatException 
    parseInt("Kona", 27) returns 411787 

    進(jìn)制轉(zhuǎn)換如何寫(二,八,十六)不用算法 
    Integer.toBinaryString 
    Integer.toOctalString 
    Integer.toHexString 


    例二 

    public class Test{ 
       public static void main(String args[]){ 

        int i=100; 
        String binStr=Integer.toBinaryString(i); 
        String otcStr=Integer.toOctalString(i); 
        String hexStr=Integer.toHexString(i); 
        System.out.println(binStr); 





    例二 
    public class TestStringFormat { 
       public static void main(String[] args) { 
        if (args.length == 0) { 
           System.out.println("usage: java TestStringFormat <a number>"); 
           System.exit(0); 
        } 

        Integer factor = Integer.valueOf(args[0]); 

        String s; 

        s = String.format("%d", factor); 
        System.out.println(s); 
        s = String.format("%x", factor); 
        System.out.println(s); 
        s = String.format("%o", factor); 
        System.out.println(s); 
       } 




    其他方法: 

    Integer.toHexString(你的10進(jìn)制數(shù)); 
    例如 
    String temp = Integer.toHexString(75); 
    輸出temp就為 4b 



    //輸入一個(gè)10進(jìn)制數(shù)字并把它轉(zhuǎn)換成16進(jìn)制 
    import java.io.*; 
    public class toHex{ 

    public static void main(String[]args){ 

    int input;//存放輸入數(shù)據(jù) 
    //創(chuàng)建輸入字符串的實(shí)例 
    BufferedReader strin=new BufferedReader(new InputStreamReader(System.in)); 
    System.out.println("請(qǐng)輸入一個(gè)的整數(shù):"); 
    String x=null; 
    try{ 
    x=strin.readLine(); 
    }catch(IOException ex){ 
    ex.printStackTrace(); 

    input=Integer.parseInt(x); 
    System.out.println ("你輸入的數(shù)字是:"+input);//輸出從鍵盤接收到的數(shù)字 

    System.out.println ("它的16進(jìn)制是:"+Integer.toHexString(input));//用toHexString把10進(jìn)制轉(zhuǎn)換成16進(jìn)制 
    posted @ 2012-04-29 12:10 周磊 閱讀(3168) | 評(píng)論 (0)編輯 收藏
    http://linbin007.iteye.com/blog/809759
    -noverify 
    -javaagent:D:/jrebel.jar
    -Drebel.dirs=E:\workspace\WantWant\webapp\WEB-INF\classes
    posted @ 2012-03-26 15:27 周磊 閱讀(809) | 評(píng)論 (0)編輯 收藏

    Class search path

    The default ClassPool returned by a static method ClassPool.getDefault() searches the same path that the underlying JVM (Java virtual machine) has. If a program is running on a web application server such as JBoss and Tomcat, the ClassPool object may not be able to find user classes since such a web application server uses multiple class loaders as well as the system class loader. In that case, an additional class path must be registered to the ClassPool. Suppose that pool refers to aClassPool object:

      pool.insertClassPath(new ClassClassPath(this.getClass())); 

    This statement registers the class path that was used for loading the class of the object that this refers to. You can use any Class object as an argument instead ofthis.getClass(). The class path used for loading the class represented by that Class object is registered.

    You can register a directory name as the class search path. For example, the following code adds a directory /usr/local/javalib to the search path:

      ClassPool pool = ClassPool.getDefault(); pool.insertClassPath("/usr/local/javalib"); 

    The search path that the users can add is not only a directory but also a URL:

      ClassPool pool = ClassPool.getDefault(); ClassPath cp = new URLClassPath("www.javassist.org", 80, "/java/", "org.javassist."); pool.insertClassPath(cp); 

    This program adds "http://www.javassist.org:80/java/" to the class search path. This URL is used only for searching classes belonging to a package org.javassist. For example, to load a class org.javassist.test.Main, its class file will be obtained from:

      http://www.javassist.org:80/java/org/javassist/test/Main.class 

    Furthermore, you can directly give a byte array to a ClassPool object and construct a CtClass object from that array. To do this, use ByteArrayClassPath. For example,

      ClassPool cp = ClassPool.getDefault(); byte[] b = a byte array; String name = class name; cp.insertClassPath(new ByteArrayClassPath(name, b)); CtClass cc = cp.get(name); 

    The obtained CtClass object represents a class defined by the class file specified by b. The ClassPool reads a class file from the given ByteArrayClassPath if get() is called and the class name given to get() is equal to one specified by name.

    If you do not know the fully-qualified name of the class, then you can use makeClass() in ClassPool:

      ClassPool cp = ClassPool.getDefault(); InputStream ins = an input stream for reading a class file; CtClass cc = cp.makeClass(ins); 

    makeClass() returns the CtClass object constructed from the given input stream. You can use makeClass() for eagerly feeding class files to the ClassPool object. This might improve performance if the search path includes a large jar file. Since a ClassPool object reads a class file on demand, it might repeatedly search the whole jar file for every class file. makeClass() can be used for optimizing this search. The CtClass constructed by makeClass() is kept in the ClassPool object and the class file is never read again.

    The users can extend the class search path. They can define a new class implementing ClassPath interface and give an instance of that class to insertClassPath() inClassPool. This allows a non-standard resource to be included in the search path.





    package com.cloud.dm.util;

    import java.io.File;
    import java.lang.reflect.Field;
    import java.net.URL;
    import java.util.ArrayList;
    import java.util.List;

    import javassist.ClassClassPath;
    import javassist.ClassPool;
    import javassist.CtClass;
    import javassist.CtMethod;
    import javassist.CtNewMethod;
    import javassist.bytecode.DuplicateMemberException;

    import org.apache.commons.lang3.StringUtils;

    public class Struts2GetterSetterGen {
        private static ClassPool pool = ClassPool.getDefault();

        public static void init() throws Exception {
            URL url = Struts2GetterSetterGen.class.getResource("/");
            List<File> resultList = new ArrayList<File>();
            FileSearcher.findFiles(url.getFile(), "*Action.class", resultList);
            for (File object : resultList) {
                String className = StringUtils.substringBetween(object.toString(),
                        "classes\\", ".class").replaceAll("\\\\", ".");
                CtClass ct = null;
                pool.insertClassPath(new ClassClassPath(Class.forName(className))); //在servlet容器中啟動(dòng)
                ct = pool.get(className);
                Field[] fs = Class.forName(className).getDeclaredFields();
                for (Field f : fs) {
                    genGetter(ct, f);
                    genSetter(ct, f);
                }
                ct.writeFile(url.getPath()); // 覆蓋之前的class文件
            }
        }

        private static void genGetter(CtClass ct, Field field) throws Exception {
            String string = "public " + field.getType().getName() + " get"
                    + StringUtils.capitalize(field.getName()) + "() {return "
                    + field.getName() + "; }";
            CtMethod m = CtNewMethod.make(string, ct);
            try {
                ct.addMethod(m);
            } catch (DuplicateMemberException e) {
            }
        }

        private static void genSetter(CtClass ct, Field field) throws Exception {
            String string = "public void set"
                    + StringUtils.capitalize(field.getName()) + "("
                    + field.getType().getName() + " " + field.getName() + "){this."
                    + field.getName() + " = " + field.getName() + "; }";
            CtMethod m = CtNewMethod.make(string, ct);
            try {
                ct.addMethod(m);
            } catch (DuplicateMemberException e) {
            }
        }
    }


    posted @ 2012-03-22 15:22 周磊 閱讀(4139) | 評(píng)論 (0)編輯 收藏
    http://www.ibm.com/developerworks/cn/opensource/os-cn-spring-jpa/index.html
    posted @ 2012-03-19 09:55 周磊 閱讀(336) | 評(píng)論 (0)編輯 收藏
    主站蜘蛛池模板: 久久久精品国产亚洲成人满18免费网站 | 破了亲妺妺的处免费视频国产| 四虎永久在线精品免费观看视频| 一级特级女人18毛片免费视频| 亚洲欧美第一成人网站7777 | 亚洲a∨国产av综合av下载| 亚洲妇女熟BBW| 亚洲性无码AV中文字幕| 亚洲精品无码日韩国产不卡av| 亚洲欧美熟妇综合久久久久| 亚洲欧美中文日韩视频| 野花视频在线官网免费1| 亚洲欧洲久久av| 中国亚洲女人69内射少妇| 亚洲精品无码久久久久sm| 老司机永久免费网站在线观看| 日韩免费视频播播| 亚洲精品一级无码中文字幕| 久久夜色精品国产亚洲av| 亚洲AV永久青草无码精品| 久久久久亚洲AV成人无码网站| 亚洲黄网在线观看| 最新亚洲成av人免费看| 亚洲av无码国产精品夜色午夜 | 亚洲人成网77777亚洲色| 亚洲国产精品无码久久久不卡 | 免费看美女被靠到爽的视频| 国产免费av一区二区三区| 亚洲另类少妇17p| 亚洲av无码国产精品色午夜字幕| 久久亚洲日韩看片无码| 亚洲中文字幕无码中文字| 黄页网站在线视频免费| 日本视频免费高清一本18| 国产亚洲视频在线观看网址| www免费黄色网| 一级女人18毛片免费| 免费人成在线观看网站视频| 亚洲精品午夜无码电影网| 亚洲免费在线视频播放| 看Aⅴ免费毛片手机播放|