??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品美女www爽爽爽,91精品国产自产在线观看永久∴,精品成人一区二区三区四区http://www.aygfsteel.com/yidinghe/archive/2012/11/10/391147.html捏造的信Ԓ捏造的信ԒSat, 10 Nov 2012 11:18:00 GMThttp://www.aygfsteel.com/yidinghe/archive/2012/11/10/391147.htmlhttp://www.aygfsteel.com/yidinghe/comments/391147.htmlhttp://www.aygfsteel.com/yidinghe/archive/2012/11/10/391147.html#Feedback0http://www.aygfsteel.com/yidinghe/comments/commentRss/391147.htmlhttp://www.aygfsteel.com/yidinghe/services/trackbacks/391147.html
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ClientConnectionOperator;
import org.apache.http.conn.DnsResolver;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.BasicClientConnectionManager;
import org.apache.http.impl.conn.DefaultClientConnectionOperator;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;

/**
 * ?nbsp;httpclient 4.2 中用自定义?nbsp;DNS 解析
 
*/
public class CustomDnsResolverDemo {

    public static void main(String[] args) throws Exception {

        // 创徏自定义的 ConnectionManager
        BasicClientConnectionManager connectionManager = new BasicClientConnectionManager() {

            @Override
            protected ClientConnectionOperator createConnectionOperator(SchemeRegistry schreg) {
                return new DefaultClientConnectionOperator(schreg, new MyDnsResolver());
            }
        };

        // 创徏 HttpClient 对象
        DefaultHttpClient httpclient = new DefaultHttpClient(connectionManager);

        // 构造请?/span>
        HttpGet httpget = new HttpGet("https://www.google.com/");
        System.out.println(httpget.getRequestLine());

        // 发送请求ƈq回l果
        HttpResponse response = httpclient.execute(httpget);
        System.out.println(response.getEntity().getContentType());
        System.out.println(response.getStatusLine());

        // q句不是必须的,只是让程序结束更快点
        httpclient.getConnectionManager().shutdown();
    }

    // 自定义的 DNS 解析c?/span>
    private static class MyDnsResolver implements DnsResolver {

        private static final Map<String, InetAddress[]> MAPPINGS = new HashMap<String, InetAddress[]>();

        static {
            addResolve("www.google.com", "74.125.134.138");
        }

        private static void addResolve(String host, String ip) {
            try {
                MAPPINGS.put(host, new InetAddress[]{InetAddress.getByName(ip)});
            } catch (UnknownHostException e) {
                e.printStackTrace();
            }
        }

        @Override
        public InetAddress[] resolve(String host) throws UnknownHostException {
            return MAPPINGS.containsKey(host) ? MAPPINGS.get(host) : new InetAddress[0];
        }
    }
}


捏造的信Ԓ 2012-11-10 19:18 发表评论
]]>
JavaCZQ如何执行进Eƈd输出http://www.aygfsteel.com/yidinghe/archive/2012/10/26/390296.html捏造的信Ԓ捏造的信ԒFri, 26 Oct 2012 12:14:00 GMThttp://www.aygfsteel.com/yidinghe/archive/2012/10/26/390296.htmlhttp://www.aygfsteel.com/yidinghe/comments/390296.htmlhttp://www.aygfsteel.com/yidinghe/archive/2012/10/26/390296.html#Feedback0http://www.aygfsteel.com/yidinghe/comments/commentRss/390296.htmlhttp://www.aygfsteel.com/yidinghe/services/trackbacks/390296.html阅读全文

捏造的信Ԓ 2012-10-26 20:14 发表评论
]]>
如何提高开发效率(3Q?/title><link>http://www.aygfsteel.com/yidinghe/archive/2012/09/25/388533.html</link><dc:creator>捏造的信Ԓ</dc:creator><author>捏造的信Ԓ</author><pubDate>Tue, 25 Sep 2012 12:23:00 GMT</pubDate><guid>http://www.aygfsteel.com/yidinghe/archive/2012/09/25/388533.html</guid><wfw:comment>http://www.aygfsteel.com/yidinghe/comments/388533.html</wfw:comment><comments>http://www.aygfsteel.com/yidinghe/archive/2012/09/25/388533.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/yidinghe/comments/commentRss/388533.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/yidinghe/services/trackbacks/388533.html</trackback:ping><description><![CDATA[本文介绍如何更加L的编写代码?br /> <br /> Z么有的代码写h让h头昏脑胀呢?是因ؓ逻辑太复杂。逻辑的复杂无非体现在两个斚wQ要么是步骤太长Q要么是条g分支Q也是需要考虑?#8220;<span style="font-family: verdana, 'courier new'; ">例外情况</span> <br /> ”Q太多?br /> <br /> Z处理复杂的事情,向来有一套方法,叫分而治之,它完全可以用在开发上?br /> <br /> 使用分而治之的方式~写代码Q好处就是关注点减少了。把一个长的步骤分成若q个短小的步骤,那么你每ơ只需要关注其中的一步就可以了;把一pd复杂的判断交l不同的对象L理,那么你的思维又可以回C程上来。关注点减少的结果,一斚w降低了出错的可能Q另一斚w不会令hl尽脑汁弄得w心疲惫?br /> <br /> 如何对复杂的逻辑分而治之呢Q就本h的开发经验,我觉得有两点很重要:<br /> <br /> <strong>1、关注顶层逻辑</strong><br /> MҎ都只应该体现光层逻辑。比如用L录的层逻辑Q只有三个步骤:1Q检查参数格式;2Q处理逻辑Q?Q返回结果?br /><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all; "><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">boolean</span> login(String username, String password) {<br />    <span style="color: #0000FF; ">if</span> (!checkParameters(username, password) {<br />        <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">false</span>;<br />    }<br />    <br />    <span style="color: #0000FF; ">boolean</span> result = checkUserPassword(username, password);<br />    <br />    <span style="color: #0000FF; ">return</span> result;<br />}</div>q是层逻辑Q将q三句话写好之后Q我们再分别d现每个步骤,而每个步骤当中又只包含顶层逻辑。这样做有效的减了x点,让代码写h更加L?br /><br /><strong>2、职责分?/strong><br />我们生活在一个分工精l的C会QQ何事情都能(臛_在名义上Q找到相应的人对其负责。业务逻辑也是一P字符串的处理、XML的解析、连接的打开关闭、日期时间的校验Q这些逻辑都应该交l相应的cd处理Q不要一H蜂的都写在一个方法里面,q样写出来的东西是一团ؕ麻,写了一半可能你自己都不知道写到哪了?br /><br />我觉得只要做C面这两点Q面对Q何复杂的逻辑都可以轻村֯付,而且不易出错——你可以想象当别h埋头苦干的时候,你却在一边轻杄听歌喝咖啡了~~<br /><img src ="http://www.aygfsteel.com/yidinghe/aggbug/388533.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/yidinghe/" target="_blank">捏造的信Ԓ</a> 2012-09-25 20:23 <a href="http://www.aygfsteel.com/yidinghe/archive/2012/09/25/388533.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何提高开发效率(2Q?/title><link>http://www.aygfsteel.com/yidinghe/archive/2012/09/21/388246.html</link><dc:creator>捏造的信Ԓ</dc:creator><author>捏造的信Ԓ</author><pubDate>Fri, 21 Sep 2012 05:09:00 GMT</pubDate><guid>http://www.aygfsteel.com/yidinghe/archive/2012/09/21/388246.html</guid><wfw:comment>http://www.aygfsteel.com/yidinghe/comments/388246.html</wfw:comment><comments>http://www.aygfsteel.com/yidinghe/archive/2012/09/21/388246.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/yidinghe/comments/commentRss/388246.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/yidinghe/services/trackbacks/388246.html</trackback:ping><description><![CDATA[本文介绍如何更加L的阅M码?br /><br />有h会说Q阅M码是否轻松,取决于代码的可读性吧。是的,而且请不要误会,本文不是要介l编码规范。不代码本w的可读性如何,你都可以扑ֈ更好的手D去帮助阅读。下面是几个可供参考的Q?br /><br />1、用丰富的颜色区分类型、成员、方法、变量、参数等{。例如下面两张图片,你觉得哪个阅读v来更L呢?<br /><img src="http://www.aygfsteel.com/images/blogjava_net/yidinghe/囄2.png" border="1" alt="" width="284" height="121" /><img src="http://www.aygfsteel.com/images/blogjava_net/yidinghe/囄1.png" border="1" alt="" width="295" height="110" /><br />颜色的区分不仅仅是ؓ了好看,颜色多Q代码展C的信息p丰富。特别是当有时候变量名U覆盖了成员名称的时候,一眼就能看出来?br /><br />2、适当用空行将逻辑隔开。在下面的例子中Q第一D늚代码没有使用IQ看h比较凌ؕQ第二段代码只是加了几个IQ逻辑马上变得清晰hQ有利于阅读?br /><img src="http://www.aygfsteel.com/images/blogjava_net/yidinghe/囄3.png" border="1" alt="" width="319" height="220" /><img src="http://www.aygfsteel.com/images/blogjava_net/yidinghe/囄4.png" border="1" alt="" width="322" height="270" /><br /><br />3、ؓ逻辑区块d注释。有好的代码不需要注释,但一斚w好的代码太少Q另一斚wp不是我们母语Q所以适当的加上注释是有必要的?br /><img src="http://www.aygfsteel.com/images/blogjava_net/yidinghe/囄5.png" border="0" alt="" width="387" height="277" /><br />上面的代码没有加注释Q虽焉辑做了一定的整理Q但要看懂还是不Ҏ?br /><img src="http://www.aygfsteel.com/images/blogjava_net/yidinghe/囄6.png" border="0" alt="" width="365" height="307" /><br />加了注释之后Q看h更轻松了?br /><br />另外Q如果代码当中的变量命名晦ӆQ可以用重构的方式对变量重命名,以方侉K诅R?img src ="http://www.aygfsteel.com/yidinghe/aggbug/388246.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/yidinghe/" target="_blank">捏造的信Ԓ</a> 2012-09-21 13:09 <a href="http://www.aygfsteel.com/yidinghe/archive/2012/09/21/388246.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何提高开发效率(1Q?/title><link>http://www.aygfsteel.com/yidinghe/archive/2012/09/19/388102.html</link><dc:creator>捏造的信Ԓ</dc:creator><author>捏造的信Ԓ</author><pubDate>Wed, 19 Sep 2012 15:06:00 GMT</pubDate><guid>http://www.aygfsteel.com/yidinghe/archive/2012/09/19/388102.html</guid><wfw:comment>http://www.aygfsteel.com/yidinghe/comments/388102.html</wfw:comment><comments>http://www.aygfsteel.com/yidinghe/archive/2012/09/19/388102.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/yidinghe/comments/commentRss/388102.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/yidinghe/services/trackbacks/388102.html</trackback:ping><description><![CDATA[q里所说的“提高开发效?#8221;不是指在相同的时间内做更多的事情Q而是Q?br /><span style="color: red; ">用更的脑力完成同样多的事情?br /><br /></span>Z么要用更的脑力完成同样多的事情Q因Z个h的脑力劳动同体力力_一P力_强度高Q能够坚持的旉少Qh觉得疲惫?br /><br />x一天只?4时Q除?时睡眠Q?时工作Q花在自己和家h上的旉最多也?时Q这q是很理想的情况Q。如果工作很累的话,你还有多精力留l自己和家hQ?br /><br />作ؓ开发h员,我们p_֊的事情无非就是三个:阅读代码Q编写代码,q行代码。在q三件事情上减少脑力负担可以令工作更L。我希望能通过一pd文章帮助大家用更的脑力阅读、编写和q行代码?br /><br />不过在这之前Q有一件Q务必d完成Q那是Q优化工作环境?br /><br />你的工作环境有多大的优化余地Q请试考虑一下下面的问题Q?br /><div><ul><li>你的椅子q高q是q低Q?/li><li>脖子、肩膀、腰和手腕是否酸痛?</li><li>你的周围环境是否q于嘈杂Q?/li><li>你桌面上的物件是整洁的还是凌qQ?/li><li>你的鼠标是否不灵Q?/li><li>你的昄屏上是否有层灎ͼ</li><li>你的W记本是否热到让你不敢把手放在键盘上Q?/li><li>你的内存是否够用Q?br /></li><li>你的盘是否_快?</li></ul></div><div>q些斚w都应该尽可能的做调整Q不要让q些l枝末节打断你工作中的思\?br /><br />比如说硬盘不够快的问题,如果你用 Windows 7Q那么它?ReadyBoost Ҏ应该好好利用,它可以加快读取文件的速度。要知道 Java IDE 通常都是非常大的Q每ơ打开来要d半天。当插上一?U 盘ƈ其用于 ReadyBoost 之后Q不是打开目q是~译q行Q速度都会加快很多。你惌q打开 Word 文档像打开C本一样快吗?<br /><br />我将在接下来的文章中介绍如何用更的脑力阅读、编写和q行代码?/div><img src ="http://www.aygfsteel.com/yidinghe/aggbug/388102.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/yidinghe/" target="_blank">捏造的信Ԓ</a> 2012-09-19 23:06 <a href="http://www.aygfsteel.com/yidinghe/archive/2012/09/19/388102.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">ˮ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ƕ</a>| <a href="http://" target="_blank">ƽң</a>| <a href="http://" target="_blank">ʡ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">С</a>| <a href="http://" target="_blank">ݳ</a>| <a href="http://" target="_blank">Ȫ</a>| <a href="http://" target="_blank">Ĵʡ</a>| <a href="http://" target="_blank">ء</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˲</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˷</a>| <a href="http://" target="_blank">ʡ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ͨ</a>| <a href="http://" target="_blank">Ӣɳ</a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>