<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 周磊 閱讀(296) | 評論 (0)編輯 收藏
    再看看<effective java> ,對前半年寫的代碼進行一下反思
    慢慢看《Hadoop實戰中文版》,了解分布式系統
    認真閱讀《設計模式之禪》,加深對自己已經在實際項目中運用的模式的理解。
    閱讀《java解惑》的后半部分(2年前讀過前幾十條建議),了解編碼中的陷阱。
    posted @ 2012-06-29 15:07 周磊 閱讀(291) | 評論 (0)編輯 收藏

    State of the Lambda

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

    jdk快點出吧lambdba把,一直用op4j和lambdbaj這些jar包很蛋疼。。
    posted @ 2012-06-27 11:47 周磊 閱讀(314) | 評論 (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 周磊 閱讀(3361) | 評論 (0)編輯 收藏
    十進制轉成十六進制: 
    Integer.toHexString(int i) 
    十進制轉成八進制 
    Integer.toOctalString(int i) 
    十進制轉成二進制 
    Integer.toBinaryString(int i) 
    十六進制轉成十進制 
    Integer.valueOf("FFFF",16).toString() 
    八進制轉成十進制 
    Integer.valueOf("876",8).toString() 
    二進制轉十進制 
    Integer.valueOf("0101",2).toString() 

    有什么方法可以直接將2,8,16進制直接轉換為10進制的嗎? 
    java.lang.Integer類 
    parseInt(String s, int radix) 
    使用第二個參數指定的基數,將字符串參數解析為有符號的整數。 
    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 

    進制轉換如何寫(二,八,十六)不用算法 
    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進制數); 
    例如 
    String temp = Integer.toHexString(75); 
    輸出temp就為 4b 



    //輸入一個10進制數字并把它轉換成16進制 
    import java.io.*; 
    public class toHex{ 

    public static void main(String[]args){ 

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

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

    System.out.println ("它的16進制是:"+Integer.toHexString(input));//用toHexString把10進制轉換成16進制 
    posted @ 2012-04-29 12:10 周磊 閱讀(3170) | 評論 (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 周磊 閱讀(811) | 評論 (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容器中啟動
                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 周磊 閱讀(4141) | 評論 (0)編輯 收藏
    http://www.ibm.com/developerworks/cn/opensource/os-cn-spring-jpa/index.html
    posted @ 2012-03-19 09:55 周磊 閱讀(336) | 評論 (0)編輯 收藏


    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/xxx


    META-INF下需要有這兩個文件:spring-handlers及spring-schemas

    posted @ 2012-03-15 15:21 周磊 閱讀(5868) | 評論 (0)編輯 收藏
     1 package com.cloud.dm;
     2 
     3 import java.util.Collections;
     4 import java.util.Comparator;
     5 import java.util.List;
     6 import java.util.Map;
     7 
     8 import com.google.common.collect.Lists;
     9 import com.google.common.collect.Maps;
    10 
    11 public class TreeListTest {
    12     public static void main(String[] args) {
    13         List<Map<String, Object>> list = Lists.newArrayList();
    14         Map<String, Object> map = Maps.newHashMap();
    15         map.put("key", 201101);
    16         Map<String, Object> map2 = Maps.newHashMap();
    17         map2.put("key", 200010);
    18         Map<String, Object> map3 = Maps.newHashMap();
    19         map3.put("key", 201103);
    20         list.add(map);
    21         list.add(map2);
    22         list.add(map3);
    23         System.out.println(list);
    24         Collections.sort(list, new Comparator<Map<String, Object>>() {
    25             @Override
    26             public int compare(Map<String, Object> o1, Map<String, Object> o2) {
    27                 System.out.println(o1.get("key").toString().compareTo(o2.get("key").toString()));
    28                 return o1.get("key").toString().compareTo(o2.get("key").toString());
    29             }
    30         });
    31         System.out.println(list);
    32     }
    33 }
    34 
    posted @ 2012-03-13 18:13 周磊 閱讀(1447) | 評論 (0)編輯 收藏
         摘要: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> 1         <dl>  2  &nbs...  閱讀全文
    posted @ 2012-03-04 17:33 周磊 閱讀(2935) | 評論 (0)編輯 收藏
    org.apache.shiro.web.filter.mgt.DefaultFilter
    默認的內置攔截器
        anon(AnonymousFilter.class),
        authc(FormAuthenticationFilter.class),
        authcBasic(BasicHttpAuthenticationFilter.class),
        logout(LogoutFilter.class),
        noSessionCreation(NoSessionCreationFilter.class),
        perms(PermissionsAuthorizationFilter.class),
        port(PortFilter.class),
        rest(HttpMethodPermissionFilter.class),
        roles(RolesAuthorizationFilter.class),
        ssl(SslFilter.class),
        user(UserFilter.class);

      anno 允許匿名訪問,

    Filter that allows access to a path immeidately without performing security checks of any kind.

    This filter is useful primarily in exclusionary policies, where you have defined a url pattern to require a certain security level, but maybe only subset of urls in that pattern should allow any access.

    For example, if you had a user-only section of a website, you might want to require that access to any url in that section must be from an authenticated user.

    Here is how that would look in the IniShiroFilter configuration:

    [urls]
    /user/** = authc

    But if you wanted /user/signup/** to be available to anyone, you have to exclude that path since it is a subset of the first. This is where the AnonymousFilter ('anon') is useful:

    [urls]
    /user/signup/** = anon
    /user/** = authc
    >

    Since the url pattern definitions follow a 'first match wins' paradigm, the anon filter will match the /user/signup/** paths and the /user/** path chain will not be evaluated.

    posted @ 2012-03-03 23:52 周磊 閱讀(987) | 評論 (0)編輯 收藏
     

    Shiro框架Web環境下過濾器結構分析

    posted @ 2012-03-01 11:52 周磊 閱讀(151) | 評論 (0)編輯 收藏
    1 strtus2無法加載jar中的注解配置的action
    2 spring3.1的cache標簽報空值錯誤
    posted @ 2012-02-28 23:27 周磊 閱讀(157) | 評論 (0)編輯 收藏

    介紹 Spring 3.1 M1 中的緩存功能- 中文版 (轉)

    posted @ 2012-02-27 10:29 周磊 閱讀(116) | 評論 (0)編輯 收藏
    最簡單的一招是刪除"c:/windows/java.exe",win7是在system32目錄下,這樣就可以修復了
    如果不行繼續刪除
    javaw.exe和javaws.exe


    posted @ 2012-02-26 13:08 周磊 閱讀(452) | 評論 (0)編輯 收藏

    http://blog.csdn.net/luotangsha/article/details/7016613

    http://www.cnblogs.com/freeliver54/archive/2011/12/30/2307129.html

    posted @ 2012-02-10 18:11 周磊 閱讀(873) | 評論 (0)編輯 收藏
    http://jautodoc.sourceforge.net/
    posted @ 2012-02-10 15:06 周磊 閱讀(197) | 評論 (0)編輯 收藏
    org.ralasafe.servlet.UserTypeInstallAction
    org.ralasafe.servlet.RalasafeController
    posted @ 2012-02-10 11:14 周磊 閱讀(133) | 評論 (0)編輯 收藏


    http://www.hitb.com.cn/web/guest/bbs/-/message_boards/message/13822
    posted @ 2012-02-09 19:52 周磊 閱讀(172) | 評論 (0)編輯 收藏
    SHOW VARIABLES LIKE '%char%'

    http://database.ctocio.com.cn/82/12161582.shtml
    posted @ 2012-02-09 15:49 周磊 閱讀(157) | 評論 (0)編輯 收藏
    主站蜘蛛池模板: 暖暖免费中文在线日本| 香港a毛片免费观看| 国产亚洲成AV人片在线观黄桃 | 国产成人无码免费网站| 亚洲国产日韩在线视频| 成视频年人黄网站免费视频| 国产亚洲视频在线| 久久亚洲日韩精品一区二区三区| 免费看的黄色大片| 国产在线精品免费aaa片| 亚洲国产最大av| 亚洲无人区一区二区三区| 最新仑乱免费视频| 在线观看黄片免费入口不卡| 亚洲熟女综合一区二区三区| 亚洲无人区一区二区三区| 免费a级毛片高清视频不卡| 免费无码H肉动漫在线观看麻豆| 亚洲日日做天天做日日谢| 久久精品视频亚洲| 免费大香伊蕉在人线国产| 9277手机在线视频观看免费| 老司机午夜免费视频| 亚洲制服在线观看| 亚洲av之男人的天堂网站| 波多野结衣中文一区二区免费| 99久久免费观看| 一个人看www免费高清字幕| 亚洲一区二区三区成人网站| 亚洲AV无码乱码国产麻豆穿越| 国产一区二区三区免费看| 色老头永久免费网站| 中文在线观看免费网站| 在线观看亚洲精品专区| 456亚洲人成影院在线观| 亚洲va久久久噜噜噜久久男同| 免费午夜爽爽爽WWW视频十八禁| 99热在线精品免费全部my| 无码日韩精品一区二区三区免费| 永久免费无码网站在线观看个| 亚洲国产成人手机在线观看|