zoukankan      html  css  js  c++  java
  • 2013.5.1

    public class TextClass {
        public TextClass(int i){
            
        }
        public TextClass(double e){
            
        }
      public TextClass increatment(){
        return this;
      } }
    //TextClass c=new TextClass(); 对实体类创建自定义构建器后,默认构建器无法使用


    //返回当前句柄,即返回当前对象

    1.浏览器缓存问题 

        链接缓存问题  

        可以通过在添加随机数参数 让浏览器区分地址,

    }else if(vldElementField(uname)){
                var random=Math.random();
                $.getJSON("user/cooOrg!yzUser?random="+random,{yzName:uname.val(),yzRoleId:"50;"},function(msg){

     2 。 xml  date  转化为  date  后 并 计算n天后的日期

      xml  获得年月日 ,先转date  后 simpledateformat

        

        Date xx=tp.getSendDate().toGregorianCalendar().getTime();
        senddate=new SimpleDateFormat("yyyyMMdd").format(xx);}

      

    adate=thcp.getHostingComp().getCreatetime().toGregorianCalendar().getTime();
                SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
                datz=df.format(adate);
                Calendar c=Calendar.getInstance();
                c.setTime(adate);//其实也可以不设置,默认就是当前时间
                c.add(Calendar.DAY_OF_MONTH,thcp.getHostingComp().getPeriodValidity()); //计算20之后的日期
                datz1=df.format(c.getTime());

     3.

      java 增加了两个高精度的计算。BigInteger和BigDecimal

        BigInteger支持任意精度的整数。也就是说,我们可精确表示任意大小的整数值,同时在运算过程中不会丢
        失任何信息。

    4.  

       对方法来说,static一项重要的用途
            就是帮助我们在不必创建对象的前提下调用那个方法,对于静态方法、属性可以通过它的类直接调用

    Properties p=System.getProperties();
    p.list(System.out);
    System.out.println("結束");
    Runtime rt=Runtime.getRuntime();

    //获得系统信息及以上
    System.out.println(rt.totalMemory()+"……"+rt.freeMemory()+"……"); //rt.halt(0);//強行終止虛擬機 try{ Thread.currentThread().sleep(5*1000); //线程暂停5s再执行 }catch (Exception e) { // TODO: handle exception } System.out.println(rt.hashCode());

    5.

        以下方式可能造成getter/setter 方法 出现问题 ,jsp到action  封装出现ognl错误

        1. javabean属性命名尽量使用常规的驼峰式命名规则

        2. 属性名第一个单词尽量避免使用一个字母:如eBook, eMail。

        3. boolean属性名避免使用 “is” 开头的名称

        4. 随着jdk, eclipse, spring 等软件版本的不断提高, 底版本的出现的问题可能在高版本中解决了, 低版本原来正常的代码可能在高版本环境下不再支持。

    6.在线qq

      ①<a class="icoTc" href="tencent://message/?uin=453007125&Site=会员在线服务&Menu=yes" target="_blank">

      ②<a target=_blank href=http://wpa.qq.com/msgrd?v=3&uin="+o.qq+"&site=qq&menu=yes>

     7. java 标签

      

            int i=0;
            outer:  //标签 ,指示循环 ,break outer 终止循环,并移离到循环末尾。  区别break终止当前循环 
            while(true){
                System.out.println("开始");
                i++;
                if(i==1){
                    System.out.println("第一次");
                    continue;
                }
                if(i==3){
                    System.out.println("第三次");
                    break;
                }
                
                if(i==7){
                    System.out.println("没有中断");
                    break outer;
                }
            }
            
            System.out.println("fd");

    结果为: 

      开始
      第一次
      开始
      开始
      第三次
      fd

    同样的规则亦适用于while: 
    (1) 简单的一个 continue 会退回最内层循环的开头(顶部),并继续执行。 
    (2) 带有标签的 continue 会到达标签的位置,并重新进入紧接在那个标签后面的循环。 
    (3) break 会中断当前循环,并移离当前标签的末尾。 
    (4) 带标签的break 会中断当前循环,并移离由那个标签指示的循环的末尾。 
    在Java 里唯一需要用到标签的地方就是拥有嵌套循环,而且想中断或继续多个嵌套级 
    别的时候。

     9.获得英文字母:

      

    char c=(char)(Math.random()*26+'A')   //获得随机字母
    char c=(char)(Math.random()*26+'a')
    
    char c=(char)(1+'a')  //获得下一个字母

      

    (int)'a'  //  获得a对应的AscII  码  
    char c=(char)66; //AscII 转字符

      char[] a="你好".toCharArray();
      String sunicode="";
      for(int i=0;i<a.length;i++){
      String hex=Integer.toHexString(a[i]);
      if(hex.length()!=0){
      sunicode=sunicode+"\\u"+hex;
      }
      }
      System.out.println(sunicode);// 字符转unicode

     

    10.

      

            int i=0;
            switch (i) {
            case 0:
                System.out.println("1");
            case 1:
                System.out.println("2");
                break;
            case 2:
                System.out.println("22");
            default:
                System.out.println("3");
            }
    //case 及default 后不加break 是不会报错的 ,  按顺序执行,当执行到符合条件的case 时 ,如果该case 没有break 时 , 会往下执行即使case不符合条件,知道出现break 才停止。

      12.

    <form action="MAILTO:someone@w3school.com.cn" method="post" enctype="text/plain">
    
    <h3>这个表单会把电子邮件发送到 W3School。</h3>
    姓名:<br />
    <input type="text" name="name" value="yourname" size="20">
    <br />
    电邮:<br />
    <input type="text" name="mail" value="yourmail" size="20">
    <br />
    内容:<br />
    <input type="text" name="comment" value="yourcomment" size="40">
    <br /><br />
    <input type="submit" value="发送">
    <input type="reset" value="重置">
    
    </form>

     13.

      

    public class Leaf(){
           Leaf incre(){
                return this;  
           }    
    }
    
    
    /// return  this  返回当前类 bean  

     14.

      <div style="100%; height:80px;"  id="flash-banner"></div>
      <script type="text/javascript" src="js/swfobject.js"></script>
      //js代码如下
        

    /**
    * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
    *
    * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
    * http://www.opensource.org/licenses/mit-license.php
    *
    */
    if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}else{this.addParam("wmode","transparent");};var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


      //

    <script type="text/javascript"> if($("#flash-banner").size()>0){ var so = new SWFObject("js/banner-middle.swf", "logo", "1080", "80", "9"); so.write("flash-banner"); } </script>

    //在jsp 页面打开.swf 动画

     //以前 

    2.。可以通过replaceAll("\\d", "*")把一个字符串所有的数字字符都换成星号,replace就做不到,因为它不是基于规则表达多的替换。


    3.,。letter-spacing文字间距(normal,<length>,inherit)...,,line-height:3px,行间距, 。。writing-mode:lr-tb、tb-rl(从左往右,从下往上、从上往下,从右向左)。。

    4._parent 目标是父窗口 ,指的是含该链接的框架或者框架集。。_self 默认属性 ,显示在相同的框架或者窗口中
    _blank 在新打开,未命名的窗口中载入目标文档。 _top 使得该文档载入到包含这个链接的窗口,并清除所有被包含的框架,将文档载入整个浏览器窗口。

    5.var $trs = $("#table").find("tr");for(var i=0;i<$trs.length;i++){
    var $tr = $trs.eq(i);
    var input = $tr.find("input[name=name1]").val();
    var select = $tr.find("select[name=select1]").val();
    获得table下的所有input;
    6.扩展js 基础类 (扩展类的方法,如String,Array,Date,)
    <script>相当于自定义了一个stirng 方法
    String.prototype.compare = function(str)
    {
    //不区分大小写
    if(this.toLowerCase() == str.toLowerCase())
    {
    return "1"; // 正确
    }
    else{
    return "0"; // 错误
    }
    }
    alert("ABCDefg".compare("abcdEFG"));
    alert("abc".compare("acd"));
    </script>
    7.。struts 配置文件,4个开发模式
    下面是4个开发模式常用配置的简介---
    <!-- 开启使用开发模式,详细错误提示 -->
    <!-- <constant name="struts.devMode" value="true"/>-->
    <!-- 指定每次请求到达,重新加载资源文件 -->
    <!-- <constant name="struts.i18n.reload" value="true"/>-->
    <!-- 指定每次配置文件更改后,自动重新加载 -->
    <!-- <constant name="struts.configuration.xml.reload" value="true"/>-->
    <!-- 指定XSLT Result使用样式表缓存 -->
    <!-- <constant name="struts.xslt.nocache" value="true"/>-->

    8.(([1-9][\d]*)(\.[\d]{1,4})?)|(0\.[\d]{1,4}) 验证数值


    9、align 是左右的位置,vertical-align: 是上下的位置


    10, struts 配置 局部刷新
    <result name="json" type="json">
    <param name="root">message</param> //message 是局部刷新的返回值
    <param name="contentType">text/html</param>
    </result>
    11.jsp多个标签name 同名,后台声明Stirng ,会自动组合成string ,(,)

    12. 内容截取 <s:property value="a.substring(0,20)"/>……</s:if>

    13.text 文本中含有特殊字符时可能编译出错 ,可替换 \n " " ,\r " " 等等

     14.指针引用 , 不通class传值,对bean 的属性操作 ,不会改变参数的指针,此时一bean 和二bean 具有相同指针,,,但是直接对该bean 操作会改变参数指针,

    15.关闭facebox 需要在父窗口关闭,jQuery(document).trigger('close.facebox');

    16. iframe 标签onload()可以在iframe加载完不同的框架后执行,便于执行父窗口的某个方法

    17.jquery  删除 节点,remove('li:odd'); 在括号里写条件有 jQuery 版本问题 ,可以用  $('li').remove() 或者  在document 下使用 find('li:odd').remove()

    18.继承 ,子类调用super() 调用的是父类的构造器,如为声明,则是默认构造器

     19.jar包错误 ,可能造成jsp 页面无法正常打开 

  • 相关阅读:
    论文笔记系列-DARTS: Differentiable Architecture Search
    Win10安装TensorFlow1.9-GPU版本
    论文笔记系列-Efficient Neural Architecture Search via Parameter Sharing
    论文笔记模板
    无偏估计
    【TensorFlow】tf.nn.softmax_cross_entropy_with_logits的用法
    Python学习札记(十三) Function3 函数参数二
    LeetCode Add Two Numbers
    Python学习札记(十二) Function3 函数参数一
    Python学习札记(十一) Function2 函数定义
  • 原文地址:https://www.cnblogs.com/zhangchenglzhao/p/3048734.html
Copyright © 2011-2022 走看看