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

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

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

    tinguo002

     

    js判斷數字-正則表達式(轉)

    http://blog.sina.com.cn/s/blog_72b7a82d0100yfip.html

    "^\\d+$"  //非負整數(正整數  0)   


    "^[0-9]*[1-9][0-9]*$"  //正整數   


    "^((-\\d+)|(0+))$"  //非正整數(負整數  0)   


    "^-[0-9]*[1-9][0-9]*$"  //負整數   


    "^-?\\d+$"    //整數   


    "^\\d+(\\.\\d+)?$"  //非負浮點數(正浮點數  0)   



    "^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$"  //正浮點數
     


    "^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$"  //非正浮點數(負浮點數  0)
     



    "^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$"  //負浮點數
     


    "^(-?\\d+)(\\.\\d+)?$"  //浮點數



    測試:


    <script>


    function forcheck(ss){


    var
    type="^[0-9]*[1-9][0-9]*$";

    var re = new
    RegExp(type);

    if(ss.match(re)==null)

    {
    alert(
    "請輸入大于零的整數!");

    return;
      }


    }


    </script>

    posted @ 2013-07-04 17:59 一堣而安 閱讀(227) | 評論 (0)編輯 收藏

    ArrayList的toArray(轉)


    http://www.cnblogs.com/ihou/archive/2012/05/10/2494578.html

    ArrayList提供了一個將List轉為數組的一個非常方便的方法toArray。toArray有兩個重載的方法:

    1.list.toArray();

    2.list.toArray(T[]  a);

    對于第一個重載方法,是將list直接轉為Object[] 數組;

    第二種方法是將list轉化為你所需要類型的數組,當然我們用的時候會轉化為與list內容相同的類型。

    不明真像的同學喜歡用第一個,是這樣寫:

    1
    2
    3
    4
    5
    6
    7
    ArrayList<String> list=new ArrayList<String>();
            for (int i = 0; i < 10; i++) {
                list.add(""+i);
            }
           
            String[] array= (String[]) list.toArray();
          

    結果一運行,報錯:

    Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;

    原因一看就知道了,不能將Object[] 轉化為String[].轉化的話只能是取出每一個元素再轉化,像這樣:

    1
    2
    3
    4
    5
    Object[] arr = list.toArray();
            for (int i = 0; i < arr.length; i++) {
                String e = (String) arr[i];
                System.out.println(e);
            }

    所以第一個重構方法就不是那么好使了。

    實際上,將list世界轉化為array的時候,第二種重構方法更方便,用法如下:

    1
    2
    String[] array =new String[list.size()];
            list.toArray(array);<br><br>另附,兩個重構方法的源碼:

    1.
    public Object[] toArray(); {
    Object[] result = new Object[size];
    System.arraycopy(elementData, 0, result, 0, size);;
    return result;
    }

    2.

    public Object[] toArray(Object a[]); {
    if (a.length < size);
    a = (Object[]);java.lang.reflect.Array.newInstance(
    a.getClass();.getComponentType();, size);;
    System.arraycopy(elementData, 0, a, 0, size);;

    if (a.length > size);
    a[size] = null;

    return a;
    }

    1
    <br><br>
    1
    2
    <br>
      

    posted @ 2013-07-04 11:52 一堣而安 閱讀(250) | 評論 (0)編輯 收藏

    js獲取項目根路徑[轉]



    http://www.cnblogs.com/linjiqin/archive/2011/03/07/1974800.html
    //
    js獲取項目根路徑,如: http://localhost:8083/uimcardprj
    function getRootPath(){
        
    //獲取當前網址,如: http://localhost:8083/uimcardprj/share/meun.jsp
        var curWwwPath=window.document.location.href;
        
    //獲取主機地址之后的目錄,如: uimcardprj/share/meun.jsp
        var pathName=window.document.location.pathname;
        
    var pos=curWwwPath.indexOf(pathName);
        
    //獲取主機地址,如: http://localhost:8083
        var localhostPaht=curWwwPath.substring(0,pos);
        
    //獲取帶"/"的項目名,如:/uimcardprj
        var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
        
    return(localhostPaht+projectName);
    }

    posted @ 2013-06-19 16:14 一堣而安 閱讀(611) | 評論 (0)編輯 收藏

    轉]Java中HashMap遍歷的兩種方式

    轉]Java中HashMap遍歷的兩種方式
    原文地址: http://www.javaweb.cc/language/java/032291.shtml

    第一種:
      Map map = new HashMap();
      Iterator iter = map.entrySet().iterator();
      while (iter.hasNext()) {
      Map.Entry entry = (Map.Entry) iter.next();
      Object key = entry.getKey();
      Object val = entry.getValue();
      }
      效率高,以后一定要使用此種方式!
    第二種:
      Map map = new HashMap();
      Iterator iter = map.keySet().iterator();
      while (iter.hasNext()) {
      Object key = iter.next();
      Object val = map.get(key);
      }
      效率低,以后盡量少使用!
     
           HashMap的遍歷有兩種常用的方法,那就是使用keyset及entryset來進行遍歷,但兩者的遍歷速度是有差別的,下面請看實例:
      public class HashMapTest {
      public static void main(String[] args) ...{
      HashMap hashmap = new HashMap();
      for (int i = 0; i < 1000; i ) ...{
      hashmap.put("" i, "thanks");
      }
      long bs = Calendar.getInstance().getTimeInMillis();
      Iterator iterator = hashmap.keySet().iterator();
      while (iterator.hasNext()) ...{
      System.out.print(hashmap.get(iterator.next()));
      }
      System.out.println();
      System.out.println(Calendar.getInstance().getTimeInMillis() - bs);
      listHashMap();
      }
      public static void listHashMap() ...{
      java.util.HashMap hashmap = new java.util.HashMap();
      for (int i = 0; i < 1000; i ) ...{
      hashmap.put("" i, "thanks");
      }
      long bs = Calendar.getInstance().getTimeInMillis();
      java.util.Iterator it = hashmap.entrySet().iterator();
      while (it.hasNext()) ...{
      java.util.Map.Entry entry = (java.util.Map.Entry) it.next();
      // entry.getKey() 返回與此項對應的鍵
      // entry.getValue() 返回與此項對應的值
      System.out.print(entry.getValue());
      }
      System.out.println();
      System.out.println(Calendar.getInstance().getTimeInMillis() - bs);
      }
      }
      對于keySet其實是遍歷了2次,一次是轉為iterator,一次就從hashmap中取出key所對于的value。而entryset只是遍歷了第一次,他把key和value都放到了entry中,所以就快了。


    Java中HashMap遍歷的兩種方式(本教程僅供研究和學習,不代表JAVA中文網觀點)
    本篇文章鏈接地址:http://www.javaweb.cc/language/java/032291.shtml
    如需轉載請注明出自JAVA中文網:http://www.javaweb.cc/


    還是第一種好,簡單。。。

    posted @ 2013-06-17 21:59 一堣而安 閱讀(214) | 評論 (0)編輯 收藏

    Myeclipse安裝findbugs(轉)

     http://hnwsha.blog.sohu.com/211993316.html
    分類: Java 2012-04-17
    13:13

    安裝方法如下:
    1、首先從findbugs網站下載插件:http://findbugs.sourceforge.net/downloads.html

    2、將下載回來的zip包解壓,得到文件夾:edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821,將該文件夾拷貝到myeclipse安裝目錄下common/plugins目錄下。我的目錄結構:D:\Genuitec\MyEclipse8.5\Common\plugins\edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821

    3、修改myeclipse安裝目錄下configuration/org.eclipse.equinox.simpleconfigurator的bundles.info文件,在文件最后添加一行:

    edu.umd.cs.findbugs.plugin.eclipse,1.3.9.20090821,file:/D:/Genuitec/MyEclipse8.5/Common/plugins/edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821,4,false
    注意最后一行不能有空格,回車之類的符號。

    這里file后面的路徑要根據自己的目錄設置進行修改,要不然重啟myeclipse后,仍然找不到findbugs。

    4、重啟myeclipse,選中項目,右鍵會出現一個Find
    Bugs菜單。至此,findbugs插件安裝完畢

    posted @ 2013-06-17 15:15 一堣而安 閱讀(3114) | 評論 (0)編輯 收藏

    js網頁滾動條滾動事件


    http://www.cnblogs.com/yongtaiyu/archive/2012/11/14/2769707.html
    js網頁滾動條滾動事件

    在做js返回頂部的效果時,要監聽網頁滾動條滾動事件,這個事件就是:window.onscroll。當onscroll事件發生時,用js獲得頁面的scrollTop值,判斷scrollTop為一個設定值時,顯示“返回面部”
    js網頁滾動條滾動事件

    <style type="text/css">
    #top_div{
        position:fixed;
        bottom:80px;
        right:0;
        display:none;
    }
    </style>
    <script type="text/javascript">
    window.onscroll = function(){
        var t = document.documentElement.scrollTop || document.body.scrollTop; 
        var top_div = document.getElementById( "top_div" );
        if( t >= 300 ) {
            top_div.style.display = "inline";
        } else {
            top_div.style.display = "none";
        }
    }

    </script>
    <a name="top">頂部<a>
    <div id="top_div"><a href="#top">返回頂部</a></div>
    <br />
    <br />
    <div>
    這里盡量多些<br />以便頁面出現滾動條,限于篇幅本文此處略去
    </div>

    例子語法解釋
    在 style 標簽中首先定義 top_div css 屬性:position:fixed;display:none; 是關鍵
    javascript 語句中,t 得到滾動條向下滾動的位置,|| 是為了更好兼容性考慮
    當滾動超過 300 (像素)時,將 top_div css display 屬性設置為顯示(inline),反之則隱藏(none)
    必須設定 DOCTYPE 類型,在 IE 中才能利用 document.documentElement 來取得窗口的寬度及高度

    轉自:http://www.altmi.com/zg/index.php/archives/67/

    posted @ 2013-06-03 16:35 一堣而安 閱讀(526) | 評論 (0)編輯 收藏

    iframe 刷新

    JS實現刷新iframe的方法



    <iframe src="1.htm" name="ifrmname" id="ifrmid"></iframe>


    方案一:用iframe的name屬性定位


    <input type="button" name="Button"
    value="Button"
    onclick="document.frames('ifrmname').location.reload()">


      或


    <input type="button" name="Button"
    value="Button"
    onclick="document.all.ifrmname.document.location.reload()">


      方案二:用iframe的id屬性定位


    <input type="button" name="Button"
    value="Button"
    onclick="ifrmid.window.location.reload()">


      終極方案:當iframe的src為其它網站地址(跨域操作時)


    <input type="button" name="Button"
    value="Button"
    onclick="window.open(document.all.ifrmname.src,'ifrmname','')">





    代碼如下:<input type=button value=刷新 onclick="history.go(0)">


    代碼如下:<input type=button value=刷新 onclick="location.reload()">


    代碼如下:<input type=button value=刷新 onclick="location=location">


    代碼如下:<input type=button value=刷新
    onclick="window.navigate(location)">


    代碼如下:<input type=button value=刷新 onclick="location.replace(location)">


    下面這三種我就不知道該怎么用了,就把代碼放在下面吧,哪位要是會的話,可教教大家。


    <input type=button value=刷新
    onclick="document.execCommand(@#Refresh@#)">


    <input type=button value=刷新
    onclick="window.open(@#自身的文件@#,@#_self@#)">


    <input type=button value=刷新 onClick=document.all.WebBrowser.ExecWB(22,1)>






    父頁面中存在兩個iframe,一個iframe中是一個鏈接列表,其中的鏈接指向另一個iframe,用于顯示內容。現在當內容內容添加后,在鏈接列表中添加了一條記錄,則需要刷新列表iframe。


    在內容iframe的提交js中使用parent.location.reload()將父頁面全部刷新,因為另一個iframe沒有默認的url,只能通過列表選擇,所以只顯示了列表iframe的內容。


    使用window.parent.frames["列表iframe名字"].location="列表url"即可進刷新列表iframe,而內容iframe在提交后自己的刷新將不受影響。








    document.frames("refreshAlarm").location.reload(true); //ok


    document.frames("refreshAlarm").document.location.reload(true); //ok


    document.frames("refreshAlarm").document.location="/public/alarmsum.asp";//ok


    document.getElementByIdx_x("refreshAlarm").src="/public/alarmsum.asp"
    mce_src="/public/alarmsum.asp"; //ok


    document.frames("refreshAlarm").src="/public/alarmsum.asp"
    mce_src="/public/alarmsum.asp"; //沒變化,沒動靜


    注意區別,document.all.refreshAlarm 或 document.frames("refreshAlarm")
    得到的是information.asp頁面中那個iframe標簽,所以對src屬性操作有用。
    document.frames("refreshAlarm").document得到iframe里面的內容,也就是"/public/alarmsum.asp"中的內容。


    這里需要補充說明的是:


    采用document.getElementByIdx_x獲取后reload是不可以的


    但是可以這樣


    var myiframe = document.getElementByIdx_x("iframe1");


    myiframe.src = myiframe.src; //這樣同樣可以起到刷新的效果。



    自動刷新頁面



    javascript(js)自動刷新頁面的實現方法總結2008-04-18 13:24
    自動刷新頁面的實現方法總結:


    1)
    <meta
    http-equiv="refresh"content="10;url=跳轉的頁面">
    10表示間隔10秒刷新一次
    2)
    <script
    language=''javascript''>
    window.location.reload(true);
    </script>
    如果是你要刷新某一個iframe就把window給換成frame的名字或ID號
    3)
    <script
    language=''javascript''>
    window.navigate("本頁面url");
    </script>
    4>


    function
    abc()
    {
    window.location.href="/blog/window.location.href";
    setTimeout("abc()",10000);
    }


    刷新本頁:
    Response.Write("<script
    language=javascript>window.location.href=window.location.href;</script>")


    刷新父頁:
    Response.Write("<script
    language=javascript>opener.location.href=opener.location.href;</script>")


    轉到指定頁:
    Response.Write("<script
    language=javascript>window.location.href='yourpage.aspx';</script>")



    刷新頁面實現方式總結(HTML,ASP,JS)
    'by aloxy


    定時刷新:
    1,<script>setTimeout("location.href='url'",2000)</script>


    說明:url是要刷新的頁面URL地址
    2000是等待時間=2秒,


    2,<meta name="Refresh" content="n;url">


    說明:
    n is the number of seconds to wait before loading the specified
    URL.
    url is an absolute URL to be
    loaded.
    n,是等待的時間,以秒為單位
    url是要刷新的頁面URL地址


    3,<%response.redirect url%>


    說明:一般用一個url參數或者表單傳值判斷是否發生某個操作,然后利用response.redirect 刷新。


    4,刷新框架頁
       〈script
    language=javascript>top.leftFrm.location.reload();parent.frmTop.location.reload();</script〉


    彈出窗體后再刷新的問題



    Response.Write("<script>window.showModalDialog('../OA/SPCL.aspx',window,'dialogHeight:
    300px; dialogWidth: 427px; dialogTop: 200px; dialogLeft:
    133px')</script>");//open
                
    Response.Write("<script>document.location=document.location;</script>");


    在子窗體頁面代碼head中加入<base target="_self"/>


    刷新的內容加在    if (!IsPostBack) 中


    在框架頁中右面刷新左面
        //刷新框架頁左半部分
        Response.Write("<script
    language=javascript>");
       
    Response.Write("parent.left.location.href='PayDetailManage_Left.aspx'");
       
    Response.Write("</script>");



    頁面定時刷新功能實現


    有三種方法:
    1,在html中設置:
    <title>xxxxx</title>之後加入下面這一行即可!
    定時刷新:<META
    HTTP-EQUIV="Refresh" content="10">
    10代表刷新間隔,單位為秒


    2.jsp
    <% response.setHeader("refresh","1"); %>
    每一秒刷新一次


    3.使用javascript:
    <script
    language="javascript">
    setTimeout("self.location.reload();",1000);
    <script>
    一秒一次



    頁面自動跳轉:
    1,在html中設置:
    <title>xxxxx</title>之後加入下面這一行即可!
    定時跳轉并刷新:<meta
    http-equiv="refresh"
    content="20;url=http://自己的URL">,
    其中20指隔20秒后跳轉到http://自己的URL 頁面。



    點擊按鈕提交表單后刷新上級窗口


    A窗口打開B窗口


    然后在B里面提交數據至C窗口


    最后要刷新A窗口


    并且關閉B窗口


    幾個javascript函數


    //第一個自動關閉窗口
    <script language="javascript">
    <!--
    function
    clock(){i=i-1
    document.title="本窗口將在"+i+"秒后自動關閉!";
    if(i>0)setTimeout("clock();",1000);
    else
    self.close();}
    var i=2
    clock();
    //-->
    </script>


    //第二個刷新父頁面的函數


    <script
    language="javascript">
    opener.location.reload();
    </script>



    //第三個打開窗口


    <script language="javascript">
    function
    show(mylink,mytitle,width,height)
    {mailwin=window.open(mylink,mytitle,'top=350,left=460,width='+width+',height='+height+',scrollbars=no')}
    </script>

    posted @ 2013-06-02 21:39 一堣而安 閱讀(644) | 評論 (0)編輯 收藏

    java正則表達式 提取、替換(轉)

         摘要: java正則表達式 提取、替換事例1http://www.cnblogs.com/lihuiyy/archive/2012/10/08/2715138.html比如,現在有一個 endlist.txt 文本文件,內容如下:1300102,北京市1300103,北京市1300104,北京市1300105,北京市1300106,北京市1300107,北京市1300108,北京市1300109,北京市1...  閱讀全文

    posted @ 2013-05-31 20:26 一堣而安 閱讀(3024) | 評論 (0)編輯 收藏

    oracle的nvl和sql server的isnull (轉)

    http://www.cnblogs.com/sunyjie/archive/2012/03/26/2417688.html

    最近公司在做Oracle數據庫相關產品,在這里作以小結:

    ISNULL()函數

    語法   
    ISNULL ( check_expression , replacement_value)   
    參數
       check_expression   
       將被檢查是否為    NULL的表達式。check_expression    可以是任何類型的。   
       replacement_value   
       在    check_expression    為    NULL時將返回的表達式。replacement_value    必須與    check_expresssion    具有相同的類型。     
    返回類型
       返回與    check_expression    相同的類型。   
    注釋
       如果    check_expression    不為    NULL,那么返回該表達式的值;否則返回    replacement_value。

    ----------------------------------------------------------------------------------------------

    ----------------------------------------------------------------------------------------------

    nvl( ) 函數

    從兩個表達式返回一個非 null 值。  
    語法
    NVL(eExpression1, eExpression2)   
    參數
    eExpression1, eExpression2   
    如果 eExpression1 的計算結果為 null 值,則 NVL( ) 返回 eExpression2。如果 eExpression1 的計算結果不是 null 值,則返回 eExpression1。eExpression1 和 eExpression2 可以是任意一種數據類型。如果 eExpression1 與 eExpression2 的結果皆為 null 值,則 NVL( ) 返回 .NULL.。   
    返回值類型
    字符型、日期型、日期時間型、數值型、貨幣型、邏輯型或 null 值   
    說明
    在不支持 null 值或 null 值無關緊要的情況下,可以使用 NVL( ) 來移去計算或操作中的 null 值。

    select nvl(a.name,'空得') as name from student a join school b on a.ID=b.ID

    注意:兩個參數得類型要匹配

    posted @ 2013-05-20 20:47 一堣而安 閱讀(282) | 評論 (0)編輯 收藏

    介紹概要設計和詳細設計該寫成什么程度(轉)

    http://wenku.baidu.com/view/78ed49eae009581b6bd9ebae.html

    posted @ 2013-05-07 17:18 一堣而安 閱讀(236) | 評論 (0)編輯 收藏

    僅列出標題
    共17頁: First 上一頁 6 7 8 9 10 11 12 13 14 下一頁 Last 

    導航

    統計

    常用鏈接

    留言簿(1)

    隨筆分類

    隨筆檔案

    收藏夾

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 免费无码毛片一区二区APP| 无码一区二区三区免费视频| 人人狠狠综合久久亚洲高清| 亚洲夂夂婷婷色拍WW47| 在线视频观看免费视频18| 亚洲国产高清美女在线观看| 无码国产精品一区二区免费 | 亚洲午夜在线电影| 另类免费视频一区二区在线观看 | 毛片a级三毛片免费播放| 亚洲七久久之综合七久久| 女人张开腿等男人桶免费视频| 亚洲一卡2卡3卡4卡5卡6卡 | 精品国产综合成人亚洲区| 免费福利在线视频| 亚洲福利电影在线观看| 无码一区二区三区免费视频| 羞羞漫画登录页面免费| 国产亚洲精品线观看动态图| 亚洲一区免费观看| 四虎免费永久在线播放| 色吊丝性永久免费看码| 国产亚洲一区二区精品| 亚洲综合免费视频| 亚洲日韩国产AV无码无码精品 | 婷婷久久久亚洲欧洲日产国码AV| 99久久99热精品免费观看国产| 亚洲一区二区三区91| 男女拍拍拍免费视频网站| 亚洲av午夜成人片精品网站| 无码av免费毛片一区二区| 日韩在线观看免费完整版视频| 亚洲AV无码一区二区三区DV | 亚洲免费日韩无码系列| 久久九九AV免费精品| 亚洲国产精品综合久久网络 | 女人18一级毛片免费观看| 国产乱妇高清无乱码免费| 亚洲美女视频一区| 免费无码毛片一区二区APP| 亚洲国产精品无码久久久秋霞1|