??xml version="1.0" encoding="utf-8" standalone="yes"?>日本精品视频一区二区三区,亚洲色图视频网,在线一级视频http://www.aygfsteel.com/oathleo/category/30445.html呆在上vzh-cnTue, 24 Sep 2013 22:40:21 GMTTue, 24 Sep 2013 22:40:21 GMT60java整型C|络字节序的 byte[] 数组转换关系http://www.aygfsteel.com/oathleo/archive/2013/09/23/404305.htmloathleooathleoMon, 23 Sep 2013 02:02:00 GMThttp://www.aygfsteel.com/oathleo/archive/2013/09/23/404305.htmlhttp://www.aygfsteel.com/oathleo/comments/404305.htmlhttp://www.aygfsteel.com/oathleo/archive/2013/09/23/404305.html#Feedback0http://www.aygfsteel.com/oathleo/comments/commentRss/404305.htmlhttp://www.aygfsteel.com/oathleo/services/trackbacks/404305.html阅读全文

oathleo 2013-09-23 10:02 发表评论
]]>
URL问题 ?/title><link>http://www.aygfsteel.com/oathleo/archive/2013/05/27/399830.html</link><dc:creator>oathleo</dc:creator><author>oathleo</author><pubDate>Mon, 27 May 2013 09:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/oathleo/archive/2013/05/27/399830.html</guid><wfw:comment>http://www.aygfsteel.com/oathleo/comments/399830.html</wfw:comment><comments>http://www.aygfsteel.com/oathleo/archive/2013/05/27/399830.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/oathleo/comments/commentRss/399830.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/oathleo/services/trackbacks/399830.html</trackback:ping><description><![CDATA[<p style="margin-right: 0px; margin-left: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #444444; font-size: 13px; font-family: 微Y雅黑, Verdana; background-color: #ffffff;">Java路径中的I格问题<br />1?URLTest.class.getResource("/").getPath();<br />    URLTest.class.getResource("/").getFile();<br />    URLTest.class.getClassLoader().getResource("").getPath();<br />    Thread.currentThread().getContextClassLoader().getResource("").getPath();{多U相似方式获得的路径Q不能被FileReader()和FileWriter()直接应用Q原因是URL对空|Ҏ(gu)字符(%,#,[]{?和中文进行了~码处理。如果文件中URLTest.class.getResource("/").getPath();必须?/"开头然后再加文件名Q而URLTest.class.getClassLoader().getResource("").getPath();不用?/"可以直接d文g名?/p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #444444; font-size: 13px; font-family: 微Y雅黑, Verdana; background-color: #ffffff;">路径中包含空格时Q如果空格变?%20"有如下处理方法:(x)<br />1)使用repaceAll("%20",' ')替换Q但只能解决I格问题Q如果\径中包含其他Ҏ(gu)字符和中文就不能解决问题?br />2)使用URLDecoder.decode(str,"UTF-8")解码Q但是只能解决一部分Q若路径中含?Q也是不能解决的Q原因是URLq不是完全用URLEncoder.encode(str,"UTF-8")~码?+可解码后,则变成空根{?br />3)解决所有的问题,用URLTest.class.getClassLoader().getResource("").toURI().getPath();Q但是需要处理URISyntaxException异常Q比较麻烦一些?/p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #444444; font-size: 13px; font-family: 微Y雅黑, Verdana; background-color: #ffffff;">2、new URL();的参数可以ؓ(f)正确的URIQ或者ؓ(f)URI格式的字W串Q若字符串是非完整的URI格式Q则创徏p|。java.net.URIq回的\径中的空g“I格”的Ş式出现方法ؓ(f)Thread.currentThread().getContextClassLoader().getResource("").toURI().getPath();但是Thread.currentThread().getContextClassLoader().getResource("").toURI().toString();则会(x)?#8220;%20”的Ş式出现。java.net.URLq回的一切\径中的空格都是以“%20”的Ş式出现。URL/URIq回的\径分隔符都是“/”(控制台输?/")?/p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #444444; font-size: 13px; font-family: 微Y雅黑, Verdana; background-color: #ffffff;"><br />3、new File(String filePath);接受正确URI格式的参数和?#8220;I格”Q非%20Q的正确相对/l对字符串\径,否则即ɾl的路径是正的也会(x)出现找不到文件的异常。Fileq回的\径分隔符都ؓ(f)“\”(控制台输?\")Q对于存在的文gq回的\径字W串Q空格都?I格"出现Q而不存在的\径new出的fileQgetPathQ)q回的\径中的空|仍是new File(String filePath)的参C原有的Ş式,卌filePath中是I格的getPathQ)q回的仍是空|?#8220;%20”的仍?#8220;%20”。File.toURI() ?x)将file的\径名中的“I格”转化?#8220;%20”Q然后在路径前加protocolQ?file:/"Q而File.toURL()只会(x)在file路径 前简单的加上protocolQ?file:/"Q而不?x)?#8220;I格”转化?#8220;%20”Q原来的无论?#8220;I格”q是“%20”都只?x)原样保留?/p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #444444; font-size: 13px; font-family: 微Y雅黑, Verdana; background-color: #ffffff;"><br />实际使用中遇到的问题ȝ如下Q?br />1、相对\?即相对于当前用户目录的相对\?均可通过以下方式获得Q不论是一般的java目q是web目Q?String relativelyPath=System.getProperty("user.dir"); 对于一般的java目中的文g是相对于目的根目录Q而对于web目中的文g路径Q可能是服务器的某个路径Q同时不同的web服务器也不同 Qtomcat是相对于 tomcat安装目录\binQ。ؓ(f)此,个h认ؓ(f)Q在web目中,最好不要?#8220;相对于当前用L(fng)录的相对路径”。然而默认情况下Qjava.io 包中的类LҎ(gu)当前用户目录来分析相对\径名。此目录ql属?user.dir 指定Q通常?Java 虚拟机的调用目录。这是_(d)在用java.io包中的类Ӟ最好不要用相对\径。否则,虽然在SEE序中可能还正常,但是CEEE序中,可能?x)出现问题?/p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #444444; font-size: 13px; font-family: 微Y雅黑, Verdana; background-color: #ffffff;">2、web目根目录获?br />1)建立一个servlet,在其init()Ҏ(gu)中添加如下代?br />ServletContext context = this.getServletContext(); <br />String strs = context.getRealPath("/"); <br />2Q利用httpServletRequestQ得到相应的目路径<br />String pathUrl = request.getSession().getServletContext().getRealPath("/");</p><img src ="http://www.aygfsteel.com/oathleo/aggbug/399830.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/oathleo/" target="_blank">oathleo</a> 2013-05-27 17:00 <a href="http://www.aygfsteel.com/oathleo/archive/2013/05/27/399830.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java打包jar在Eclipse代码提示中方法的参数名称无意?/title><link>http://www.aygfsteel.com/oathleo/archive/2013/01/17/java_jar_args.html</link><dc:creator>oathleo</dc:creator><author>oathleo</author><pubDate>Thu, 17 Jan 2013 01:39:00 GMT</pubDate><guid>http://www.aygfsteel.com/oathleo/archive/2013/01/17/java_jar_args.html</guid><wfw:comment>http://www.aygfsteel.com/oathleo/comments/394335.html</wfw:comment><comments>http://www.aygfsteel.com/oathleo/archive/2013/01/17/java_jar_args.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/oathleo/comments/commentRss/394335.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/oathleo/services/trackbacks/394335.html</trackback:ping><description><![CDATA[<div><div>一.Java源码在用Ant脚本打成jar之后Q再被调用时QEclipse代码提示中方法的参数名称是无意义的(arg0、arg1Q?br /><br />解决办法Q用ibm/eclipse的编译器<br /><br />?使用ibm/eclipse的编译器也会(x)有一些方?nbsp;参数语法提示名称是无意义</div>估计可能是ibm的java~译器的bugQ?nbsp;</div> <div><span style="color: red;">只要Ҏ(gu)中含有synchronized 代码?</span><br /><span style="color: red;">׃(x)Dq种情况</span></div> <div>有兴的同学可以研究?br /><br />解决办法Q把相应代码块提取到Ҏ(gu)Q让Ҏ(gu)<span style="color: #ff0000;">synchronized</span><br /><br /><br /><br /></div><img src ="http://www.aygfsteel.com/oathleo/aggbug/394335.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/oathleo/" target="_blank">oathleo</a> 2013-01-17 09:39 <a href="http://www.aygfsteel.com/oathleo/archive/2013/01/17/java_jar_args.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>防止utilsc?tool{被实例?/title><link>http://www.aygfsteel.com/oathleo/archive/2011/12/12/366162.html</link><dc:creator>oathleo</dc:creator><author>oathleo</author><pubDate>Mon, 12 Dec 2011 08:57:00 GMT</pubDate><guid>http://www.aygfsteel.com/oathleo/archive/2011/12/12/366162.html</guid><wfw:comment>http://www.aygfsteel.com/oathleo/comments/366162.html</wfw:comment><comments>http://www.aygfsteel.com/oathleo/archive/2011/12/12/366162.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/oathleo/comments/commentRss/366162.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/oathleo/services/trackbacks/366162.html</trackback:ping><description><![CDATA[<div>abstract 该类</div><img src ="http://www.aygfsteel.com/oathleo/aggbug/366162.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/oathleo/" target="_blank">oathleo</a> 2011-12-12 16:57 <a href="http://www.aygfsteel.com/oathleo/archive/2011/12/12/366162.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>软gpȝ开发中的数据交换协?/title><link>http://www.aygfsteel.com/oathleo/archive/2011/05/09/349853.html</link><dc:creator>oathleo</dc:creator><author>oathleo</author><pubDate>Mon, 09 May 2011 08:41:00 GMT</pubDate><guid>http://www.aygfsteel.com/oathleo/archive/2011/05/09/349853.html</guid><wfw:comment>http://www.aygfsteel.com/oathleo/comments/349853.html</wfw:comment><comments>http://www.aygfsteel.com/oathleo/archive/2011/05/09/349853.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/oathleo/comments/commentRss/349853.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/oathleo/services/trackbacks/349853.html</trackback:ping><description><![CDATA[<p>在很多地斚w?#8220;数据交换”q个概念Q本文所说的“数据交换” 是指在计机|络中,一个系l把数据传递给另外一个系l。这非常cM于一个h要告诉另外一个h一件事情?/p> <p>当一个h要把一件事情告诉另外一个h的时候,我们可以通过?sh)话、邮件、短信、IM工具或者当面说的方式来交流。这U方式类gpȝ数据交换要通过 tcp、udp、管道等{的方式实现。当两个Z的时候,我们需要一U共同的语言才能明白Ҏ(gu)的意思,同样的,两个pȝ要交换数据,也需要定义一U双? 都明白的协议Q我们称?#8220;数据交换协议”?/p> <h2>数据交换协议</h2> <p>数据交换协议的目的是让两个系l进行正的数据交互。所以几乎各U开发语a都提供了方便使用的数据交换功能。比如说使用JAVA语言的开发的pȝ? ? MySQL数据库存储数据,是通过MySQL数据交换协议跟MySQL做数据交换;通过JAVA的RMI可以方便的做跨机器的分布式数据交换,RMI? 是一U数据交换协议?/p> <p>一般我们在不同的系l、不同的语言之间交换数据的时候,我们?x)选择一U通用的交换协议或者自己定义一U容易用的交换协议? WebService曄非常行Q?在Web 2.0时代Q轻量的REST协议又开始受到追捧。那么究竟在我们的系l中应该选择什么样的协议呢Q?/p> <h2>如何选择数据交换协议</h2> <p>选择什么样的协议跟我们的应用场景有很大的关pR我们需要考虑我们开发是否方ѝ接口是否容易发布、是否需要考虑带宽占用成本、序列化和反序列化的性能、接口协议的扩展性等{。下面我们看下几个比较常用的交换协议实现? </p> <table border="1"> <tbody> <tr> <td>协议</td> <td>实现</td> <td>跨语a</td> <td>性能</td> <td>传输?/td> <td>RPC</td> </tr> <tr> <td>xml</td> <td>q泛</td> <td>几乎所?/td> <td>?/td> <td>很大</td> <td>NQ可实现Q?/td> </tr> <tr> <td>json</td> <td>q泛</td> <td>大量</td> <td>一?/td> <td>一?/td> <td>NQ可实现Q?/td> </tr> <tr> <td>php serialize</td> <td>PHPRPC</td> <td>大量</td> <td>一?/td> <td>一?/td> <td>Y</td> </tr> <tr> <td>hessian</td> <td>hessian</td> <td>大量</td> <td>一?/td> <td>?/td> <td>Y</td> </tr> <tr> <td>thrift</td> <td>thrift</td> <td>大量</td> <td>?/td> <td>?/td> <td>Y</td> </tr> <tr> <td>protobuf</td> <td>protobuf</td> <td>大量</td> <td>?/td> <td>?/td> <td>NQ可实现Q?/td> </tr> <tr> <td>ice</td> <td>ice</td> <td>大量</td> <td>?/td> <td>?/td> <td>Y</td> </tr> <tr> <td>avro</td> <td><a target="_self" title="Apache Avro ">Apache Avro </a></td> <td>量</td> <td>?/td> <td>?/td> <td>Y</td> </tr> <tr> <td>messagepack</td> <td><a target="_self" title="messagepack ">messagepack </a> </td> <td>大量</td> <td>?/td> <td>?/td> <td>Y</td> </tr> </tbody> </table> <p>上面表格列出了一些常用数据交换协议的一些特性的比较。这里ƈ没有比较好坏Q只是想说明不同数据交换协议是有区别的,所以我们需要在我们的应用场景中q行选择?/p> <h3>开攑ּ</h3> <p>像微博,SNSq种开攑^台、对静态html面提供javascript接口调用的系l都属于q种cd 。这U类型的特点是:(x)</p> <ul> <li>调用方不完全可控Q而且是针对公|的Q你可能不知道是谁、是什么语a、是什么方式在调用你提供的数据接口Q?/li> <li>接口讉K量一般都非常大,要求h很高的性能和吞吐量Q?/li> <li>需要考虑安全问题Q外部提交的数据可能不是合法的?/li> </ul> <p>所以在q种情况下,需要考虑数据传输的带宽消耗和数据交换协议的易用性,以及(qing)多语a支持E度。以前对于html面使用的javascript接口 调用一般都使用XML格式Q最q几q几乎都转成了json格式了,因ؓ(f)json传输量更,比XML更加Ҏ(gu)使用? 而对于开攑^収ͼ׃使用的场景很多,所以需要提供多U交换协议格式。基本上都会(x)提供XML和json。ؓ(f)了提高^台本w的性能和客L(fng)的性能Q也可以? 供protobufq种二进制交换协议ƈ且增加压~支持,以节省带宽传输和解析的性能消耗?/p> <h3>内部服务</h3> <p>对于一个大型系l来_(d)内部服务的数据交换无处不在。从最基本和常见的数据库数据交换、memcached~存数据交换、消息队列的数据交换到系l? 之间使用的RPC服务框架{等Q都可以作内部服务的数据交换。内部服务的特点是不用考虑防火墙,不对外开放,速度快(基本无带宽成本)?/p> <p>内部服务的数据交换协议的选择I间非常大,一般需要考虑Q?/p> <ul> <li>数据交换协议的性能</li> <li>是否需要跨语言支持</li> <li>数据交换协议的消息体大小</li> </ul> <h3>持久化存?/h3> <p>对于持久化存储来_(d)每一U数据交换协议其实都可以实现。一般需要根据应用场景考虑Q?/p> <ul> <li>是否人工可阅?/li> <li>存储的空间消?/li> <li>序列化和反序列化的性能</li> <li>是否l过压羃</li> </ul> <h3>跨语a</h3> <p>假设我们的网站前端页面展C层使用PHP语言开发,中间业务逻辑使用JAVA语言开发,那么涉?qing)到跨语a数据交换的问题。只要系l不是单U的使用一U语aQ那么就必须考虑q个问题。事实上Q考虑未来的扩展和需求变化问题,也最好考虑跨语a的数据交互协议?/p> <h3>数据交换协议可升U?/h3> <p>在选择数据交换协议的时候,我们同样需要考虑cM于数据库表的?schema设计时的扩展问题。比如一个提供用户信息的数据交换协议接口Q现在包? 用户名、性别、住址的信息,在升U过E中Q增加了一个最后登录的IP信息。如果不考虑数据交换协议升带来的媄响,很可能会(x)D以前的客L(fng)出现异常或? 旧的数据无法正确解析的问题?/p> <h3>兼容协议的y?/h3> <p>兼容协议的y用非常有用,C品兼Ҏ(gu)供现有成熟的数据交换协议Q可以降低用门槛和产品的开发速度。比如新开源的<a >memcacheQ</a>׃用了memcached协议?/p> <h3>ȝ</h3> <p>数据交换协议的各U通用开源实现非常多Q数据交换协议只是一个非常宽泛的说法Q其实只要实C数据的序列化和反序列? Q那么就可以说是一个可以交换数据的协议。数据交换协议的性能其实是序列化和反序列化的性能Q如果加上RPCQ那么跟RPC实现本n的性能也有非常大的 关系?/p> <img src ="http://www.aygfsteel.com/oathleo/aggbug/349853.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/oathleo/" target="_blank">oathleo</a> 2011-05-09 16:41 <a href="http://www.aygfsteel.com/oathleo/archive/2011/05/09/349853.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java 执行脚本语言javascript - javascrip 操作 java对象http://www.aygfsteel.com/oathleo/archive/2010/06/30/javascrip_java.htmloathleooathleoWed, 30 Jun 2010 09:09:00 GMThttp://www.aygfsteel.com/oathleo/archive/2010/06/30/javascrip_java.htmlhttp://www.aygfsteel.com/oathleo/comments/324910.htmlhttp://www.aygfsteel.com/oathleo/archive/2010/06/30/javascrip_java.html#Feedback1http://www.aygfsteel.com/oathleo/comments/commentRss/324910.htmlhttp://www.aygfsteel.com/oathleo/services/trackbacks/324910.html
javascrip 操作 java对象?br />
GEllipse ellipse = new GEllipse();//自定义java对象
//d上下文绑定数?br /> SimpleBindings bindings = new SimpleBindings();
bindings.put("ellipse", ellipse);
ScriptEngine engine = sem.getEngineByExtension("js");
engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
try{
     engine.eval(" ellipse.setX(101);");//脚本里设|自定义java对象对象属?br />      System.out.println(ellipse.getX());//输出101Q测试OK
}catch(Exception ex){
    ex.printStackTrace();
}


oathleo 2010-06-30 17:09 发表评论
]]>
java执行脚本语言javascripthttp://www.aygfsteel.com/oathleo/archive/2010/06/03/322622.htmloathleooathleoThu, 03 Jun 2010 07:04:00 GMThttp://www.aygfsteel.com/oathleo/archive/2010/06/03/322622.htmlhttp://www.aygfsteel.com/oathleo/comments/322622.htmlhttp://www.aygfsteel.com/oathleo/archive/2010/06/03/322622.html#Feedback3http://www.aygfsteel.com/oathleo/comments/commentRss/322622.htmlhttp://www.aygfsteel.com/oathleo/services/trackbacks/322622.html
很早听说了q个功能一直没仔细看看Q尝试了?功能不错Q?br />
    public static void main(String[] args) {
        ScriptEngineManager sem = new ScriptEngineManager();
       
        //d上下文绑定数?br />         SimpleBindings bindings = new SimpleBindings();
        bindings.put("aaa_av", new Double(10000.1));
        bindings.put("bbb_av", new Double(20000.2));
       
        ScriptEngine engine = sem.getEngineByExtension("js");
        engine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
        try{
            //直接解析
            Object res = engine.eval(" res =  Math.max(aaa_av , bbb_av) + aaa_av");
            System.out.println(res);
           
           
            //创徏脚本
            String script = "function getMax() "
                + "{ return Math.max(aaa_av , bbb_av)}";
            //执行脚本
            engine.eval(script);
            Invocable inv = (Invocable) engine;
            //执行Ҏ(gu)q传递参?br />             Object obj = inv.invokeFunction("getMax", null);
            //打印l果
            System.out.println(obj);

        }catch(Exception ex){
            ex.printStackTrace();
        }
    }


oathleo 2010-06-03 15:04 发表评论
]]>
Hash codehttp://www.aygfsteel.com/oathleo/archive/2010/03/03/314415.htmloathleooathleoWed, 03 Mar 2010 08:03:00 GMThttp://www.aygfsteel.com/oathleo/archive/2010/03/03/314415.htmlhttp://www.aygfsteel.com/oathleo/comments/314415.htmlhttp://www.aygfsteel.com/oathleo/archive/2010/03/03/314415.html#Feedback4http://www.aygfsteel.com/oathleo/comments/commentRss/314415.htmlhttp://www.aygfsteel.com/oathleo/services/trackbacks/314415.html如果两个对象equalQ那么它们的hashCodeg定要相同Q?、如果两个对象的hashCode相同Q它们ƈ不一定equal

当Set要添加新的元素时Q先调用q个元素的hashCodeҎ(gu)Q就一下子能定位到它应该放|的物理位置上。如果这个位|上没有元素Q它?yu)可以直接存储? q个位置上,不用再进行Q何比较了Q如果这个位|上已经有元素了Q就调用它的equalsҎ(gu)与新元素q行比较Q相同的话就不存了,不相同就散列其它的地址?br />
所以两个不equal的对象,有相同的hashQ是可以存进Set的?/strong>

class HashNode {
    int id;
   
    public HashNode(int id){
        this.id = id;
    }
   
    public int hashCode() {
        return id;
    }
   
    public boolean equals(Object obj) {
        return false;
    }
}

public class HashTest {

    public static void main(String[] args) {
        HashNode n1 = new HashNode(1);
        HashNode n2 = new HashNode(1);
       
        HashMap map = new HashMap();
        map.put(n1, "111");
        map.put(n2, "222");
       
        System.out.println(n1.equals(n2));
        System.out.println(n1.hashCode() == n2.hashCode());
        System.out.println(map.keySet().size());
    }

}


oathleo 2010-03-03 16:03 发表评论
]]>
MVC与MVPhttp://www.aygfsteel.com/oathleo/archive/2010/02/28/MVC_MVP.htmloathleooathleoSun, 28 Feb 2010 07:38:00 GMThttp://www.aygfsteel.com/oathleo/archive/2010/02/28/MVC_MVP.htmlhttp://www.aygfsteel.com/oathleo/comments/314106.htmlhttp://www.aygfsteel.com/oathleo/archive/2010/02/28/MVC_MVP.html#Feedback6http://www.aygfsteel.com/oathleo/comments/commentRss/314106.htmlhttp://www.aygfsteel.com/oathleo/services/trackbacks/314106.html 一直忙于客户不停的需求中Q忽略了产品本n上这些最重要的东ѝ?br /> 现在卛_待业Q放下自׃ؓ(f)之工作近三年的品,真的感觉犹如失去自己的孩子?br /> 好的一斚w是空闲的旉多了Q终于可以想惌些事情了?br />
MVC是个被烂掉的东西了QMVP也屡屡被人提?qing)?br /> 最大的区别在哪里呢Qؓ(f)什么要再演变个MVP出来呢?

定义上来说最大的区别在于C和PQ就构架上来_(d)是View层实现的方式不同?br /> MVCQView层肩负很大Q务,View兌ModelQView的渲染是直接通过Model层的数据来确定的。还是有很多业务逻辑在View上完成?br /> MVPQView层的d大大~减QView不再知道ModelQP层完成上面提到的View层完成的业务逻辑?br /> M一句话MVP里,View层绝对不能再讉KModel了,

M一U设计模式的出现l对不是Z出现而出现的。LZ解决现实中存在的某些老的模式无法或难以解决的问题才出现的?br />
Z么会(x)出现MVP呢?
看看客户拿到一个设计精良的MVC的品,做二ơ开发的时候,如果他项目够大Q肯定会(x)发现MVC的好处。Q务集中在Model层,设计好Model层数据的填充Q简单的实现完成了。MVC的架构帮他解决了很多问题Q大家很HappyQ?br /> 当然客户的需求L永无止境的,当简单需求被满的时候,他又?x)往高层ơ发展,也许他就完全需要不同的View来做同样的Model的展C?比如一个在JSPQ一个在Swing或者Android?Q在q个时候,E微想下Q他发C要做的Q务开始变的很大了。Model层的数据U可以׃nQ事件控?转发)也能Q而View层无论如何是逃不了了。于是WebE序员硬着头皮也要学SwingQSwing的程序员郁闷的学JSP?br /> 试想q个时候如果有个hQ能把陷在View上的上万行codeQ拉C个即能联pdModelQ又能联pdView的层ơ上Q那真的要感谢苍天大C?br />
MVP我想应该是在这个时候出现的。它处理所有View和Model之间的消息传递,数据更新Q交互操作。比如从Swing的TextField里输入个字段信息Q和从JSP里的Form里输入这个字D信息,处理的流E应该是可以׃nq段代码的。当然这个时候,Z解决不同View上的一些特D情况,可以使用适配器模式,来处理多个View的程序设计问题?br />
设计模式没有好坏之分Q只有合不合适。你的品如果只需要输入个Aq回个BQ没有^台徏议,没有pȝ升Q那忘了所有的设计模式Q走那条最快实现的路吧?br />


oathleo 2010-02-28 15:38 发表评论
]]>
通过反射修改cȝU有字段?调用U有Ҏ(gu)http://www.aygfsteel.com/oathleo/archive/2008/06/21/209668.htmloathleooathleoSat, 21 Jun 2008 03:40:00 GMThttp://www.aygfsteel.com/oathleo/archive/2008/06/21/209668.html阅读全文

oathleo 2008-06-21 11:40 发表评论
]]>
动?JNLPhttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189199.htmloathleooathleoFri, 28 Mar 2008 02:11:00 GMThttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189199.htmlhttp://www.aygfsteel.com/oathleo/comments/189199.htmlhttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189199.html#Feedback2http://www.aygfsteel.com/oathleo/comments/commentRss/189199.htmlhttp://www.aygfsteel.com/oathleo/services/trackbacks/189199.html阅读全文

oathleo 2008-03-28 10:11 发表评论
]]>
JAVA UMq算W?<< >> >>>http://www.aygfsteel.com/oathleo/archive/2008/03/28/189197.htmloathleooathleoFri, 28 Mar 2008 02:08:00 GMThttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189197.htmlhttp://www.aygfsteel.com/oathleo/comments/189197.htmlhttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189197.html#Feedback0http://www.aygfsteel.com/oathleo/comments/commentRss/189197.htmlhttp://www.aygfsteel.com/oathleo/services/trackbacks/189197.html

/*
* show the arthimetic character of '<<' '>>' '>>>'
*/

public class TestArithmetic {
   public TestArithmetic() {
   }
  
   public   static void   main(String [] args){
     int minus = -10;
     System.out.println(" Binary of -10 is " + Integer.toBinaryString(minus));
     System.out.println(" Arthimetic minus by -10 << 2 = " + (minus<<2) + " Binary is " + Integer.toBinaryString(minus<<2));
     System.out.println(" Arthimetic minus by -10 >> 2 = " + (minus>>2) + " Binary is " + Integer.toBinaryString(minus>>2));
     System.out.println(" Arthimetic minus by -10 >>>2 =   " + (minus >>> 2) + " Binary is " + Integer.toBinaryString(minus>>>2)
                        + ",length is " + Integer.toBinaryString(minus>>>2).length());
    
     int plus = 10;
     System.out.println(" Binary of 10 is " + Integer.toBinaryString(plus));
     System.out.println(" Arthimetic minus by 10 << 2 = " + (plus<<2)+ "Binary is " + Integer.toBinaryString(plus<<2));
     System.out.println(" Arthimetic minus by 10 >> 2 = " + (plus>>2)+ "Binary is "+ Integer.toBinaryString(plus>>2));
     System.out.println(" Arthimetic minus by 10 >>>2 =   " + (plus >>> 2)+ "Binary is "+ Integer.toBinaryString(plus >>> 2));
   }

补充知识Q数值的补码表示也分两种情况Q?
Q?Q正数的补码Q与原码相同?
例如Q?9的补码是00001001?
Q?Q负数的补码Q符号位?Q其余位数绝对值的原码按位取反Q然后整个数??
例如Q?7的补码:(x)因ؓ(f)是负敎ͼ则符号位为??整个?0000111Q其?位ؓ(f)-7的绝对?7的原?000111按位取反?111000Q再?Q所?7的补码是11111001?


已知一个数的补码,求原码的操作分两U情况:(x)
Q?Q如果补码的W号位ؓ(f)?”,表示是一个正敎ͼ所以补码就是该数的原码?
Q?Q如果补码的W号位ؓ(f)?”,表示是一个负敎ͼ求原码的操作可以是:(x)W号位ؓ(f)1Q其余各位取反,然后再整个数??
例如Q已知一个补码ؓ(f)11111001Q则原码?0000111Q?7Q:(x)因ؓ(f)W号位ؓ(f)?”,表示是一个负敎ͼ所以该位不变,仍ؓ(f)?”;其余7?111001取反后ؓ(f)0000110Q再?Q所以是10000111?/p>

oathleo 2008-03-28 10:08 发表评论
]]>
Java Word转htmlhttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189196.htmloathleooathleoFri, 28 Mar 2008 02:08:00 GMThttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189196.htmlhttp://www.aygfsteel.com/oathleo/comments/189196.htmlhttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189196.html#Feedback7http://www.aygfsteel.com/oathleo/comments/commentRss/189196.htmlhttp://www.aygfsteel.com/oathleo/services/trackbacks/189196.html阅读全文

oathleo 2008-03-28 10:08 发表评论
]]>
用XMLEncode输出时候,有BigDecimal有时候不好?/title><link>http://www.aygfsteel.com/oathleo/archive/2008/03/28/189195.html</link><dc:creator>oathleo</dc:creator><author>oathleo</author><pubDate>Fri, 28 Mar 2008 02:07:00 GMT</pubDate><guid>http://www.aygfsteel.com/oathleo/archive/2008/03/28/189195.html</guid><wfw:comment>http://www.aygfsteel.com/oathleo/comments/189195.html</wfw:comment><comments>http://www.aygfsteel.com/oathleo/archive/2008/03/28/189195.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/oathleo/comments/commentRss/189195.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/oathleo/services/trackbacks/189195.html</trackback:ping><description><![CDATA[ <div class="wmqeeuq" id="blog_text" class="cnt"> <p>用XMLEncode输出时候,如果有BigDecimal有时候不好?br /> 原因是:(x)如果cȝ变量在定义时候有初始|而不是nullQ就必须要重载DefaultPersistenceDelegate的mutatesToҎ(gu)?br /> 关于q个说明Q在|上q里可以看到Q?br /><a >http://forum.java.sun.com/thread.jspa?threadID=631299&messageID=3642493</a><br /><br />有兴的可以看看Q?br /> //setup big decimal delegate.<br />           DefaultPersistenceDelegate bigDecimalDelegate = new DefaultPersistenceDelegate() {<br />               protected Expression instantiate(Object oldInstance, Encoder out) {<br />                   BigDecimal decimal = (BigDecimal) oldInstance;<br />                   return new Expression(oldInstance, oldInstance.getClass(), "new", new Object[] {decimal.toString()});<br />               }<br />               //must override this method.<br />               // see <a >http://forum.java.sun.com/thread.jspa?threadID=631299&messageID=3642493</a><br />               protected boolean mutatesTo(Object oldInstance, Object newInstance) {<br />                   return oldInstance.equals(newInstance);<br />               }<br />               //--- Joshua<br />           };<br /><br /> |上的牛Q?br /><br /> This works for BigDecimal properties that aren't initialized, i.e. null. But if you initialize the property, then this won't work unless you override mutatesTo in addition to instantiate mentioned above:</p> <p>protected boolean mutatesTo(Object oldInstance, Object newInstance) {<br /> return oldInstance.equals(newInstance);<br /> } </p> </div> <img src ="http://www.aygfsteel.com/oathleo/aggbug/189195.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/oathleo/" target="_blank">oathleo</a> 2008-03-28 10:07 <a href="http://www.aygfsteel.com/oathleo/archive/2008/03/28/189195.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java 引用http://www.aygfsteel.com/oathleo/archive/2008/03/28/189193.htmloathleooathleoFri, 28 Mar 2008 02:05:00 GMThttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189193.htmlhttp://www.aygfsteel.com/oathleo/comments/189193.htmlhttp://www.aygfsteel.com/oathleo/archive/2008/03/28/189193.html#Feedback0http://www.aygfsteel.com/oathleo/comments/commentRss/189193.htmlhttp://www.aygfsteel.com/oathleo/services/trackbacks/189193.html

public class MethodDemo {

/**
* @param args
*/
public static void main(String[] args) {
   MethodDemo demo = new MethodDemo();
   Integer i = Integer.valueOf(1);
   demo.add(i);
   System.out.println("i:" + i);
  
   String s = "ss";
   demo.stringchange(s);
   System.out.println("s:" + s);
  
   Person per = new Person();

    per.name = "per1";
   demo.setDate(per);
   System.out.println("per:" + per.getName());
}

//基本cd变不?br /> public void add(int i) {
   i++;
}

/***
* 凡是在引用中出现修改引用的赋D句,
* 修改都变成无?br /> * @param i
*/

//想修改引用,不行
public void add(Integer i) {
   int j = i.intValue();
   i = Integer.valueOf(j++);//i的原引用已经丢失?br /> }

//想修改引用,不行
public void stringchange(String s){
   s = "stringchange";
}

public void setDate(Person per){
   Person per2 = new Person();
   per2.setName("per2Name");
   per = per2;//per的原引用已经丢失?/span>,q个估计很多Z(x)出错
   per.setName("name");
}

}

class Person {
String name ;

public String getName() {
   return name;
}

public void setName(String name) {
   this.name = name;
}

}



oathleo 2008-03-28 10:05 发表评论
]]>
վ֩ģ壺 Դ| | | | ľ| Ȫ| | | ܿ| | ƽ| ԭ| ̨| | ̶| ̨| | | ̨| ƽ| ˶| | | | | ν| ׯ| ɽ| Ϫ| | | | ʲ| ʯɽ| Dz| | Ȩ| | | | ʮ|