隨筆-88  評(píng)論-77  文章-48  trackbacks-0
            2006年11月28日

          發(fā)布21個(gè)已知被微軟黑屏的序列號(hào)提醒相關(guān)用戶不要冒險(xiǎn)去驗(yàn)證升級(jí)

          發(fā)布21個(gè)已知被微軟黑屏的序列號(hào),提醒使用該序列號(hào)的用戶就不要冒險(xiǎn)去驗(yàn)證升級(jí)了。

          已知被黑屏的序列號(hào)(這21個(gè)序列號(hào)是我今天一個(gè)個(gè)通過(guò)驗(yàn)證測(cè)試出來(lái)的結(jié)果):

          XP8BF-F8HPF-PY6BX-K24PJ-TWT6M 

          F4297-RCWJP-P482C-YY23Y-XH8W3

          HH7VV-6P3G9-82TWK-QKJJ3-MXR96

          HCQ9D-TVCWX-X9QRG-J4B2Y-GR2TT

          MRX3F-47B9T-2487J-KWKMF-RPWBY

          T72KM-6GWBP-GX7TD-CXFT2-7WT2B

          QHYXK-JCJRX-XXY8Y-2KX2X-CCXGD

          DG8FV-B9TKY-FRT9J-6CRCC-XPQ4G

          MFBF7-2CK8B-93MDB-8MR7T-4QRCQ

          MRX3F-47B9T-2487J-KWKMF-RPWBY

          DFXFM-DKWTG-MYDWJ-68DQF-YBCYG

          TB7JC-3VJKY-J3VMR-PP8TP-HMTWY

          KR88V-RCBCB-D78QP-V4FF9-JW77M

          HWCTG-CQPWK-D22DQ-JD7TQ-GXVW8

          Q7TG8-MQ3BK-RHXQC-YDXJD-6Q6M3

          BP6XM-YXMKY-V4Q74-KJP8X-VW3CQ

          BFBPF-TF64Y-BT8T9-DQJFY-3TH7W

          GQ9CX-QDFPR-XFRMF-T3M94-2JG9Y

          XPF44-PDM32-XT4B8-R8W8C-CPP6T

          RC7QJ-KX66J-V4R9W-32HC4-CJH2B

          DDQXW-THQ8M-79V6K-2YFGH-R793Q

          注:但有網(wǎng)友反映MRX3F-47B9T-2487J-KWKMF-RPWBY這個(gè)序列號(hào)有些地方能通過(guò)正版驗(yàn)證,有些地方不能通過(guò)正版驗(yàn)證,看來(lái)微軟這次驗(yàn)證還分蠻細(xì)的,并可以按地區(qū)來(lái)判斷序列號(hào)是否為盜版和正版呀。
          posted @ 2008-10-26 00:40 崛起的程序員 閱讀(379) | 評(píng)論 (0)編輯 收藏

          AJAX 流行之后,總想好好學(xué)習(xí)一下。但是眾多的框架實(shí)在難以選擇。說(shuō)明一下 ASP.NET AJAX 并不包括在 AJAX 框架之中。
          剛開(kāi)始學(xué)了 JQuqery, 眾多的 $get(),...等等符號(hào)早已把我搞暈了。暫時(shí)就放棄了。
          后來(lái)學(xué)習(xí) ASP.NET AJAX ,在微軟的領(lǐng)導(dǎo)下,逐漸由服務(wù)器端轉(zhuǎn)向客戶端編程。 激起我客戶端編程的興趣,
          才想起學(xué)習(xí)一下了 Jquery.
                隨著WEB2.0及ajax思想在互聯(lián)網(wǎng)上的快速發(fā)展傳播,陸續(xù)出現(xiàn)了一些優(yōu)秀的Js框架,其中比較著名的有Prototype、YUI、jQuery、mootools、Bindows以及國(guó)內(nèi)的JSVM框架等,通過(guò)將這些JS框架應(yīng)用到我們的項(xiàng)目中能夠使程序員從設(shè)計(jì)和書寫繁雜的JS應(yīng)用中解脫出來(lái),將關(guān)注點(diǎn)轉(zhuǎn)向功能需求而非實(shí)現(xiàn)細(xì)節(jié)上,從而提高項(xiàng)目的開(kāi)發(fā)速度。
                jQuery是繼prototype之后的又一個(gè)優(yōu)秀的Javascript框架。它是由 John Resig 于 2006 年初創(chuàng)建的,它有助于簡(jiǎn)化 JavaScript™ 以及Ajax 編程。有人使用這樣的一比喻來(lái)比較prototype和jQuery:prototype就像Java,而jQuery就像ruby. 它是一個(gè)簡(jiǎn)潔快速靈活的JavaScript框架,它能讓你在你的網(wǎng)頁(yè)上簡(jiǎn)單的操作文檔、處理事件、實(shí)現(xiàn)特效并為Web頁(yè)面添加Ajax交互。

          它具有如下一些特點(diǎn):
          1、代碼簡(jiǎn)練、語(yǔ)義易懂、學(xué)習(xí)快速、文檔豐富。
          2、jQuery是一個(gè)輕量級(jí)的腳本,其代碼非常小巧,最新版的JavaScript包只有20K左右。
          3、jQuery支持CSS1-CSS3,以及基本的xPath。
          4、jQuery是跨瀏覽器的,它支持的瀏覽器包括IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+。
          5、可以很容易的為jQuery擴(kuò)展其他功能。
          6、能將JS代碼和HTML代碼完全分離,便于代碼和維護(hù)和修改。
          7、插件豐富,除了jQuery本身帶有的一些特效外,可以通過(guò)插件實(shí)現(xiàn)更多功能,如表單驗(yàn)證、tab導(dǎo)航、拖放效果、表格排序、DataGrid,樹(shù)形菜單、圖像特效以及ajax上傳等。

          jQuery的設(shè)計(jì)會(huì)改變你寫JavaScript代碼的方式,降低你學(xué)習(xí)使用JS操作網(wǎng)頁(yè)的復(fù)雜度,提高網(wǎng)頁(yè)JS開(kāi)發(fā)效率,無(wú)論對(duì)于js初學(xué)者還是資深專家,jQuery都將是您的首選。
          jQuery適合于設(shè)計(jì)師、開(kāi)發(fā)者以及那些還好者,同樣適合用于商業(yè)開(kāi)發(fā),可以說(shuō)jQuery適合任何JavaScript應(yīng)用的地方,可用于不同的Web應(yīng)用程序中。
          官方站點(diǎn):http://jquery.com/  中文站點(diǎn):http://jquery.org.cn/

          1.2、目的
          通過(guò)學(xué)習(xí)本文檔,能夠?qū)Query有一個(gè)簡(jiǎn)單的認(rèn)識(shí)了解,清楚JQuery與其他JS框架的不同,掌握jQuery的常用語(yǔ)法、使用技巧及注意事項(xiàng)。

          二、使用方法
          在需要使用JQuery的頁(yè)面中引入JQuery的js文件即可。
          例如:<script type="text/javascript" src="js/jquery.js"></script>
          引入之后便可在頁(yè)面的任意地方使用jQuery提供的語(yǔ)法。

          三、學(xué)習(xí)教程及參考資料
          請(qǐng)參照《jQuery中文API手冊(cè)》和http://jquery.org.cn/visual/cn/index.xml
          推薦兩篇不錯(cuò)的jquery教程:《jQuery的起點(diǎn)教程》和《使用 jQuery 簡(jiǎn)化 Ajax 開(kāi)發(fā)》


          四、語(yǔ)法總結(jié)和注意事項(xiàng)

          1、關(guān)于頁(yè)面元素的引用
          通過(guò)jquery的$()引用元素包括通過(guò)id、class、元素名以及元素的層級(jí)關(guān)系及dom或者xpath條件等方法,且返回的對(duì)象為jquery對(duì)象(集合對(duì)象),不能直接調(diào)用dom定義的方法。

          2、jQuery對(duì)象與dom對(duì)象的轉(zhuǎn)換
          只有jquery對(duì)象才能使用jquery定義的方法。注意dom對(duì)象和jquery對(duì)象是有區(qū)別的,調(diào)用方法時(shí)要注意操作的是dom對(duì)象還是jquery對(duì)象。
          普通的dom對(duì)象一般可以通過(guò)$()轉(zhuǎn)換成jquery對(duì)象。
          如:$(document.getElementById("msg"))則為jquery對(duì)象,可以使用jquery的方法。
          由于jquery對(duì)象本身是一個(gè)集合。所以如果jquery對(duì)象要轉(zhuǎn)換為dom對(duì)象則必須取出其中的某一項(xiàng),一般可通過(guò)索引取出。
          如:$("#msg")[0],$("div").eq(1)[0],$("div").get()[1],$("td")[5]這些都是dom對(duì)象,可以使用dom中的方法,但不能再使用Jquery的方法。
          以下幾種寫法都是正確的:
          $("#msg").html();
          $("#msg")[0].innerHTML;
          $("#msg").eq(0)[0].innerHTML;
          $("#msg").get(0).innerHTML;

          3、如何獲取jQuery集合的某一項(xiàng)
          對(duì)于獲取的元素集合,獲取其中的某一項(xiàng)(通過(guò)索引指定)可以使用eqget(n)方法或者索引號(hào)獲取,要注意,eq返回的是jquery對(duì)象,而get(n)和索引返回的是dom元素對(duì)象。對(duì)于jquery對(duì)象只能使用jquery的方法,而dom對(duì)象只能使用dom的方法,如要獲取第三個(gè)<div>元素的內(nèi)容。有如下兩種方法:
          $("div").eq(2).html();    //調(diào)用jquery對(duì)象的方法
          $("div").get(2).innerHTML;  //調(diào)用dom的方法屬性

          4、同一函數(shù)實(shí)現(xiàn)set和get
          Jquery中的很多方法都是如此,主要包括如下幾個(gè):
          $("#msg").html();    //返回id為msg的元素節(jié)點(diǎn)的html內(nèi)容。
          $("#msg").html("<b>new content</b>");  
          //將“<b>new content</b>” 作為html串寫入id為msg的元素節(jié)點(diǎn)內(nèi)容中,頁(yè)面顯示粗體的new content

          $("#msg").text();    //返回id為msg的元素節(jié)點(diǎn)的文本內(nèi)容。
          $("#msg").text("<b>new content</b>");  
          //將“<b>new content</b>” 作為普通文本串寫入id為msg的元素節(jié)點(diǎn)內(nèi)容中,頁(yè)面顯示<b>new content</b>

          $("#msg").height();    //返回id為msg的元素的高度
          $("#msg").height("300");  //將id為msg的元素的高度設(shè)為300
          $("#msg").width();    //返回id為msg的元素的寬度
          $("#msg").width("300");  //將id為msg的元素的寬度設(shè)為300

          $("input").val(");  //返回表單輸入框的value值
          $("input").val("test");  //將表單輸入框的value值設(shè)為test

          $("#msg").click();  //觸發(fā)id為msg的元素的單擊事件
          $("#msg").click(fn);  //為id為msg的元素單擊事件添加函數(shù)
          同樣blur,focus,select,submit事件都可以有著兩種調(diào)用方法

          5、集合處理功能
          對(duì)于jquery返回的集合內(nèi)容無(wú)需我們自己循環(huán)遍歷并對(duì)每個(gè)對(duì)象分別做處理,jquery已經(jīng)為我們提供的很方便的方法進(jìn)行集合的處理。
          包括兩種形式:
          $("p").each(function(i){this.style.color=['#f00','#0f0','#00f'][i]})  
          //為索引分別為0,1,2的p元素分別設(shè)定不同的字體顏色。

          $("tr").each(function(i){this.style.backgroundColor=['#ccc','#fff'][i%2]})  
          //實(shí)現(xiàn)表格的隔行換色效果

          $("p").click(function(){alert($(this).html())})    
          //為每個(gè)p元素增加了click事件,單擊某個(gè)p元素則彈出其內(nèi)容

          6、擴(kuò)展我們需要的功能
          $.extend({
            min: function(a, b){return a < b?a:b; },
            max: function(a, b){return a > b?a:b; }
          });  //為jquery擴(kuò)展了min,max兩個(gè)方法
          使用擴(kuò)展的方法(通過(guò)“$.方法名”調(diào)用):
          alert("a=10,b=20,max="+$.max(10,20)+",min="+$.min(10,20));

          7、支持方法的連寫
          所謂連寫,即可以對(duì)一個(gè)jquery對(duì)象連續(xù)調(diào)用各種不同的方法。
          例如:
          $("p").click(function(){alert($(this).html())})
          .mouseover(function(){alert('mouse over event')})
          .each(function(i){this.style.color=['#f00','#0f0','#00f'][i]});

          8、操作元素的樣式
          主要包括以下幾種方式:
          $("#msg").css("background");    //返回元素的背景顏色
          $("#msg").css("background","#ccc")  //設(shè)定元素背景為灰色
          $("#msg").height(300); $("#msg").width("200");  //設(shè)定寬高
          $("#msg").css({ color: "red", background: "blue" });//以名值對(duì)的形式設(shè)定樣式
          $("#msg").addClass("select");  //為元素增加名稱為select的class
          $("#msg").removeClass("select");  //刪除元素名稱為select的class
          $("#msg").toggleClass("select");  //如果存在(不存在)就刪除(添加)名稱為select的class

          9、完善的事件處理功能
          Jquery已經(jīng)為我們提供了各種事件處理方法,我們無(wú)需在html元素上直接寫事件,而可以直接為通過(guò)jquery獲取的對(duì)象添加事件。
          如:
          $("#msg").click(function(){alert("good")})  //為元素添加了單擊事件
          $("p").click(function(i){this.style.color=['#f00','#0f0','#00f'][i]})
          //為三個(gè)不同的p元素單擊事件分別設(shè)定不同的處理
          jQuery中幾個(gè)自定義的事件:
          (1)hover(fn1,fn2):一個(gè)模仿懸停事件(鼠標(biāo)移動(dòng)到一個(gè)對(duì)象上面及移出這個(gè)對(duì)象)的方法。當(dāng)鼠標(biāo)移動(dòng)到一個(gè)匹配的元素上面時(shí),會(huì)觸發(fā)指定的第一個(gè)函數(shù)。當(dāng)鼠標(biāo)移出這個(gè)元素時(shí),會(huì)觸發(fā)指定的第二個(gè)函數(shù)。
          //當(dāng)鼠標(biāo)放在表格的某行上時(shí)將class置為over,離開(kāi)時(shí)置為out。
          $("tr").hover(function(){
          $(this).addClass("over");
          },
            function(){
             $(this).addClass("out");
          });
          (2)ready(fn):當(dāng)DOM載入就緒可以查詢及操縱時(shí)綁定一個(gè)要執(zhí)行的函數(shù)。
          $(document).ready(function(){alert("Load Success")})
          //頁(yè)面加載完畢提示“Load Success”,相當(dāng)于onload事件。與$(fn)等價(jià)
          (3)toggle(evenFn,oddFn): 每次點(diǎn)擊時(shí)切換要調(diào)用的函數(shù)。如果點(diǎn)擊了一個(gè)匹配的元素,則觸發(fā)指定的第一個(gè)函數(shù),當(dāng)再次點(diǎn)擊同一元素時(shí),則觸發(fā)指定的第二個(gè)函數(shù)。隨后的每次點(diǎn)擊都重復(fù)對(duì)這兩個(gè)函數(shù)的輪番調(diào)用。
            //每次點(diǎn)擊時(shí)輪換添加和刪除名為selected的class。
            $("p").toggle(function(){
              $(this).addClass("selected");  
            },function(){
               $(this).removeClass("selected");
            });
          (4)trigger(eventtype): 在每一個(gè)匹配的元素上觸發(fā)某類事件。
          例如:
            $("p").trigger("click");    //觸發(fā)所有p元素的click事件
          (5)bind(eventtype,fn),unbind(eventtype): 事件的綁定與反綁定
          從每一個(gè)匹配的元素中(添加)刪除綁定的事件。
          例如:
          $("p").bind("click", function(){alert($(this).text());});  //為每個(gè)p元素添加單擊事件
          $("p").unbind();  //刪除所有p元素上的所有事件
          $("p").unbind("click")  //刪除所有p元素上的單擊事件

          10、幾個(gè)實(shí)用特效功能
          其中toggle()和slidetoggle()方法提供了狀態(tài)切換功能。
          如toggle()方法包括了hide()和show()方法。
          slideToggle()方法包括了slideDown()和slideUp方法。

          11、幾個(gè)有用的jQuery方法
          $.browser.瀏覽器類型:檢測(cè)瀏覽器類型。有效參數(shù):safari, opera, msie, mozilla。如檢測(cè)是否ie:$.browser.isie,是ie瀏覽器則返回true。
          $.each(obj, fn):通用的迭代函數(shù)??捎糜诮频氐鷮?duì)象和數(shù)組(代替循環(huán))。

          $.each( [0,1,2], function(i, n){ alert( "Item #" + i + ": " + n ); });
          等價(jià)于:
          var tempArr=[0,1,2];
          for(var i=0;i<tempArr.length;i++){
            alert("Item #"+i+": "+tempArr[i]);
          }
          也可以處理json數(shù)據(jù),如
          $.each( { name: "John", lang: "JS" }, function(i, n){ alert( "Name: " + i + ", Value: " + n ); });
          結(jié)果為:
          Name:name, Value:John
          Name:lang, Value:JS
          $.extend(target,prop1,propN):用一個(gè)或多個(gè)其他對(duì)象來(lái)擴(kuò)展一個(gè)對(duì)象,返回這個(gè)被擴(kuò)展的對(duì)象。這是jquery實(shí)現(xiàn)的繼承方式。
          如:
          $.extend(settings, options);  
          //合并settings和options,并將合并結(jié)果返回settings中,相當(dāng)于options繼承setting并將繼承結(jié)果保存在setting中。
          var settings = $.extend({}, defaults, options);
          //合并defaults和options,并將合并結(jié)果返回到setting中而不覆蓋default內(nèi)容。
          可以有多個(gè)參數(shù)(合并多項(xiàng)并返回)
          $.map(array, fn):數(shù)組映射。把一個(gè)數(shù)組中的項(xiàng)目(處理轉(zhuǎn)換后)保存到到另一個(gè)新數(shù)組中,并返回生成的新數(shù)組。
          如:
          var tempArr=$.map( [0,1,2], function(i){ return i + 4; });
          tempArr內(nèi)容為:[4,5,6]
          var tempArr=$.map( [0,1,2], function(i){ return i > 0 ? i + 1 : null; });
          tempArr內(nèi)容為:[2,3]
          $.merge(arr1,arr2):合并兩個(gè)數(shù)組并刪除其中重復(fù)的項(xiàng)目。
          如:$.merge( [0,1,2], [2,3,4] )  //返回[0,1,2,3,4]
          $.trim(str):刪除字符串兩端的空白字符。
          如:$.trim("  hello, how are you?   ");   //返回"hello,how are you? "

          12、解決自定義方法或其他類庫(kù)與jQuery的沖突
          很多時(shí)候我們自己定義了$(id)方法來(lái)獲取一個(gè)元素,或者其他的一些js類庫(kù)如prototype也都定義了$方法,如果同時(shí)把這些內(nèi)容放在一起就會(huì)引起變量方法定義沖突,Jquery對(duì)此專門提供了方法用于解決此問(wèn)題。
          使用jquery中的jQuery.noConflict();方法即可把變量$的控制權(quán)讓渡給第一個(gè)實(shí)現(xiàn)它的那個(gè)庫(kù)或之前自定義的$方法。之后應(yīng)用Jquery的時(shí)候只要將所有的$換成jQuery即可,如原來(lái)引用對(duì)象方法$("#msg")改為jQuery("#msg")。
          如:
          jQuery.noConflict();
          // 開(kāi)始使用jQuery
          jQuery("div   p").hide();
          // 使用其他庫(kù)的 $()
          $("content").style.display = 'none';

          posted @ 2008-09-21 21:24 崛起的程序員 閱讀(319) | 評(píng)論 (0)編輯 收藏
          1377-4167-5844-4698-0048-5821
          posted @ 2008-03-02 19:35 崛起的程序員 閱讀(340) | 評(píng)論 (0)編輯 收藏

          Flex License:
          1307-1581-4356-2616-4951-7949 (Commercial Version)
          1307-1581-4356-2939-1231-4484 (Education Version)

          Charting License:

          1301-4581-4356-7349-9369-3351 (Commercial Version)

          posted @ 2008-02-24 21:43 崛起的程序員 閱讀(410) | 評(píng)論 (0)編輯 收藏

          Today we shipped Visual Studio 2008 and .NET 3.5.  You can download the final release using one of the links below:

          • If you are a MSDN subscriber, you can download your copy from the MSDN subscription site (note: some of the builds are just finishing being uploaded now - so check back later during the day if you don't see it yet).

          • If you are a non-MSDN subscriber, you can download a 90-day free trial edition of Visual Studio 2008 Team Suite here.  A 90-day trial edition of Visual Studio 2008 Professional (which will be a slightly smaller download) will be available next week.  A 90-day free trial edition of Team Foundation Server can also be downloaded here.

          • If you want to use the free Visual Studio 2008 Express editions (which are much smaller and totally free), you can download them here

          • If you want to just install the .NET Framework 3.5 runtime, you can download it here.

          Quick Tour of Some of the New Features

          Visual Studio 2008 and .NET 3.5 contain a ton of new functionality and improvements.  Below are links to blog posts I've done myself as well as links to videos you can watch to learn more about it:

          VS 2008 Multi-Targeting Support

          VS 2008 enables you to build applications that target multiple versions of the .NET Framework.  This means you can use VS 2008 to open, edit and build existing .NET 2.0 and ASP.NET 2.0 applications (including ASP.NET 2.0 applications using ASP.NET AJAX 1.0), and continue to deploy these application on .NET 2.0 machines.  You can learn more about how this works from my blog post here:

          ASP.NET AJAX and JavaScript Support

          .NET 3.5 has ASP.NET AJAX built-in (no separate download required).  In addition to including all of the features in ASP.NET AJAX 1.0, ASP.NET 3.5 also now includes richer support for UpdatePanels integrating with WebParts, ASP.NET AJAX integration with controls like <asp:menu> and <asp:treeview>, WCF support for JSON, and many other AJAX improvements.

          VS 2008 and Visual Web Developer 2008 also now have great support for integrating JavaScript and AJAX into your applications.  You can learn more about this from my blog posts here:

          You can watch some videos that discuss ASP.NET AJAX and Visual Studio 2008 support for it here

          I also highly recommend the excellent ASP.NET AJAX in Action book to learn more about ASP.NET AJAX (both client-side and server-side).

          VS 2008 Web Designer and CSS Support

          VS 2008 and Visual Web Developer 2008 Express includes a significantly improved HTML web designer (the same one that ships with Expression Web).  This delivers support for split-view editing, nested master pages, and great CSS integration.  Below are some articles I've written that discuss this more:

          ASP.NET 3.5 also has a new <asp:ListView> control that provides the ability to perform rich data scenarios with total control over the markup.  It works nicely with the new CSS support in VS 2008.  You can learn more about it from my article here:

          You can watch some videos that discuss the new Visual Studio 2008 web designer features and the new ListView/DataPager controls here

          Language Improvements and LINQ

          The new VB and C# compilers in VS 2008 deliver significant improvements to the languages.  Both add functional programming concepts that enable you to write cleaner, terser, and more expressive code.  These features also enable a new programming model we call LINQ (language integrated query) that makes querying and working with data a first-class programming concept with .NET. 

          Below are some of the articles I've written that explore these new language features using C#:

          Here are a few additional blog posts I've written that show off some of the new VS 2008 code editing support and some cool ways to use these new language features:

          The Visual Basic team has also created some great free videos that cover LINQ.  You can watch them here.

          Data Access Improvements with LINQ to SQL

          LINQ to SQL is a built-in OR/M (object relational mapper) in .NET 3.5.  It enables you to model relational databases using a .NET object model.  You can then query the database using LINQ, as well as update/insert/delete data from it.  LINQ to SQL fully supports transactions, views, and stored procedures.  It also provides an easy way to integrate business logic and validation rules into your data model.  Below are some of the articles I've written that explore how to use it:

          I think you'll find that LINQ and LINQ to SQL makes it much easier to build much cleaner data models, and write much cleaner data code.  I'll be adding more posts to my LINQ to SQL series in the weeks and months ahead (sorry for the delay in finishing them earlier - so much to-do and so little time to-do it all!).

          Scott Stanfield is also working on creating some great LINQ to SQL videos for the www.asp.net site based on my article series above (all videos are in both VB and C#).  You can watch the first 4 videos in this series here.

          Browsing the .NET Framework Library Source using Visual Studio

          As I blogged a few weeks ago, we will be releasing a reference version of the .NET Framework library source code as part of this release.  Visual Studio 2008 has built-in debugger support to automatically step-into and debug this code on demand (VS 2008 can pull down the source for the appropriate .NET Framework library file automatically for you).

          We are deploying the source servers to enable this right now, and will be publishing the steps to turn this feature on in the next few weeks.

          Lots of other improvements

          The list above is only a small set of the improvements coming.  For client development VS 2008 includes WPF designer and project support.  ClickOnce and WPF XBAPs now work with FireFox.  WinForms and WPF projects can also now use the ASP.NET Application Services (Membership, Roles, Profile) for roaming user data. 

          Office development is much richer - including support for integrating with the Office 2007 ribbon, and with Outlook.  Visual Studio Tools for Office support is also now built-into Visual Studio (you no longer need to buy a separate product).

          New WCF and Workflow projects and designers are now included in VS 2008.  Unit testing support is now much faster and included in VS Professional (and no longer just VSTS).  Continuous Integration support is now built-in with TFS.  AJAX web testing (unit and load) is now supported in the VS Test SKU.  And there is much, much more...

          Installation Suggestions

          People often ask me for suggestions on how best to upgrade from previous betas of Visual Studio 2008.  In general I'd recommend uninstalling the Beta2 bits explicitly.  As part of this you should uninstall Visual Studio 2008 Beta2, .NET Framework Beta2, as well as the Visual Studio Web Authoring Component (these are all separate installs and need to be uninstalled separately).  I then usually recommend rebooting the machine after uninstalling just to make sure everything is clean before you kick off the new install.  You can then install the final release of VS 2008 and .NET 3.5 on the machine.

          Once installed, I usually recommend explicitly running the Tools->Import and Export Settings menu option, choosing the "Reset Settings" option, and then re-pick your preferred profile.  This helps ensure that older settings from the Beta2 release are no longer around (and sometimes seems to help with performance).

          Note that VS 2008 runs side-by-side with VS 2005 - so it is totally fine to have both on the same machine (you will not have any problems with them on the same box).

          Silverlight Tools and VS Web Deployment Project Add-Ins

          Two popular add-ins to Visual Studio are not yet available to download for the final VS 2008 release.  These are the Silverlight 1.1 Tools Alpha for Visual Studio and the Web Deployment Project add-in for Visual Studio.  Our hope is to post updates to both of them to work with the final VS 2008 release in the next two weeks.  If you are doing Silverlight 1.1 development using VS 2008 Beta2 you'll want to stick with with VS 2008 Beta2 until this updated Silverlight Tools Add-In is available. 

          posted @ 2007-12-02 02:24 崛起的程序員 閱讀(857) | 評(píng)論 (0)編輯 收藏

          PYHYP-WXB3B-B2CCM-V9DX9-VDY8T

          在開(kāi)始>設(shè)置>控制面版>添加或刪除程序>卸載vs.net2008>出現(xiàn)卸載界面>點(diǎn)擊Next>輸入上面CD-key ->出現(xiàn)Success畫面。。激動(dòng)ING

          本人使用的是VS2008 RTM版..


          Microsoft.Visual.Studio.Team.System.2008.Team.Suite-ZWTiSO
          ed2k: Microsoft.Visual.Studio.Team.System.2008.Team.Suite-ZWTiSO.iso  [3.83 Gb]
          ed2k: Microsoft.Visual.Studio.Team.System.2008.Team.Suite-ZWTiSO.nfo  [5.8 Kb]
          [ Add all 2 links to your ed2k client ]

          Microsoft.Visual.Studio.2008.Professional.Edition-ZWTiSO
          ed2k: Microsoft.Visual.Studio.2008.Professional.Edition-ZWTiSO.iso  [3.31 Gb]
          ed2k: Microsoft.Visual.Studio.2008.Professional.Edition-ZWTiSO.nfo  [5.5 Kb]
          [ Add all 2 links to your ed2k client ]

          Microsoft.Visual.Studio.Team.System.2008.Development.Edition
          ed2k: Microsoft.Visual.Studio.Team.System.2008.Development.Edition-ZWTiSO.iso  [3.81 Gb]
          ed2k: Microsoft.Visual.Studio.Team.System.2008.Development.Edition-ZWTiSO.nfo  [5.5 Kb]
          [ Add all 2 links to your ed2k client ]

          Microsoft.Visual.Studio.Team.System.2008.Team.Foundation.Server.Workgroup.Edition-ZWTiSO
          ed2k: Microsoft.Visual.Studio.Team.System.2008.Team.Foundation.Server.Workgroup.Edition-ZWTiSO.iso  [1.29 Gb]
          ed2k: Microsoft.Visual.Studio.Team.System.2008.Team.Foundation.Server.Workgroup.Edition-ZWTiSO.nfo  [5.7 Kb]
          [ Add all 2 links to your ed2k client ]

          Microsoft.Visual.Studio.Team.System.2008.Test.Load.Agent-ZWT
          ed2k: Microsoft.Visual.Studio.Team.System.2008.Test.Load.Agent-ZWTiSO.iso  [551.01 Mb]
          ed2k: Microsoft.Visual.Studio.Team.System.2008.Test.Load.Agent-ZWTiSO.nfo  [5.7 Kb]
          [ Add all 2 links to your ed2k client ]

          posted @ 2007-12-02 02:21 崛起的程序員 閱讀(20634) | 評(píng)論 (30)編輯 收藏

          注冊(cè)機(jī)下載地址

          http://www.aygfsteel.com/Files/ioriqw/Altova%202008.rar
          posted @ 2007-10-30 16:23 崛起的程序員 閱讀(1007) | 評(píng)論 (1)編輯 收藏
               摘要: 在網(wǎng)上找了一圈Ajax的Java框架,感覺(jué)不錯(cuò)的只有兩個(gè),一個(gè)是被提到比較多的DWR(Direct Web Remoting),另一個(gè)是剛剛1.0的Ajax4JSF。本文先用代碼說(shuō)話,各用兩個(gè)框架開(kāi)發(fā)同樣功能的Ajax輸入驗(yàn)證的小程序。在最后表達(dá)一下鄙人對(duì)這兩個(gè)框架的淺見(jiàn)。·程序功能    頁(yè)面上有兩個(gè)輸入框,一個(gè)填用戶名,一個(gè)填密碼。兩個(gè)框空著時(shí)提示...  閱讀全文
          posted @ 2007-08-27 20:17 崛起的程序員 閱讀(573) | 評(píng)論 (0)編輯 收藏
          Go to window-preferences-java-installed jre's- edit
          and add the values
          -Xms512m -Xmx512m -Xss256k
          (or the amount of memory you want)
          eclipse starts tomcat with those values, so your memory problems should be solved
          posted @ 2007-06-10 22:26 崛起的程序員 閱讀(385) | 評(píng)論 (0)編輯 收藏
           
          有個(gè)系統(tǒng)隱藏的文件夾System Volume Information會(huì)達(dá)到1G甚至20G,這是系統(tǒng)還原的文件夾,這個(gè)目錄是WINDOWS對(duì)于大硬盤搜索方便的索引記錄文件!會(huì)在WINDOWS空閑時(shí)自動(dòng)記錄,所以這個(gè)文件夾會(huì)越來(lái)越大,然后PF使用率不斷上升,導(dǎo)致機(jī)器卡住!&W&D.C g V b j [ a
          我們可以禁用這個(gè)自動(dòng)索引功能!打開(kāi)搜索功能->改變首選項(xiàng)->不使用制作索引服務(wù)->不,不要啟用制作索引服務(wù)->確定。還有一件事,就是回到剛才的地方,下面還有一個(gè)“改變制作索引服務(wù)設(shè)置(高級(jí))”,按下去,右鍵彈出的窗口中的那個(gè)索引服務(wù)->刪除,就好了!海騰數(shù)據(jù)中心服務(wù)器論壇 Y \ M z(R1{
          O

          f ?&f t j9Y&] B `
          SystemVolumeInformation\catalog.wci的文件用來(lái)存放索引文件,而且在系統(tǒng)空閑時(shí),Windows會(huì)自動(dòng)讀硬盤更新索引,安裝的文件越多,索引文件會(huì)越來(lái)越大。
                 D Y }&X
          刪除索引服務(wù):海騰數(shù)據(jù)、服務(wù)器論壇聯(lián)盟、win服務(wù)器、代理服務(wù)器,郵件服務(wù)器、代碼、程序、游戲下載、軟件、電腦技術(shù)、設(shè)計(jì)、圖片、信息發(fā)布 N i$y l z:M }
          運(yùn)行msconfig,然后選擇服務(wù)選項(xiàng),找到IndexingService,將前面的小勾去掉,再刪掉文件夾即可。
          posted @ 2007-04-11 10:36 崛起的程序員 閱讀(1438) | 評(píng)論 (0)編輯 收藏

          Introduction

          Changing proxy settings of IE is a frequent requirement of mine. Then I got the idea of writing a tool by myself, at last. I have not found clear instructions on this. Many articles recommend to modify registry directly, but unfortunately their instruction is not enough. Most of them direct me to modify the following values in registry :-

          [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
          "ProxyEnable"=dword:00000001
          "ProxyServer"=":"
          "ProxyOverride"=""
          "DisablePasswordCaching"=dword:00000001
          

          Details

          I tested it and find that it does not work at least on my computer.( I access internet by ADSL connection.) So I backed up registry and modified proxy settings via Internet Explorer, finding that [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections] is also changed. So I wrote the following code snippet to change proxy settings:

          Collapse
          				void ShowError(long lerr)
          {
              LPVOID lpMsgBuf;
              if (!FormatMessage( 
                  FORMAT_MESSAGE_ALLOCATE_BUFFER | 
                  FORMAT_MESSAGE_FROM_SYSTEM | 
                  FORMAT_MESSAGE_IGNORE_INSERTS,
                  NULL,
                  lerr,
                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                  (LPTSTR) &lpMsgBuf,
                  0,
                  NULL ))
              {
                  return;
              }
              MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
              LocalFree( lpMsgBuf );
          }
          void CieproxyDlg::OnBnClickedOk()
          {//set proxy server
              UpdateData();
              GetDlgItemText(IDC_EDIT1,m_sIEProxy);
              HKEY hk;
              LONG lret=RegOpenKeyEx(HKEY_CURRENT_USER,
                  "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
                  NULL,KEY_WRITE|KEY_SET_VALUE,&hk);
              if(lret==ERROR_SUCCESS&&NULL!=hk)
              {
                  TCHAR* pbuf=m_sIEProxy.GetBuffer(1);
                  lret=RegSetValueEx( hk,"ProxyServer",NULL,REG_SZ,pbuf,m_sIEProxy.GetLength());
                  DWORD dwenable=1;
                  lret=RegSetValueEx(hk,"ProxyEnable",NULL,REG_DWORD,
                     (LPBYTE)&dwenable,sizeof(dwenable));
                  RegCloseKey(hk);
              }
              const TCHAR* keyname3=_T(
                "software\\Microsoft\\windows\\currentversion\\Internet Settings\\Connections");
              lret=RegOpenKeyEx(HKEY_CURRENT_USER,keyname3,NULL,
                  KEY_READ|KEY_WRITE|KEY_SET_VALUE,&hk);
              if(lret==ERROR_SUCCESS&&NULL!=hk)
              {
                  DWORD dwtype;
                  char pbuf[256];
                  DWORD dwlen=sizeof(pbuf);
                  constchar* valname="Connection to adsl3";
                  lret=RegQueryValueEx(hk,valname,NULL,&dwtype,pbuf,&dwlen);
                  if(lret!=ERROR_SUCCESS)
                  {
                      ShowError(lret);
                  }
                  pbuf[8] = 3;//enable proxy
                  pbuf[4]=pbuf[4]+1;
                  constchar* p=m_sIEProxy.GetBuffer(1);
                  memcpy(pbuf+16,p,m_sIEProxy.GetLength());
                  char c=0;
                  for(int i=m_sIEProxy.GetLength();i<20;i++)
                      pbuf[16+i]=c;
                  m_sIEProxy.ReleaseBuffer();
                  lret=RegSetValueEx(hk,valname,NULL,REG_BINARY,pbuf,dwlen);
                  RegCloseKey(hk);
              }
              DWORD dwret;
              SendMessageTimeout(HWND_BROADCAST,WM_SETTINGCHANGE,NULL,NULL,
                  SMTO_NORMAL,1000,&dwret);
          }
          
          void CieproxyDlg::OnBnClickedDisableProxy()
          {
              UpdateData();
              GetDlgItemText(IDC_EDIT1,m_sIEProxy);
              HKEY hk;
              LONG lret=RegOpenKeyEx(HKEY_CURRENT_USER,
                  "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
                  NULL,KEY_WRITE|KEY_SET_VALUE,&hk);
              if(lret==ERROR_SUCCESS&&NULL!=hk)
              {
                  DWORD dwenable=0;
                  lret=RegSetValueEx(hk,"ProxyEnable",NULL,REG_DWORD,
                      (LPBYTE)&dwenable,sizeof(dwenable));
                  RegCloseKey(hk);
              }
              const TCHAR* keyname3=_T(
                "software\\Microsoft\\windows\\currentversion\\Internet Settings\\Connections");
              lret=RegOpenKeyEx(HKEY_CURRENT_USER,keyname3,
                  NULL,KEY_READ|KEY_WRITE|KEY_SET_VALUE,&hk);
              if(lret==ERROR_SUCCESS&&NULL!=hk)
              {
                  DWORD dwtype;
                  char pbuf[256];
                  DWORD dwlen=sizeof(pbuf);
                  constchar* valname="Connection to adsl3";
                  lret=RegQueryValueEx(hk,valname,NULL,&dwtype,pbuf,&dwlen);
                  if(lret!=ERROR_SUCCESS)
                  {
                      ShowError(lret);
                  }
                  pbuf[8] = 1;//enable proxy
                  pbuf[4]=pbuf[4]+1;
                  lret=RegSetValueEx(hk,valname,NULL,REG_BINARY,pbuf,dwlen);
                  RegCloseKey(hk);
              }
              DWORD dwret;
              SendMessageTimeout(HWND_BROADCAST,WM_SETTINGCHANGE,NULL,NULL,SMTO_NORMAL,
                  1000,&dwret);
          }

          Problem with above code is that existing Internet Explorer instances don't know the change of settings. What is more, changing registry directly is not an elegant method. Then the following must be more attractive :

          Collapse
          BOOL SetConnectionOptions(LPCTSTR conn_name,LPCTSTR proxy_full_addr)
          {
              //conn_name: active connection name. //proxy_full_addr : eg "210.78.22.87:8000"
              INTERNET_PER_CONN_OPTION_LIST list;
              BOOL    bReturn;
              DWORD   dwBufSize = sizeof(list);
              // Fill out list struct.
              list.dwSize = sizeof(list);
              // NULL == LAN, otherwise connectoid name.
              list.pszConnection = conn_name;
              // Set three options.
              list.dwOptionCount = 3;
              list.pOptions = new INTERNET_PER_CONN_OPTION[3];
              // Make sure the memory was allocated.if(NULL == list.pOptions)
              {
                  // Return FALSE if the memory wasn't allocated.
                  OutputDebugString("failed to allocat memory in SetConnectionOptions()");
                  return FALSE;
              }
              // Set flags.
              list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
              list.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT |
                  PROXY_TYPE_PROXY;
          
              // Set proxy name.
              list.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
              list.pOptions[1].Value.pszValue = proxy_full_addr;//"http://proxy:80";// Set proxy override.
              list.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
              list.pOptions[2].Value.pszValue = "local";
          
              // Set the options on the connection.
              bReturn = InternetSetOption(NULL,
                  INTERNET_OPTION_PER_CONNECTION_OPTION, &list, dwBufSize);
          
              // Free the allocated memory.delete [] list.pOptions;
              InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
              InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
              return bReturn;
          }
          BOOL DisableConnectionProxy(LPCTSTR conn_name)
          {
              //conn_name: active connection name. 
              INTERNET_PER_CONN_OPTION_LIST list;
              BOOL    bReturn;
              DWORD   dwBufSize = sizeof(list);
              // Fill out list struct.
              list.dwSize = sizeof(list);
              // NULL == LAN, otherwise connectoid name.
              list.pszConnection = conn_name;
              // Set three options.
              list.dwOptionCount = 1;
              list.pOptions = new INTERNET_PER_CONN_OPTION[list.dwOptionCount];
              // Make sure the memory was allocated.if(NULL == list.pOptions)
              {
                  // Return FALSE if the memory wasn't allocated.
                  OutputDebugString("failed to allocat memory in DisableConnectionProxy()");
                  return FALSE;
              }
              // Set flags.
              list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
              list.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT  ;
              // Set the options on the connection.
              bReturn = InternetSetOption(NULL,
                  INTERNET_OPTION_PER_CONNECTION_OPTION, &list, dwBufSize);
              // Free the allocated memory.delete [] list.pOptions;
              InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
              InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
              return bReturn;
          }

          The usage is very straightforward:

          				//set proxy
          				const
          				char* connection_name="Connection to adsl3";
              SetConnectionOptions(connection_name,"62.81.236.23:80");
          //disable proxy 
              DisableConnectionProxy(connection_name);
              

          Existing Internet Explorer instances are notified by INTERNET_OPTION_SETTINGS_CHANGED and INTERNET_OPTION_REFRESH

          posted @ 2007-01-25 20:13 崛起的程序員 閱讀(889) | 評(píng)論 (0)編輯 收藏
          Hot Spot JVM5中的GC調(diào)優(yōu)

          Written by Halatu Hubisi


          引言
          有JAVA開(kāi)發(fā)經(jīng)驗(yàn)的朋友們一定碰到過(guò)下面的這種情況,那就是自己所開(kāi)發(fā)的應(yīng)用運(yùn)行了一段時(shí)間后其性能或者響應(yīng)速度會(huì)有明顯的降低.這是由多方面的原因造成的即有程序本身的優(yōu)化問(wèn)題,也有運(yùn)行環(huán)境問(wèn)題.此運(yùn)行環(huán)境即包括硬件環(huán)境也包括軟件環(huán)境.大多數(shù)人第一個(gè)能想到的解決方法是提升硬件的配置而忽略了程序本身的運(yùn)行環(huán)境JVM也提供了比較多的調(diào)優(yōu)選項(xiàng).本文將重點(diǎn)描述利用JVM的一些選項(xiàng)對(duì)GC進(jìn)行調(diào)優(yōu).

          約定:
          1.讀者應(yīng)具備一定JAVA的知識(shí).

          2.本文中的JVM選項(xiàng)均以SUN公司發(fā)布的HotSpot JVM 5為準(zhǔn)(不過(guò)大多數(shù)的選項(xiàng)在JVM1.3,JVM1.4中也是可用的).

          3.以JAVA_HOME下demo/jfc/SwingSet2/SwingSet2.jar為例進(jìn)行說(shuō)明.

          4.閱讀本文需要一些關(guān)于GC的知識(shí),可以到附錄A中了解這些知識(shí)。

          關(guān)鍵字:
          JVM(java虛擬機(jī)),調(diào)優(yōu),GC(垃圾回收)

          JVM GC調(diào)優(yōu)
          為了能夠?qū)VM GC的調(diào)優(yōu)能夠使用在具體的實(shí)踐當(dāng)中,下面將利用若干個(gè)例子來(lái)說(shuō)明GC的調(diào)優(yōu).
          例1:Heap size 設(shè)置
          JVM堆的設(shè)置是指java程序運(yùn)行過(guò)程中JVM可以調(diào)配使用的內(nèi)存空間的設(shè)置.JVM在啟動(dòng)的時(shí)候會(huì)自動(dòng)設(shè)置Heap size的值,其初始空間(即-Xms)是物理內(nèi)存的1/64,最大空間(-Xmx)是物理內(nèi)存的1/4??梢岳肑VM提供的-Xmn -Xms -Xmx等選項(xiàng)可進(jìn)行設(shè)置。Heap size 的大小是Young Generation 和Tenured Generaion 之和。
          當(dāng)在JAVA_HOME下demo/jfc/SwingSet2/目錄下執(zhí)行下面的命令。
          java -jar -Xmn4m -Xms16m -Xmx16m SwingSet2.jar
          系統(tǒng)輸出為:
          Exception in thread "Image Fetcher 0" java.lang.OutOfMemoryError: Java heap space
          Exception in thread "Image Fetcher 3" java.lang.OutOfMemoryError: Java heap space
          Exception in thread "Image Fetcher 1" java.lang.OutOfMemoryError: Java heap space
          Exception in thread "Image Fetcher 2" java.lang.OutOfMemoryError: Java heap space
          除了這些異常信息外,還會(huì)發(fā)現(xiàn)程序的響應(yīng)速度變慢了。這說(shuō)明Heap size 設(shè)置偏小,GC占用了更多的時(shí)間,而應(yīng)用分配到的執(zhí)行時(shí)間較少。
          提示:在JVM中如果98%的時(shí)間是用于GC且可用的Heap size 不足2%的時(shí)候?qū)伋龃水惓P畔ⅰ?/span>
          將上面的命令換成以下命令執(zhí)行則應(yīng)用能夠正常使用,且未拋出任何異常。
          java -jar -Xmn4m -Xms16m -Xmx32m SwingSet2.jar
          提示:Heap Size 最大不要超過(guò)可用物理內(nèi)存的80%,一般的要將-Xms和-Xmx選項(xiàng)設(shè)置為相同,而-Xmn為1/4的-Xmx值。

          例2:Young Generation(-Xmn)的設(shè)置
          在本例中看一下Young Generation的設(shè)置不同將有什么現(xiàn)象發(fā)生。
          假設(shè)將Young generation 的大小設(shè)置為4M ,即執(zhí)行java -jar -verbose:gc -Xmn4m -Xms32m -Xmx32m -XX:+PrintGCDetails SwingSet2.jar,屏幕輸出如下(節(jié)選)
          [GC [DefNew: 3968K->64K(4032K), 0.0923407 secs] 3968K->2025K(32704K), 0.0931870 secs]
          [GC [DefNew: 4021K->64K(4032K), 0.0356847 secs] 5983K->2347K(32704K), 0.0365441 secs]
          [GC [DefNew: 3995K->39K(4032K), 0.0090603 secs] 6279K->2372K(32704K), 0.0093377 secs]
          [GC [DefNew: 3992K->23K(4032K), 0.0057540 secs] 6325K->2356K(32704K), 0.0060290 secs]
          [GC [DefNew: 3984K->27K(4032K), 0.0013058 secs] 6317K->2360K(32704K), 0.0015888 secs]
          [GC [DefNew: 3981K->59K(4032K), 0.0023307 secs] 6315K->2422K(32704K), 0.0026091 secs]
          將程序體制并將Young Generation的大小設(shè)置為8M,即執(zhí)行java -jar -verbose:gc -Xmn8m -Xms32m -Xmx32m -XX:+PrintGCDetails SwingSet2.jar,屏幕輸出如下(節(jié)選)
          [GC [DefNew: 7808K->192K(8000K), 0.1016784 secs] 7808K->2357K(32576K), 0.1022834 secs]
          [GC [DefNew: 8000K->70K(8000K), 0.0149659 secs] 10165K->2413K(32576K), 0.0152557 secs]
          [GC [DefNew: 7853K->59K(8000K), 0.0069122 secs] 10196K->2403K(32576K), 0.0071843 secs]
          [GC [DefNew: 7867K->171K(8000K), 0.0075745 secs] 10211K->2681K(32576K), 0.0078376 secs]
          [GC [DefNew: 7970K->192K(8000K), 0.0201353 secs] 10480K->2923K(32576K), 0.0206867 secs]
          [GC [DefNew: 7979K->30K(8000K), 0.1787079 secs] 10735K->4824K(32576K), 0.1790065 secs]
          那么根據(jù)GC輸出的信息(這里取第一行)做一下Minor收集的比較??梢钥闯鰞纱蔚腗inor收集分別在Young generation中找回3904K(3968K->64K)和7616K(7808K->192K)而對(duì)于整個(gè)jvm則找回1943K(3968K->2025)和5451K(7808K->2357K)。第一種情況下Minor收集了大約50%(1943/3904)的對(duì)象,而另外的50%的對(duì)象則被移到了tenured generation。在第二中情況下Minor收集了大約72%的對(duì)象,只有不到30%的對(duì)象被移到了Tenured Generation.這個(gè)例子說(shuō)明此應(yīng)用在的Young generation 設(shè)置為4m時(shí)顯的偏小。
          提示:一般的Young Generation的大小是整個(gè)Heap size的1/4。Young generation的minor收集率應(yīng)一般在70%以上。當(dāng)然在實(shí)際的應(yīng)用中需要根據(jù)具體情況進(jìn)行調(diào)整。

          例3:Young Generation對(duì)應(yīng)用響應(yīng)的影響
          還是使用-Xmn4m 和-Xmn8m進(jìn)行比較,先執(zhí)行下面的命令

          java -jar -verbose:gc -Xmn4m -Xms32m -Xmx32m -XX:+PrintGCDetails -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime SwingSet2.jar
          屏幕輸出如下(節(jié)選)
          Application time: 0.5114944 seconds
          [GC [DefNew: 3968K->64K(4032K), 0.0823952 secs] 3968K->2023K(32704K), 0.0827626 secs]
          Total time for which application threads were stopped: 0.0839428 seconds
          Application time: 0.9871271 seconds
          [GC [DefNew: 4020K->64K(4032K), 0.0412448 secs] 5979K->2374K(32704K), 0.0415248 secs]
          Total time for which application threads were stopped: 0.0464380 seconds
          Young Generation 的Minor收集占用的時(shí)間可以計(jì)算如下:應(yīng)用線程被中斷的總時(shí)常/(應(yīng)用執(zhí)行總時(shí)?L+應(yīng)用線程被中斷的總時(shí)常),那么在本例中垃圾收集占用的時(shí)?L約為系統(tǒng)的5%~14%。那么當(dāng)垃圾收集占用的時(shí)間的比例越大的時(shí)候,系統(tǒng)的響應(yīng)將越慢。
          提示:對(duì)于互聯(lián)網(wǎng)應(yīng)用系統(tǒng)的響應(yīng)稍微慢一些,用戶是可以接受的,但是對(duì)于GUI類型的應(yīng)用響應(yīng)速度慢將會(huì)給用戶帶來(lái)非常不好的體驗(yàn)。

          例4:如何決定Tenured Generation 的大小
          分別以-Xmn8m -Xmx32m和-Xmn8m -Xmx64m進(jìn)行對(duì)比,先執(zhí)行
          java -verbose:gc -Xmn8m -Xmx32m-XX:+PririntGCDetails -XX:+PrintGCTimeStamps java類,命令行將提示(只提取了Major收集)

          111.042: [GC 111.042: [DefNew: 8128K->8128K(8128K), 0.0000505 secs]111.042: [Tenured: 18154K->2311K(24576K), 0.1290354 secs] 26282K->2311K(32704K), 0.1293306 secs]
          122.463: [GC 122.463: [DefNew: 8128K->8128K(8128K), 0.0000560 secs]122.463: [Tenured: 18630K->2366K(24576K), 0.1322560 secs] 26758K->2366K(32704K), 0.1325284 secs]
          133.896: [GC 133.897: [DefNew: 8128K->8128K(8128K), 0.0000443 secs]133.897: [Tenured: 18240K->2573K(24576K), 0.1340199 secs] 26368K->2573K(32704K), 0.1343218 secs]
          144.112: [GC 144.112: [DefNew: 8128K->8128K(8128K), 0.0000544 secs]144.112: [Tenured: 16564K->2304K(24576K), 0.1246831 secs] 24692K->2304K(32704K), 0.1249602 secs]
          再執(zhí)行java -verbose:gc -Xmn8m -Xmx64m-XX:+PririntGCDetails -XX:+PrintGCTimeStamps java類,命令行將提示(只提取了Major收集)
          90.597: [GC 90.597: [DefNew: 8128K->8128K(8128K), 0.0000542 secs]90.597: [Tenured: 49841K->5141K(57344K), 0.2129882 secs] 57969K->5141K(65472K), 0.2133274 secs]
          120.899: [GC 120.899: [DefNew: 8128K->8128K(8128K), 0.0000550 secs]120.899: [Tenured: 50384K->2430K(57344K), 0.2216590 secs] 58512K->2430K(65472K), 0.2219384 secs]
          153.968: [GC 153.968: [DefNew: 8128K->8128K(8128K), 0.0000511 secs]153.968: [Tenured: 51164K->2309K(57344K), 0.2193906 secs] 59292K->2309K(65472K), 0.2196372 secs]
          可以看出在Heap size 為32m的時(shí)候系統(tǒng)等候時(shí)間約為0.13秒左右,而設(shè)置為64m的時(shí)候等候時(shí)間則增大到0.22秒左右了。但是在32m的時(shí)候系統(tǒng)的Major收集間隔為10秒左右,而Heap size 增加到64m的時(shí)候?yàn)?0秒。那么應(yīng)用在運(yùn)行的時(shí)候是選擇32m還是64m呢?如果應(yīng)用是web類型(即要求有大的吞吐量)的應(yīng)用則使用64m(即heapsize大一些)的比較好。對(duì)于要求實(shí)時(shí)響應(yīng)要求較高的場(chǎng)合(例如GUI型的應(yīng)用)則使用32m比較好一些。
          注意:
          1。因?yàn)樵贘VM5運(yùn)行時(shí)已經(jīng)對(duì)Heap-size進(jìn)行了優(yōu)化,所以在能確定java應(yīng)用運(yùn)行時(shí)不會(huì)超過(guò)默認(rèn)的Heap size的情況下建議不要對(duì)這些值進(jìn)行修改。
          2。Heap size的 -Xms -Xmn 設(shè)置不要超出物理內(nèi)存的大小。否則會(huì)提示“Error occurred during initialization of VM Could not reserve enough space for object heap”。

          例5:如何縮短minor收集的時(shí)間
          下面比較一下采用-XX:+UseParNewGC選項(xiàng)和不采用它的時(shí)候的minor收集將有什么不同。先執(zhí)行
          java -jar -server -verbose:gc -Xmn8m -Xms32m -Xmx32m SwingSet2.jar
          系統(tǒng)將輸出如下信息(片段〕
          [GC 7807K->2641K(32576K), 0.0676654 secs]
          [GC 10436K->3108K(32576K), 0.0245328 secs]
          [GC 10913K->3176K(32576K), 0.0072865 secs]
          [GC 10905K->4097K(32576K), 0.0223928 secs]
          之后再執(zhí)行 java -jar -server -verbose:gc -XX:+UseParNewGC -Xmn8m -Xms32m -Xmx32m SwingSet2.jar
          系統(tǒng)將輸出如下信息(片段〕
          [ParNew 7808K->2656K(32576K), 0.0447687 secs]
          [ParNew 10441K->3143K(32576K), 0.0179422 secs]
          [ParNew 10951K->3177K(32576K), 0.0031914 secs]
          [ParNew 10985K->3867K(32576K), 0.0154991 secs]
          很顯然使用了-XX:+UseParNewGC選項(xiàng)的minor收集的時(shí)間要比不使用的時(shí)候優(yōu)。

          例6:如何縮短major收集的時(shí)間
          下面比較一下采用-XX:+UseConcMarkSweepGC選項(xiàng)和不采用它的時(shí)候的major收集將有什么不同。先執(zhí)行
          java -jar -verbose:gc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Xmn64m -Xms256m -Xmx256m SwingSet2.jar
          系統(tǒng)將輸出如下信息(片段〕
          [Full GC 22972K->18690K(262080K), 0.2326676 secs]
          [Full GC 18690K->18690K(262080K), 0.1701866 secs
          之后再執(zhí)行 java -jar -verbose:gc -XX:+UseParNewGC -Xmn64m -Xms256m -Xmx256m SwingSet2.jar
          系統(tǒng)將輸出如下信息(片段〕
          [Full GC 56048K->18869K(260224K), 0.3104852 secs]
          提示:此選項(xiàng)在Heap Size 比較大而且Major收集時(shí)間較長(zhǎng)的情況下使用更合適。

          例7:關(guān)于-server選項(xiàng) 在JVM中將運(yùn)行中的類認(rèn)定為server-class的時(shí)候使用此選項(xiàng)。SUN 的Hot Spot JVM5 如果判斷到系統(tǒng)的配置滿足如下條件則自動(dòng)將運(yùn)行的類認(rèn)定為server-class,并且會(huì)自動(dòng)設(shè)置jvm的選項(xiàng)(當(dāng)沒(méi)有手工設(shè)置這選項(xiàng)的時(shí)候〕而且HOTSPOT JVM5提供了自動(dòng)調(diào)優(yōu)的功能,他會(huì)根據(jù)JVM的運(yùn)行情況進(jìn)行調(diào)整。如果沒(méi)有特別的需要是不需要太多的人工干預(yù)的。SUN形象的稱這個(gè)機(jī)制為“人體工學(xué)”(Ergonomics〕。具體可以參考http://java.sun.com/docs/hotspot/gc5.0/ergo5.html
          *.具有2個(gè)或更多個(gè)物理的處理器
          *.具有2G或者更多的物理內(nèi)存
          提示:此選項(xiàng)要放在所有選項(xiàng)的前面。例如:java -server 其他選項(xiàng) java類

          附錄A:預(yù)備知識(shí)
          JVM中對(duì)象的劃分及管理

          JVM根據(jù)運(yùn)行于其中的對(duì)象的生存時(shí)間大致的分為3種。并且將這3種不同的對(duì)象分別存放在JVM從系統(tǒng)分配到的不同的內(nèi)存空間。這種對(duì)象存放空間的管理方式叫做Generation管理方式。
          1。Young Generation:用于存放“早逝”對(duì)象(即瞬時(shí)對(duì)象)。例如:在創(chuàng)建對(duì)象時(shí)或者調(diào)用方法時(shí)使用的臨時(shí)對(duì)象或局部變量。
          2。Tenured Generation:用于存放“駐留”對(duì)象(即較長(zhǎng)時(shí)間被引用的對(duì)象)。往往體現(xiàn)為一個(gè)大型程序中的全局對(duì)象或長(zhǎng)時(shí)間被使用的對(duì)象。
          3。Perm Generation:用于存放“永久”對(duì)象。這些對(duì)象管理著運(yùn)行于JVM中的類和方法。

          JVM選項(xiàng)的分類

          JVM有這么幾種選項(xiàng)供使用.
          1.供-X選項(xiàng)使用的項(xiàng)目,又稱為非標(biāo)準(zhǔn)選項(xiàng),不同廠商的此類型選項(xiàng)是有所不同的。例如:IBM的JVM用的一些選項(xiàng)在Sun的JVM中就不一定能生效。這種選項(xiàng)的使用方式如下:
          java -Xmn16m -Xms64m -Xmx64m java類名
          2.供-XX選項(xiàng)使用的項(xiàng)目,這種類型的選項(xiàng)可能要求有對(duì)系統(tǒng)信息訪問(wèn)的權(quán)限。所以要慎用。這種選項(xiàng)的使用方式如下:
          java -XX:MaxHeapFreeRatio=70 -XX:+PrintGCDetails java類名
          3.java選項(xiàng)(即在命令行執(zhí)行java后提示的選項(xiàng)).
          java -server -verbose:gc -d64 java類名

          垃圾收集分類

          在JVM中有兩種垃圾方式,一種叫做Minor(次收集),另一種叫做Major(主收集)。其中Minor在Young Generation的空間被對(duì)象全部占用后執(zhí)行,主要是對(duì)Young Generation中的對(duì)象進(jìn)行垃圾收集。而Major是針對(duì)于整個(gè)Heap size的垃圾收集。其中Minor方式的收集經(jīng)常發(fā)生,并且Minor收集所占用的系統(tǒng)時(shí)間小。Major方式的垃圾收集則是一種“昂貴”的垃圾收集方式,因?yàn)樵贛ajor要對(duì)整個(gè)Heap size進(jìn)行垃圾收集,這會(huì)使得應(yīng)用停頓的時(shí)間變得較長(zhǎng)。

          GC信息的格式

          [GC [<collector>: <starting occupancy1> -> <ending occupancy1>, <pause time1> secs] <starting occupancy3> -> <ending occupancy3>, <pause time3> secs]
          <collector> GC為minor收集過(guò)程中使用的垃圾收集器起的內(nèi)部名稱.
          <starting occupancy1> young generation 在進(jìn)行垃圾收集前被對(duì)象使用的存儲(chǔ)空間.
          <ending occupancy1> young generation 在進(jìn)行垃圾收集后被對(duì)象使用的存儲(chǔ)空間
          <pause time1> minor收集使應(yīng)用暫停的時(shí)間長(zhǎng)短(秒)
          <starting occupancy3> 整個(gè)堆(Heap Size)在進(jìn)行垃圾收集前被對(duì)象使用的存儲(chǔ)空間
          <ending occupancy3> 整個(gè)堆(Heap Size)在進(jìn)行垃圾收集后被對(duì)象使用的存儲(chǔ)空間
          <pause time3> 整個(gè)垃圾收集使應(yīng)用暫停的時(shí)間長(zhǎng)短(秒),包括major收集使應(yīng)用暫停的時(shí)間(如果發(fā)生了major收集).
          GC信息的選項(xiàng)
          -XX:+PrintGCDetails 顯示GC的詳細(xì)信息
          -XX:+PrintGCApplicationConcurrentTime 打印應(yīng)用執(zhí)行的時(shí)間
          -XX:+PrintGCApplicationStoppedTime 打印應(yīng)用被暫停的時(shí)間
          提示:1.":"后的"+"號(hào)表示開(kāi)啟此選項(xiàng),如果是"-"號(hào)那么表示關(guān)閉此選項(xiàng)。
          ?????2.在不同的選項(xiàng)和不同的收集方式和類型下輸出的格式會(huì)有所不同。

          附錄B:HotSpot JVM 選項(xiàng)
          請(qǐng)參考JavaTM HotSpot VM Options

          附錄C:其他資源
          http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
          http://java.sun.com/docs/hotspot/gc5.0/ergo5.html

          posted @ 2006-11-28 19:23 崛起的程序員 閱讀(442) | 評(píng)論 (0)編輯 收藏
          主站蜘蛛池模板: 昆山市| 潍坊市| 镇沅| 昌黎县| 交城县| 江津市| 吉林省| 蒙山县| 安平县| 仙游县| 汝城县| 普安县| 玉门市| 定西市| 禄丰县| 皋兰县| 日土县| 中方县| 长汀县| 平阳县| 涿鹿县| 甘泉县| 江陵县| 柏乡县| 汕头市| 磴口县| 黎平县| 昌图县| 定州市| 乐安县| 平利县| 辽阳县| 长顺县| 手机| 乾安县| 唐海县| 寿光市| 石首市| 沙坪坝区| 三门峡市| 天峨县|