分类: SoftWare
发布: yaosansi
浏览:
日期: 2008年5月29日
今天我们发布了Visual Studio 2008与.NET Framework 3.5 Service Pack 1的Beta版本。
按照惯例,我们的服务包(Service Pack)解决了我们通过客户及合作伙伴反馈,以及在内部测试中发现的一系列问题。这次的服务包除了继续保持这一点,更针对 这些问题做了更新,它还在Visual Studio 2008和.NET Framework 3.5已有的巨大价值之上加入了更多组件,涵盖了一系列客户强烈要求的功能,改进了开发人员的使用体验。比如,该服务包是为 SQL Server 2008及ADO.NET Entity Framework提供全面支持的第一个Visual Studio 2008版本。
Visual Studio: 你将会发现WPF设计器在功能和性能方面的改进;更多Visual Basic及Visual C++组件和工具,包括基于MFC的Office 2007 Ribbon和各种稳定性问题的修复;更丰富的JavaScript功能;改进的Web开发及站点部署;以及IDE的性能提升。更多关于Service Pack中性能提升的详情请参阅性能团队的博客。
Visual Studio Team System: Visual Studio Team System中的改进包括更新过的“Add to Source Control”对话框,从Windows Explorer到Source Control Explorer的拖拽操作的支持,对未绑定文件的版本控制等等。在工作项跟踪方面,我们加入了对Office 2007 Ribbon的支持,因此,如下图所示,你现在可以用简洁的方式在Office应用程序中进行相关的TFS操作。想要更多地了解Team System中的新功能,请参看Brian Harry的博客。
分类: ASP.NET
发布: yaosansi
浏览:
日期: 2008年5月29日
今天早晨,我们发布了ASP.NET MVC框架的第三个预览版。上个月我曾在博客中详细讨论过包含了这个预览版中诸多变动的一个过渡性源码发布。今天的预览版还包含了不在上个月源码版中的一些另外的功能,一些改进/加工,以及Visual Studio工具集成和文档。
你可以在这里下载集成的ASP.NET MVC第三个预览版的安装包,你也可以在这里下载ASP.NET MVC框架第三个预览版的源码和框架单元测试。
Controller Action方法变动
ASP.NET MVC第三个预览版包含了曾在 四月份MVC源码发布贴子中讨论并预览过的MVC Controller变动,以及另外一些调整。
你可以继续编写返回void,其中封装了逻辑的控制器action方法,例如:

在运行时会显示下列HTML:

第三个预览版现在还支持使用返回一个“ActionResult”对象的方式,该返回对象表示了action方法的结果,允许结果的延迟执行。这可以极大地方便action方法的单元测试(而不必mock什么东西),它还允许更干净的组合以及总的执行控制流程。
分类: XHTML+CSS
发布: yaosansi
浏览:
日期: 2008年5月28日
Div与CSS布局,最让人头疼的就是容器内的东西如何垂直居中的问题,我在做站时也遇到,查了一下资料,总结出以下居中办法,兼容IE与及Firefox
方法一
<style type="text/css">
<!--
* {margin:0;padding:0}
div {
width:500px;
height:500px;
border:1px solid #666;
overflow:hidden;
position:relative;
display:table-cell;
text-align:center;
vertical-align:middle
}
div p {
position:static;
+position:absolute;
top:50%
}
img {
position:static;
+position:relative;
top:-50%;left:-50%;
}
-->
</style>
<div><p><img src="http://www.google.com/intl/en/images/logo.gif" /></p></div>
分类: JavaScript
发布: yaosansi
浏览:
日期: 2008年5月28日
一、简介
1.1、概述
随着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交互。
它具有如下一些特点:
- 代码简练、语义易懂、学习快速、文档丰富。
- jQuery是一个轻量级的脚本,其代码非常小巧,最新版的JavaScript包只有20K左右。
- jQuery支持CSS1-CSS3,以及基本的xPath。
- jQuery是跨浏览器的,它支持的浏览器包括IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+。
- 可以很容易的为jQuery扩展其他功能。
- 能将JS代码和HTML代码完全分离,便于代码和维护和修改。
- 插件丰富,除了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 开发》
分类: JavaScript
发布: yaosansi
浏览:
日期: 2008年5月28日
jQuery直接各种动画,常见的被封装成各种方法,如show()/hide()/slideDown()/fadeIn()等等,参见:Effects
最灵活的则属于animate( params, [duration], [easing], [callback] )方法,参见:animate
其中params为动画的运行结果,可以为各种样式属性,jQuery将在duration指定的时间内,将对象的当前状态渐变为params参数指定的值。如:
$("#go").click(function(){
$("#block").animate({
width: "70%",
opacity: 0.4,
marginLeft: "0.6in",
fontSize: "3em",
borderWidth: "10px"
}, 1500 );
});
params也可以是一些相对数据:
$("#right").click(function(){
$(".block").animate({"left": "+=50px"}, "slow");
});
$("#left").click(function(){
$(".block").animate({"left": "-=50px"}, "slow");
});
分类: ASP.NET
发布: yaosansi
浏览:
日期: 2008年5月26日
The built in function for creating thumbnails in ASP.NET is extremely convenient and very simple to implement.
- int width = 190;
- int height = 190;
- Bitmap source = new Bitmap("c:\someimage.gif");
- System.Drawing.Image thumb = source.GetThumbnailImage(width,height,null,IntPtr.Zero);
int width = 190;int height = 190;Bitmap source = new Bitmap("c:\someimage.gif");System.Drawing.Image thumb = source.GetThumbnailImage(width,height,null,IntPtr.Zero);
(31.7k)
The trouble is that it produces relatively poor quality results and excessively large file sizes. The thumbnails tend to look very muddy when using this route, but many times it's good enough for whatever your needs may be.
分类: ASP.NET
发布: yaosansi
浏览:
日期: 2008年5月26日
Introduction
Most security systems' passwords are case-sensitive. Case sensitivity nearly doubles the number of possible characters that can appear in the password, which makes it harder for nefarious users trying to break into the system. As a result, if a user logging into the system has Caps Lock turned on, they'll enter letters in the opposite case and not be able to login. Because the textboxes that collect user input typically are masked to prevent an onlooker from seeing a user's password, the user typing in her password may not realize that Caps Lock is on. To help prevent this type of user error, many login screens for desktop-based applications display some sort of warning if the user's Caps Lock is on when they start typing in their password.
Unfortunately, such functionality is rarely seen in web applications. A 4Guys reader recently asked me if there was a way to provide such feedback to a user logging into an ASP.NET website. The short answer is, Yes. It is possible to detect whether a user has Caps Lock enabled through JavaScript. Likewise, it's possible to have this client-side logic execute whenever a user starts typing in a particular textbox. With a little bit of scripting, such an interface could be devised.
After thinking about the implementation a bit, I decided to create a compiled server-side control that would emit the necessary JavaScript. This article introduces this control, WarnWhenCapsLockIsOn, and shows how it works and how to use it in an ASP.NET web page. Read on to learn more!
分类: ASP.NET
发布: yaosansi
浏览:
日期: 2008年5月26日
I am working on a project that needs a new screen for bulk entry tasks. We have a few business scenarios coming up where we have people inputting 5 to 8 records of data at a time. I met with a few of our analysts last week and hashed out a rough outline of what they were looking for. About 10 times or so during the 30 minute meeting some form of the phrase 'kind of like excel' was mentioned. Our data entry personnel are familiar with excel and our analysts thought an excel styled grid would make a lot of sense. 'An excel grid with a Submit button' was the phrase I had underlined twice in my notes.
I wasn't too worried about the grid's styling, but I wasn't quite sure what the best way to handle the 'bulk insert' requirement. Most of our other grids require an explicit mouse click to insert an item - and often times this click includes navigating the user to a separate page that is made to handle inserts. Of course for mass data entry tasks this can get a little old - tabbing through the cells is much nicer. So I took my notes back to my desk and started building a small prototype. You can check out the live demo to watch the grid in action. And a few of my implementation notes can be found under the screen shots below.
Live Demo (IE6, IE7, FF, Opera) | Download
分类: DataBase
发布: yaosansi
浏览:
日期: 2008年5月26日
分类: WebSite
发布: yaosansi
浏览:
日期: 2008年5月26日
我们在应对网站的恶意请求时候,一个解决方法就是把有问题的请求IP封杀掉。
如果想快速处理这种问题,就需要编写一段代码,达到一定门槛,自动封杀。再复杂点就是不是永久封杀,还可以自动在一定时间后解封。
封杀的逻辑代码看后面提供的。
需要说明的是:IIS7时,情况发生了不同。
下面的代码,在处理封杀IP时候,不论IIS6还是IIS7 都可以把需要封杀的IP加入封杀列表。但是需要注意的是我们代码写的是全部替换原先的数据。但是在IIS7下,执行的效果是原先的不替换,新加一批封杀IP。当然IIS7下,如果新加的IP原来就有了,则会报如下异常:
System.Runtime.InteropServices.COMException was caught
Message="当文件已存在时,无法创建该文件。 (异常来自 HRESULT:0x800700B7)"
Source="System.DirectoryServices"
ErrorCode=-2147024713
StackTrace:
在 System.DirectoryServices.DirectoryEntry.CommitChanges()
在 IIS_Security_ConsoleApplication.Program.IPDeny() 位置 D:\MyCodes\IIS_Security_ConsoleApplication\IIS_Security_ConsoleApplication\Program.cs:行号 109
InnerException:
这就是说,IIS7, 我们可以通过编程接口增加封杀IP名单,但是没发通过编程接口剔出封杀IP。
分类: ASP.NET
发布: yaosansi
浏览:
日期: 2008年5月19日
利用配置文件的配置节可以让它不继承父目录的配置文件,如下
<location path="." allowOverride="false" inheritInChildApplications="false"> </location>
把它加在父目录的<system.web>节外面即可,测试一下果然如此,甚喜,虽记之以备忘,同时也于大伙共享!
下面是更好的一个:
虚拟目录中的web.config继承了主目录中的web.config出现问题是由于根目录中的web.config添加了httphandler、 httpmodule 引起的。
解决办法:将 httphandler httpmodule的声明添加到location中。
如下所示:
<location path="." allowOverride="true" inheritInChildApplications="false">
<system.web>
<httpModules>
<add name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
</system.web>
</location>