随笔-88  评论-77  文章-48  trackbacks-0
  2006年11月9日

发布21个已知被微软黑屏的序列号提醒相关用户不要冒险去验证升级

发布21个已知被微软黑屏的序列号,提醒使用该序列号的用户就不要冒险去验证升级了。

已知被黑屏的序列号(这21个序列号是我今天一个个通过验证测试出来的结果):

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

注:但有网友反映MRX3F-47B9T-2487J-KWKMF-RPWBY这个序列号有些地方能通过正版验证,有些地方不能通过正版验证,看来微软这次验证还分蛮细的,并可以按地区来判断序列号是否为盗版和正版呀。
posted @ 2008-10-26 00:40 崛起的程序员 阅读(357) | 评论 (0)编辑 收藏

AJAX 流行之后,总想好好学习一下。但是众多的框架实在难以选择。说明一下 ASP.NET AJAX 并不包括在 AJAX 框架之中。
刚开始学了 JQuqery, 众多的 $get(),...等等符号早已把我搞晕了。暂时就放弃了。
后来学习 ASP.NET AJAX ,在微软的领导下,逐渐由服务器端转向客户端编程。 激起我客户端编程的兴趣,
才想起学习一下了 Jquery.
      随着WEB2.0及ajax思想在互联网上的快速发展传播,陆续出现了一些优秀的Js框架,其中比较著名的有Prototype、YUI、jQuery、mootools、Bindows以及国内的JSVM框架等,通过将这些JS框架应用到我们的项目中能够使程序员从设计和书写繁杂的JS应用中解脱出来,将关注点转向功能需求而非实现细节上,从而提高项目的开发速度。
      jQuery是继prototype之后的又一个优秀的Javascript框架。它是由 John Resig 于 2006 年初创建的,它有助于简化 JavaScript™ 以及Ajax 编程。有人使用这样的一比喻来比较prototype和jQuery:prototype就像Java,而jQuery就像ruby. 它是一个简洁快速灵活的JavaScript框架,它能让你在你的网页上简单的操作文档、处理事件、实现特效并为Web页面添加Ajax交互。

它具有如下一些特点:
1、代码简练、语义易懂、学习快速、文档丰富。
2、jQuery是一个轻量级的脚本,其代码非常小巧,最新版的JavaScript包只有20K左右。
3、jQuery支持CSS1-CSS3,以及基本的xPath。
4、jQuery是跨浏览器的,它支持的浏览器包括IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+。
5、可以很容易的为jQuery扩展其他功能。
6、能将JS代码和HTML代码完全分离,便于代码和维护和修改。
7、插件丰富,除了jQuery本身带有的一些特效外,可以通过插件实现更多功能,如表单验证、tab导航、拖放效果、表格排序、DataGrid,树形菜单、图像特效以及ajax上传等。

jQuery的设计会改变你写JavaScript代码的方式,降低你学习使用JS操作网页的复杂度,提高网页JS开发效率,无论对于js初学者还是资深专家,jQuery都将是您的首选。
jQuery适合于设计师、开发者以及那些还好者,同样适合用于商业开发,可以说jQuery适合任何JavaScript应用的地方,可用于不同的Web应用程序中。
官方站点:http://jquery.com/  中文站点:http://jquery.org.cn/

1.2、目的
通过学习本文档,能够对jQuery有一个简单的认识了解,清楚JQuery与其他JS框架的不同,掌握jQuery的常用语法、使用技巧及注意事项。

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

三、学习教程及参考资料
请参照《jQuery中文API手册》和http://jquery.org.cn/visual/cn/index.xml
推荐两篇不错的jquery教程:《jQuery的起点教程》和《使用 jQuery 简化 Ajax 开发》


四、语法总结和注意事项

1、关于页面元素的引用
通过jquery的$()引用元素包括通过id、class、元素名以及元素的层级关系及dom或者xpath条件等方法,且返回的对象为jquery对象(集合对象),不能直接调用dom定义的方法。

2、jQuery对象与dom对象的转换
只有jquery对象才能使用jquery定义的方法。注意dom对象和jquery对象是有区别的,调用方法时要注意操作的是dom对象还是jquery对象。
普通的dom对象一般可以通过$()转换成jquery对象。
如:$(document.getElementById("msg"))则为jquery对象,可以使用jquery的方法。
由于jquery对象本身是一个集合。所以如果jquery对象要转换为dom对象则必须取出其中的某一项,一般可通过索引取出。
如:$("#msg")[0],$("div").eq(1)[0],$("div").get()[1],$("td")[5]这些都是dom对象,可以使用dom中的方法,但不能再使用Jquery的方法。
以下几种写法都是正确的:
$("#msg").html();
$("#msg")[0].innerHTML;
$("#msg").eq(0)[0].innerHTML;
$("#msg").get(0).innerHTML;

3、如何获取jQuery集合的某一项
对于获取的元素集合,获取其中的某一项(通过索引指定)可以使用eqget(n)方法或者索引号获取,要注意,eq返回的是jquery对象,而get(n)和索引返回的是dom元素对象。对于jquery对象只能使用jquery的方法,而dom对象只能使用dom的方法,如要获取第三个<div>元素的内容。有如下两种方法:
$("div").eq(2).html();    //调用jquery对象的方法
$("div").get(2).innerHTML;  //调用dom的方法属性

4、同一函数实现set和get
Jquery中的很多方法都是如此,主要包括如下几个:
$("#msg").html();    //返回id为msg的元素节点的html内容。
$("#msg").html("<b>new content</b>");  
//将“<b>new content</b>” 作为html串写入id为msg的元素节点内容中,页面显示粗体的new content

$("#msg").text();    //返回id为msg的元素节点的文本内容。
$("#msg").text("<b>new content</b>");  
//将“<b>new content</b>” 作为普通文本串写入id为msg的元素节点内容中,页面显示<b>new content</b>

$("#msg").height();    //返回id为msg的元素的高度
$("#msg").height("300");  //将id为msg的元素的高度设为300
$("#msg").width();    //返回id为msg的元素的宽度
$("#msg").width("300");  //将id为msg的元素的宽度设为300

$("input").val(");  //返回表单输入框的value值
$("input").val("test");  //将表单输入框的value值设为test

$("#msg").click();  //触发id为msg的元素的单击事件
$("#msg").click(fn);  //为id为msg的元素单击事件添加函数
同样blur,focus,select,submit事件都可以有着两种调用方法

5、集合处理功能
对于jquery返回的集合内容无需我们自己循环遍历并对每个对象分别做处理,jquery已经为我们提供的很方便的方法进行集合的处理。
包括两种形式:
$("p").each(function(i){this.style.color=['#f00','#0f0','#00f'][i]})  
//为索引分别为0,1,2的p元素分别设定不同的字体颜色。

$("tr").each(function(i){this.style.backgroundColor=['#ccc','#fff'][i%2]})  
//实现表格的隔行换色效果

$("p").click(function(){alert($(this).html())})    
//为每个p元素增加了click事件,单击某个p元素则弹出其内容

6、扩展我们需要的功能
$.extend({
  min: function(a, b){return a < b?a:b; },
  max: function(a, b){return a > b?a:b; }
});  //为jquery扩展了min,max两个方法
使用扩展的方法(通过“$.方法名”调用):
alert("a=10,b=20,max="+$.max(10,20)+",min="+$.min(10,20));

7、支持方法的连写
所谓连写,即可以对一个jquery对象连续调用各种不同的方法。
例如:
$("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")  //设定元素背景为灰色
$("#msg").height(300); $("#msg").width("200");  //设定宽高
$("#msg").css({ color: "red", background: "blue" });//以名值对的形式设定样式
$("#msg").addClass("select");  //为元素增加名称为select的class
$("#msg").removeClass("select");  //删除元素名称为select的class
$("#msg").toggleClass("select");  //如果存在(不存在)就删除(添加)名称为select的class

9、完善的事件处理功能
Jquery已经为我们提供了各种事件处理方法,我们无需在html元素上直接写事件,而可以直接为通过jquery获取的对象添加事件。
如:
$("#msg").click(function(){alert("good")})  //为元素添加了单击事件
$("p").click(function(i){this.style.color=['#f00','#0f0','#00f'][i]})
//为三个不同的p元素单击事件分别设定不同的处理
jQuery中几个自定义的事件:
(1)hover(fn1,fn2):一个模仿悬停事件(鼠标移动到一个对象上面及移出这个对象)的方法。当鼠标移动到一个匹配的元素上面时,会触发指定的第一个函数。当鼠标移出这个元素时,会触发指定的第二个函数。
//当鼠标放在表格的某行上时将class置为over,离开时置为out。
$("tr").hover(function(){
$(this).addClass("over");
},
  function(){
   $(this).addClass("out");
});
(2)ready(fn):当DOM载入就绪可以查询及操纵时绑定一个要执行的函数。
$(document).ready(function(){alert("Load Success")})
//页面加载完毕提示“Load Success”,相当于onload事件。与$(fn)等价
(3)toggle(evenFn,oddFn): 每次点击时切换要调用的函数。如果点击了一个匹配的元素,则触发指定的第一个函数,当再次点击同一元素时,则触发指定的第二个函数。随后的每次点击都重复对这两个函数的轮番调用。
  //每次点击时轮换添加和删除名为selected的class。
  $("p").toggle(function(){
    $(this).addClass("selected");  
  },function(){
     $(this).removeClass("selected");
  });
(4)trigger(eventtype): 在每一个匹配的元素上触发某类事件。
例如:
  $("p").trigger("click");    //触发所有p元素的click事件
(5)bind(eventtype,fn),unbind(eventtype): 事件的绑定与反绑定
从每一个匹配的元素中(添加)删除绑定的事件。
例如:
$("p").bind("click", function(){alert($(this).text());});  //为每个p元素添加单击事件
$("p").unbind();  //删除所有p元素上的所有事件
$("p").unbind("click")  //删除所有p元素上的单击事件

10、几个实用特效功能
其中toggle()和slidetoggle()方法提供了状态切换功能。
如toggle()方法包括了hide()和show()方法。
slideToggle()方法包括了slideDown()和slideUp方法。

11、几个有用的jQuery方法
$.browser.浏览器类型:检测浏览器类型。有效参数:safari, opera, msie, mozilla。如检测是否ie:$.browser.isie,是ie浏览器则返回true。
$.each(obj, fn):通用的迭代函数。可用于近似地迭代对象和数组(代替循环)。

$.each( [0,1,2], function(i, n){ alert( "Item #" + i + ": " + n ); });
等价于:
var tempArr=[0,1,2];
for(var i=0;i<tempArr.length;i++){
  alert("Item #"+i+": "+tempArr[i]);
}
也可以处理json数据,如
$.each( { name: "John", lang: "JS" }, function(i, n){ alert( "Name: " + i + ", Value: " + n ); });
结果为:
Name:name, Value:John
Name:lang, Value:JS
$.extend(target,prop1,propN):用一个或多个其他对象来扩展一个对象,返回这个被扩展的对象。这是jquery实现的继承方式。
如:
$.extend(settings, options);  
//合并settings和options,并将合并结果返回settings中,相当于options继承setting并将继承结果保存在setting中。
var settings = $.extend({}, defaults, options);
//合并defaults和options,并将合并结果返回到setting中而不覆盖default内容。
可以有多个参数(合并多项并返回)
$.map(array, fn):数组映射。把一个数组中的项目(处理转换后)保存到到另一个新数组中,并返回生成的新数组。
如:
var tempArr=$.map( [0,1,2], function(i){ return i + 4; });
tempArr内容为:[4,5,6]
var tempArr=$.map( [0,1,2], function(i){ return i > 0 ? i + 1 : null; });
tempArr内容为:[2,3]
$.merge(arr1,arr2):合并两个数组并删除其中重复的项目。
如:$.merge( [0,1,2], [2,3,4] )  //返回[0,1,2,3,4]
$.trim(str):删除字符串两端的空白字符。
如:$.trim("  hello, how are you?   ");   //返回"hello,how are you? "

12、解决自定义方法或其他类库与jQuery的冲突
很多时候我们自己定义了$(id)方法来获取一个元素,或者其他的一些js类库如prototype也都定义了$方法,如果同时把这些内容放在一起就会引起变量方法定义冲突,Jquery对此专门提供了方法用于解决此问题。
使用jquery中的jQuery.noConflict();方法即可把变量$的控制权让渡给第一个实现它的那个库或之前自定义的$方法。之后应用Jquery的时候只要将所有的$换成jQuery即可,如原来引用对象方法$("#msg")改为jQuery("#msg")。
如:
jQuery.noConflict();
// 开始使用jQuery
jQuery("div   p").hide();
// 使用其他库的 $()
$("content").style.display = 'none';

posted @ 2008-09-21 21:24 崛起的程序员 阅读(303) | 评论 (0)编辑 收藏
1377-4167-5844-4698-0048-5821
posted @ 2008-03-02 19:35 崛起的程序员 阅读(329) | 评论 (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 崛起的程序员 阅读(390) | 评论 (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 崛起的程序员 阅读(841) | 评论 (0)编辑 收藏

PYHYP-WXB3B-B2CCM-V9DX9-VDY8T

在开始>设置>控制面版>添加或删除程序>卸载vs.net2008>出现卸载界面>点击Next>输入上面CD-key ->出现Success画面。。激动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 崛起的程序员 阅读(20594) | 评论 (30)编辑 收藏

注册机下载地址

http://www.blogjava.net/Files/ioriqw/Altova%202008.rar
posted @ 2007-10-30 16:23 崛起的程序员 阅读(985) | 评论 (1)编辑 收藏
     摘要: 在网上找了一圈Ajax的Java框架,感觉不错的只有两个,一个是被提到比较多的DWR(Direct Web Remoting),另一个是刚刚1.0的Ajax4JSF。本文先用代码说话,各用两个框架开发同样功能的Ajax输入验证的小程序。在最后表达一下鄙人对这两个框架的浅见。·程序功能    页面上有两个输入框,一个填用户名,一个填密码。两个框空着时提示...  阅读全文
posted @ 2007-08-27 20:17 崛起的程序员 阅读(557) | 评论 (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 崛起的程序员 阅读(367) | 评论 (0)编辑 收藏
 
有个系统隐藏的文件夹System Volume Information会达到1G甚至20G,这是系统还原的文件夹,这个目录是WINDOWS对于大硬盘搜索方便的索引记录文件!会在WINDOWS空闲时自动记录,所以这个文件夹会越来越大,然后PF使用率不断上升,导致机器卡住!&W&D.C g V b j [ a
我们可以禁用这个自动索引功能!打开搜索功能->改变首选项->不使用制作索引服务->不,不要启用制作索引服务->确定。还有一件事,就是回到刚才的地方,下面还有一个“改变制作索引服务设置(高级)”,按下去,右键弹出的窗口中的那个索引服务->删除,就好了!海腾数据中心服务器论坛 Y \ M z(R1{
O

f ?&f t j9Y&] B `
SystemVolumeInformation\catalog.wci的文件用来存放索引文件,而且在系统空闲时,Windows会自动读硬盘更新索引,安装的文件越多,索引文件会越来越大。
       D Y }&X
删除索引服务:海腾数据、服务器论坛联盟、win服务器、代理服务器,邮件服务器、代码、程序、游戏下载、软件、电脑技术、设计、图片、信息发布 N i$y l z:M }
运行msconfig,然后选择服务选项,找到IndexingService,将前面的小勾去掉,再删掉文件夹即可。
posted @ 2007-04-11 10:36 崛起的程序员 阅读(1420) | 评论 (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 崛起的程序员 阅读(877) | 评论 (0)编辑 收藏
Hot Spot JVM5中的GC调优

Written by Halatu Hubisi


引言
有JAVA开发经验的朋友们一定碰到过下面的这种情况,那就是自己所开发的应用运行了一段时间后其性能或者响应速度会有明显的降低.这是由多方面的原因造成的即有程序本身的优化问题,也有运行环境问题.此运行环境即包括硬件环境也包括软件环境.大多数人第一个能想到的解决方法是提升硬件的配置而忽略了程序本身的运行环境JVM也提供了比较多的调优选项.本文将重点描述利用JVM的一些选项对GC进行调优.

约定:
1.读者应具备一定JAVA的知识.

2.本文中的JVM选项均以SUN公司发布的HotSpot JVM 5为准(不过大多数的选项在JVM1.3,JVM1.4中也是可用的).

3.以JAVA_HOME下demo/jfc/SwingSet2/SwingSet2.jar为例进行说明.

4.阅读本文需要一些关于GC的知识,可以到附录A中了解这些知识。

关键字:
JVM(java虚拟机),调优,GC(垃圾回收)

JVM GC调优
为了能够将JVM GC的调优能够使用在具体的实践当中,下面将利用若干个例子来说明GC的调优.
例1:Heap size 设置
JVM堆的设置是指java程序运行过程中JVM可以调配使用的内存空间的设置.JVM在启动的时候会自动设置Heap size的值,其初始空间(即-Xms)是物理内存的1/64,最大空间(-Xmx)是物理内存的1/4。可以利用JVM提供的-Xmn -Xms -Xmx等选项可进行设置。Heap size 的大小是Young Generation 和Tenured Generaion 之和。
当在JAVA_HOME下demo/jfc/SwingSet2/目录下执行下面的命令。
java -jar -Xmn4m -Xms16m -Xmx16m SwingSet2.jar
系统输出为:
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
除了这些异常信息外,还会发现程序的响应速度变慢了。这说明Heap size 设置偏小,GC占用了更多的时间,而应用分配到的执行时间较少。
提示:在JVM中如果98%的时间是用于GC且可用的Heap size 不足2%的时候将抛出此异常信息。
将上面的命令换成以下命令执行则应用能够正常使用,且未抛出任何异常。
java -jar -Xmn4m -Xms16m -Xmx32m SwingSet2.jar
提示:Heap Size 最大不要超过可用物理内存的80%,一般的要将-Xms和-Xmx选项设置为相同,而-Xmn为1/4的-Xmx值。

例2:Young Generation(-Xmn)的设置
在本例中看一下Young Generation的设置不同将有什么现象发生。
假设将Young generation 的大小设置为4M ,即执行java -jar -verbose:gc -Xmn4m -Xms32m -Xmx32m -XX:+PrintGCDetails SwingSet2.jar,屏幕输出如下(节选)
[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的大小设置为8M,即执行java -jar -verbose:gc -Xmn8m -Xms32m -Xmx32m -XX:+PrintGCDetails SwingSet2.jar,屏幕输出如下(节选)
[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]
那么根据GC输出的信息(这里取第一行)做一下Minor收集的比较。可以看出两次的Minor收集分别在Young generation中找回3904K(3968K->64K)和7616K(7808K->192K)而对于整个jvm则找回1943K(3968K->2025)和5451K(7808K->2357K)。第一种情况下Minor收集了大约50%(1943/3904)的对象,而另外的50%的对象则被移到了tenured generation。在第二中情况下Minor收集了大约72%的对象,只有不到30%的对象被移到了Tenured Generation.这个例子说明此应用在的Young generation 设置为4m时显的偏小。
提示:一般的Young Generation的大小是整个Heap size的1/4。Young generation的minor收集率应一般在70%以上。当然在实际的应用中需要根据具体情况进行调整。

例3:Young Generation对应用响应的影响
还是使用-Xmn4m 和-Xmn8m进行比较,先执行下面的命令

java -jar -verbose:gc -Xmn4m -Xms32m -Xmx32m -XX:+PrintGCDetails -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime SwingSet2.jar
屏幕输出如下(节选)
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收集占用的时间可以计算如下:应用线程被中断的总时常/(应用执行总时?L+应用线程被中断的总时常),那么在本例中垃圾收集占用的时?L约为系统的5%~14%。那么当垃圾收集占用的时间的比例越大的时候,系统的响应将越慢。
提示:对于互联网应用系统的响应稍微慢一些,用户是可以接受的,但是对于GUI类型的应用响应速度慢将会给用户带来非常不好的体验。

例4:如何决定Tenured Generation 的大小
分别以-Xmn8m -Xmx32m和-Xmn8m -Xmx64m进行对比,先执行
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]
再执行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的时候系统等候时间约为0.13秒左右,而设置为64m的时候等候时间则增大到0.22秒左右了。但是在32m的时候系统的Major收集间隔为10秒左右,而Heap size 增加到64m的时候为30秒。那么应用在运行的时候是选择32m还是64m呢?如果应用是web类型(即要求有大的吞吐量)的应用则使用64m(即heapsize大一些)的比较好。对于要求实时响应要求较高的场合(例如GUI型的应用)则使用32m比较好一些。
注意:
1。因为在JVM5运行时已经对Heap-size进行了优化,所以在能确定java应用运行时不会超过默认的Heap size的情况下建议不要对这些值进行修改。
2。Heap size的 -Xms -Xmn 设置不要超出物理内存的大小。否则会提示“Error occurred during initialization of VM Could not reserve enough space for object heap”。

例5:如何缩短minor收集的时间
下面比较一下采用-XX:+UseParNewGC选项和不采用它的时候的minor收集将有什么不同。先执行
java -jar -server -verbose:gc -Xmn8m -Xms32m -Xmx32m SwingSet2.jar
系统将输出如下信息(片段〕
[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]
之后再执行 java -jar -server -verbose:gc -XX:+UseParNewGC -Xmn8m -Xms32m -Xmx32m SwingSet2.jar
系统将输出如下信息(片段〕
[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选项的minor收集的时间要比不使用的时候优。

例6:如何缩短major收集的时间
下面比较一下采用-XX:+UseConcMarkSweepGC选项和不采用它的时候的major收集将有什么不同。先执行
java -jar -verbose:gc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Xmn64m -Xms256m -Xmx256m SwingSet2.jar
系统将输出如下信息(片段〕
[Full GC 22972K->18690K(262080K), 0.2326676 secs]
[Full GC 18690K->18690K(262080K), 0.1701866 secs
之后再执行 java -jar -verbose:gc -XX:+UseParNewGC -Xmn64m -Xms256m -Xmx256m SwingSet2.jar
系统将输出如下信息(片段〕
[Full GC 56048K->18869K(260224K), 0.3104852 secs]
提示:此选项在Heap Size 比较大而且Major收集时间较长的情况下使用更合适。

例7:关于-server选项 在JVM中将运行中的类认定为server-class的时候使用此选项。SUN 的Hot Spot JVM5 如果判断到系统的配置满足如下条件则自动将运行的类认定为server-class,并且会自动设置jvm的选项(当没有手工设置这选项的时候〕而且HOTSPOT JVM5提供了自动调优的功能,他会根据JVM的运行情况进行调整。如果没有特别的需要是不需要太多的人工干预的。SUN形象的称这个机制为“人体工学”(Ergonomics〕。具体可以参考http://java.sun.com/docs/hotspot/gc5.0/ergo5.html
*.具有2个或更多个物理的处理器
*.具有2G或者更多的物理内存
提示:此选项要放在所有选项的前面。例如:java -server 其他选项 java类

附录A:预备知识
JVM中对象的划分及管理

JVM根据运行于其中的对象的生存时间大致的分为3种。并且将这3种不同的对象分别存放在JVM从系统分配到的不同的内存空间。这种对象存放空间的管理方式叫做Generation管理方式。
1。Young Generation:用于存放“早逝”对象(即瞬时对象)。例如:在创建对象时或者调用方法时使用的临时对象或局部变量。
2。Tenured Generation:用于存放“驻留”对象(即较长时间被引用的对象)。往往体现为一个大型程序中的全局对象或长时间被使用的对象。
3。Perm Generation:用于存放“永久”对象。这些对象管理着运行于JVM中的类和方法。

JVM选项的分类

JVM有这么几种选项供使用.
1.供-X选项使用的项目,又称为非标准选项,不同厂商的此类型选项是有所不同的。例如:IBM的JVM用的一些选项在Sun的JVM中就不一定能生效。这种选项的使用方式如下:
java -Xmn16m -Xms64m -Xmx64m java类名
2.供-XX选项使用的项目,这种类型的选项可能要求有对系统信息访问的权限。所以要慎用。这种选项的使用方式如下:
java -XX:MaxHeapFreeRatio=70 -XX:+PrintGCDetails java类名
3.java选项(即在命令行执行java后提示的选项).
java -server -verbose:gc -d64 java类名

垃圾收集分类

在JVM中有两种垃圾方式,一种叫做Minor(次收集),另一种叫做Major(主收集)。其中Minor在Young Generation的空间被对象全部占用后执行,主要是对Young Generation中的对象进行垃圾收集。而Major是针对于整个Heap size的垃圾收集。其中Minor方式的收集经常发生,并且Minor收集所占用的系统时间小。Major方式的垃圾收集则是一种“昂贵”的垃圾收集方式,因为在Major要对整个Heap size进行垃圾收集,这会使得应用停顿的时间变得较长。

GC信息的格式

[GC [<collector>: <starting occupancy1> -> <ending occupancy1>, <pause time1> secs] <starting occupancy3> -> <ending occupancy3>, <pause time3> secs]
<collector> GC为minor收集过程中使用的垃圾收集器起的内部名称.
<starting occupancy1> young generation 在进行垃圾收集前被对象使用的存储空间.
<ending occupancy1> young generation 在进行垃圾收集后被对象使用的存储空间
<pause time1> minor收集使应用暂停的时间长短(秒)
<starting occupancy3> 整个堆(Heap Size)在进行垃圾收集前被对象使用的存储空间
<ending occupancy3> 整个堆(Heap Size)在进行垃圾收集后被对象使用的存储空间
<pause time3> 整个垃圾收集使应用暂停的时间长短(秒),包括major收集使应用暂停的时间(如果发生了major收集).
GC信息的选项
-XX:+PrintGCDetails 显示GC的详细信息
-XX:+PrintGCApplicationConcurrentTime 打印应用执行的时间
-XX:+PrintGCApplicationStoppedTime 打印应用被暂停的时间
提示:1.":"后的"+"号表示开启此选项,如果是"-"号那么表示关闭此选项。
     2.在不同的选项和不同的收集方式和类型下输出的格式会有所不同。

附录B:HotSpot JVM 选项
请参考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 崛起的程序员 阅读(429) | 评论 (0)编辑 收藏
清晨的时候,
在近春园曲折的小路上走,
看见一个老人坐在湖边悠闲地垂钓
依稀听见湿漉漉的笛声
婉约进树林深处,
老人专注的神情似乎能
漾起水中的波影,
然后目光被长长的眉须剪断,
扑闪在晨雾中捕捉着空气.
这是怎样一种美妙啊!
我在他身边坐下,静静等待
鱼儿的到来.半个小时过去了,
我的心情开始烦躁,
可老人的微笑一如既往.
"你们二十几岁的年轻人啊,
心就像一个玻璃杯,
透明,盛满了阳光."
老人说话跟垂钓一样,安详.
和仙风道骨的老人话别后,
我决定从粉绿的湖边继续往前走,
去探寻校园极致的景色,
享受年轻的心情,
呵呵,像玻璃杯……                                   
posted @ 2006-11-19 19:57 崛起的程序员 阅读(286) | 评论 (0)编辑 收藏
String strs = request.getParameter("yourstrs");
byte b[] = strs.getBytes("ISO-8859-1");
strs = new String(b);








简洁写法:


String convert = new String(request.getParmater("inputname").trim().getBytes("ISO8859_1"), "GBK");
posted @ 2006-11-10 09:53 崛起的程序员 阅读(237) | 评论 (0)编辑 收藏
关于tomcat4.0配置digest认证注意事项:
MemoryRealm作为事例
在server.xml中需要配置 红色字体为注意事项
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                 debug="0" resourceName="UserDatabase" digest="MD5"/>

密码转换成密文的加密格式为:
{username}:{realm}:{cleartext-password}.

到bin/目录下找到digest.bat 文件执行如下命令得到密文
digest -a md5 admin:realm:admin

其中admin分别用户和密码,realm为所配置域名
admin:realm:admin:ae7cdd2406201487bcce77064b5fe10c

红色部分为加密后的密码。

完:
作者: Liming

posted @ 2006-11-09 04:30 崛起的程序员 阅读(2000) | 评论 (0)编辑 收藏