2010年12月20日

IIS日志导入Sql数据库

摘要: 1. 建立表结构SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[web_201007]([date] [varchar](255) NULL,[time] [varchar](255) NULL,[s-ip] [varchar](255) NULL,[cs-method] [varchar](255) NULL,[cs-uri-stem] [nvarchar](255) NULL,[cs-uri-query] [nvarchar](1000) NULL,[s-port] 阅读全文

posted @ 2010-12-20 15:38 Buyee 阅读(256) 评论(0) 编辑

2010年12月13日

IE Common Browser Issue

Internet Explorer Conditional Statements

Internet Explorer provides a way of adding conditional statements that allow the designer to specify which version(s) of the browser should display certain sections. These conditional statements appear as simple HTML comments to other browsers (e.g, Firefox) and are therefore ignored. This can be very useful for addressing CSS bugs in older versions of Internet Explorer without having any impact on other browsers.

The syntax is shown below.

Syntax

<!--[if IE 7]> HTML Code only shows up on Internet Explorer 7<![endif]-->

As you can see, the beginning if statement starts with the beginning of an HTML comment (<!--) and the endif statement ends with the end of an HTML comment (-->), so all other browsers view the whole contents as a comment and do not render any of the contained code.

The code shown above will only be displayed in Internet Explorer 7, but you can use operators to specify multiple versions that will display a block of code. The operators are shown below:

Conditional Operators
Operator Description Example
! not <!--[if ! IE 7]>
lt less than <!--[if lt IE 7]>
gt greater than <!--[if gt IE 7]>
lte less than or equal <!--[if lte IE 7]>
gte greater than or equal <!--[if gte IE 7]>

1. Double-Margin Bug

The double-margin bug manifests itself in Internet Explorer 6 and earlier when an element has a margin in the same direction in which it floats (e.g, a left margin on an element that floats left). In this case, IE 6 and earlier double the margin as shown in the example below.

<style type="text/css">
#SideBar {
float: left;
margin-left: 50px;
width: 200px;

background-color:green;
}
#MainPage {
float: left;
width: 400px;
background-color:yellow;
}
</style>
<div id="SideBar">
This is the side bar.
</div>
<div id="MainPage">
This is the main page.
</div>

The fix is very strange: you simply set the display property of the offending element (in this case, the sidebar) to "inline". Because all floats are block elements, doing so has no effect on the display in other browsers; however, it does, for some reason, fix the display in Internet Explorer.

The double margin bug is fixed in IE7.

<!--[if IE]>
<style type="text/css">
#SideBar {
display:inline;
}
</style>

<![endif]-->

2. 3-Pixel Gap Bug

Internet Explorer has a weird bug, in which it adds a three-pixel margin between a floating element and the subsequent element. If the subsequent element has a width defined, Internet Explorer pushes the whole element to the right. If no width is defined, Internet Explorer just pushes the content to the right. Examine the code below.

#SideBar {
 float: left;
 margin-left: 50px;
 width: 200px;
 border:1px solid green;
}

#MainPage {
 border:1px dashed red;
}

Notice the tiny amount of added space between the text "This is the main page." and the floating element. Well, that's picky! And really, it doesn't create much of a problem, until you add a width to the subsequent element:

#MainPage {
 border:1px dashed red;
 width:200px;
}

Now the whole element is pushed over to the right.

 

This may not be a problem either, except in the case of a very tight layout. Those extra three pixels could cause the MainPage element to clear down under the float, which would destroy the design.

Luckily, the fix is easy. Simply set the margin-right of the floating div to -3 pixels as shown below:

<!--[if IE]><style type="text/css">#SideBar { display:inline; margin-right:-3px;}</style><![endif]-->

 

posted @ 2010-12-13 15:14 Buyee 阅读(24) 评论(0) 编辑

The Box Model

All elements are treated as boxes: paragraphs, headings, block quotes, lists, list items, and so on. Even inline elements like <em> and links are treated by CSS as boxes.

According to the W3C definition of a box created using CSS, the width and height define the width and height of only the content area (the area where images and other objects are displayed). The apparent width and height, or the total width and height that the element takes up in the design, include the content area plus the padding and border sizes. So, the apparent width would be calculated in the following way(Margin is unique in that it doesn't affect the size of the box itself per-say, but it affects other content interacting with the box, and thus an important part of the CSS box model.):

width(content) + left padding + right padding + left border + right border = width(apparent)

Unfortunately, Microsoft Internet Explorer through version 5.5 defined width and height values as the apparent width and height (including padding and borders). This effectively subtracts the padding and border sizes to determine the content width and height:

width(apparent) - left padding - right padding - left border - right border = width(content)

So, given the following CSS:

#object1 {
    border: 5px solid #000;
    padding: 10px;
    width: 100px;
}

browsers using the W3C standard (Firefox, Safari, Opera) will set the content area to 100 pixels wide, but will have an apparent width of 130 pixels:

100 + 5 + 5 + 10 + 10 = 130

Whereas Internet Explorer 5.5 and earlier will set a content area 70 pixels wide and an apparent width of 100 pixels:

70 + 5 + 5 +10 + 10 = 100
Recent versions of Internet Explorer (6 and later) fix this problem by following the W3C standards. 
The solution is: Turning Off Quirks Mode.

Quirks Mode

Modern browsers have at least two modes in which they can display content:

  1. Standards-compliant mode
  2. Quirks mode

In standards-compliant mode, the browser does its best to display the page according to the latest CSS standards. In quirks mode, the browser displays the page as if it were an older version of the same browser. The purpose of quirks mode is to make pages that were designed for the old browsers display the same in the newer browsers.

You won't find much difference between quirks mode and standards-compliant mode in Mozilla, Opera or Safari, but you may see big differences in Internet Explorer.

 

Turning Off Quirks Mode

By default, quirks mode is on. It can be turned off by adding the correct DOCTYPE declaration at the top of the HTML page. The following DOCTYPE declarations will turn on standards-compliant mode for all modern browsers:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 

One gotcha in Internet Explorer is that quirks mode is always enabled if you include an XML declaration (<?xml version="1.0"?>), so we recommend you do not include one.

 

posted @ 2010-12-13 14:20 Buyee 阅读(58) 评论(0) 编辑

2010年12月10日

如何将HTML转换成XHTML

1. Change your DOCTYPE to Strict XHTML. Or, you can use Transitional XHTML if you’re still using Transitional HTML.
2. Add the xmlns, lang, and xml:lang attributes to your <html> opening tag.
3. The <html> tag must be the first tag after the DOCTYPE and the </html> closing tag must be the last tag in the document.
4. All element names must be written with lowercase letters.
5. All opening tags must have closing tags. Or, if an element is empty, the tag must end with a space and then />.
6. All attributes must have values, and those values must be surrounded by double quotes.
7. Don’t use & in the content of your HTML. & is for starting entities, so use &amp; instead. Also convert any other special characters to entities.

posted @ 2010-12-10 14:47 Buyee 阅读(138) 评论(0) 编辑

2009年10月13日

浅析StackTrace

我们在学习函数调用时,都知道每个函数都拥有自己的栈空间。一个函数被调用时,就创建一个新的栈空间。那么通过函数的嵌套调用最后就形成了一个函数调用堆 栈。在c#中,使用StackTrace记录这个堆栈。你可以在程序运行过程中使用StackTrace得到当前堆栈的信息。

class Program
    
{
        
static void Main(string[] args)
        
{
             Program a
= new Program();
             a.FuncA();
             Console.ReadLine();
         }

        
int FuncA()
        
{
             FuncB();
            
return 0;
         }


        
private void FuncB()
        
{
             MethodInfo method0
= (MethodInfo)(new StackTrace().GetFrame(0).GetMethod());
             MethodInfo method1
= (MethodInfo)(new StackTrace().GetFrame(1).GetMethod());
             MethodInfo method2
= (MethodInfo)(new StackTrace().GetFrame(2).GetMethod());
            
             Console.WriteLine(
"Current Method is : {0}",method0.Name);
             Console.WriteLine(
"Parent Method is : {0}", method1.Name);
             Console.WriteLine(
"GrandParent Method is : {0}", method2.Name);
         }

     }

程序的输出结果是:
Current Method is : FuncB
Parent Method is : FuncA
GrandParent Method is : Main

其中调用GetFrame得到栈空间,参数index 表示栈空间的级别,0表示当前栈空间,1表示上一级的栈空间,依次类推。

posted @ 2009-10-13 14:58 Buyee 阅读(151) 评论(0) 编辑

2008年7月30日

IE back 引发webpage has expired...

在用.net开发的web site时,碰到这样的问题:

用户在IE上点回退,结果web页面中<asp:TextBox...的值不是回退页面的值。如果设置Response.Cache.SetNoStore(),会

产生Webpage has expired......的恶心页面。资料找了好多,没有比较好的解决方式。

后来测试发现:<asp:Label...的值在回退的时候显示正确。

这样就有办法搞了:在后台确保<asp:TextBox...的值和<asp:Label...的值一样,在前台用js判断两个值是否一样,不一样就是

用户点了回退按钮,此时将<asp:Label...的值赋给<asp:TextBox...就可以啦。

注意:并不是每个<asp:TextBox...都需要一个<asp:Label...的,根据具体情况决定。

posted @ 2008-07-30 17:37 Buyee 阅读(500) 评论(0) 编辑

2007年8月12日

自定义配置节点的思考

摘要: 自定义配置节点的思考阅读全文

posted @ 2007-08-12 19:19 Buyee 阅读(96) 评论(0) 编辑

2007年6月26日

scollWidth,clientWidth,offsetWidth,scollLeft,offsetLeft

摘要: scollWidth,clientWidth,offsetWidth,scollLeft,offsetLeft阅读全文

posted @ 2007-06-26 11:31 Buyee 阅读(256) 评论(0) 编辑

Html-cellpadding,cellspacing,border,margin

摘要: Html-cellpadding,cellspacing,border,margin阅读全文

posted @ 2007-06-26 11:19 Buyee 阅读(230) 评论(0) 编辑

2007年6月25日

.net下调用WebService

摘要: .net下调用WebService阅读全文

posted @ 2007-06-25 17:18 Buyee 阅读(917) 评论(0) 编辑

导航

<2012年2月>
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910

公告

昵称:Buyee
园龄:4年7个月
粉丝:0
关注:11

搜索

 
 

常用链接

我的标签

随笔分类

随笔档案

最新评论

阅读排行榜

评论排行榜

推荐排行榜