Use CSS3 Pie to Modernize Internet Explorer

One of the biggest dilemmas facing web developers is the incompatibility of various Internet Explorer versions with current web standards. Although Microsoft has promised CSS3 and even HTML5 support for IE9, Windows users, especially businesses, may continue to use IE8, IE7, or even the dreaded IE6 for years to come.

As a result, coding a site with exclusive CSS3 features will only alienate a large portion of your website’s visitors, and obligating them to download a standards-compliant browser, like Mozilla Firefox or Google Chrome, will only come across as arrogant.

A possible solution to the problem is to use a modernizer, which is a script or application that uses a variety of tricks to make your site appear as it should in all browsers. CSS3 Pie is javascript-based modernizer that helps Internet Explorer recognize cool CSS3 features such as rounded corners, soft drop shadows, and gradient fills. It is quick, easy, and works most of the time with very little tweaking.

Installation and Setup

This brief tutorial assumes you already have a website with CSS3 elements. In order to get CSS3 Pie working, you need to do two things: upload the javascript package and add special code to your CSS file.

CSS3 Pie live demo with menu tabs

1. The download from the css3pie.com website includes a number of files, but if everything goes as planned, all you need is PIE.htc, which is a compressed text file. Upload it to a place on your web server where your CSS file can have access to it.

2. Open your CSS file in your text editor and locate the elements that contain CSS3 properties. Within those elements, add the following rule:

behavior: url(PIE.htc);

The path to your PIE.htc file needs to be exact, so if it is not in the same directory as your CSS file, change it accordingly.

The final element should look something like this:

#element1 { border: 1px solid #696;
padding: 60px 0;
text-align: center; width: 200px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
background: #EEFF99;
behavior: url(PIE.htc); }

If it worked correctly, you should see the results in IE 6,7, and 8 immediately after uploading the altered CSS file.

Troubleshooting

If you see no changes at all, you could very likely need to adjust the path to your PIE.htc or even use the full URL. Just remember that IE will only accept an htc file from the same domain as the site, and “www.site.com” and “site.com” are considered two different domains.

Under some circumstances, you may need to try PIE_uncompressed.htc or even PIE.php to get it to work correctly. Consult the documentation for more details.

I have noticed that the combination of transparency and bold text results in some crazy-looking words in IE8. You might still need to use transparent image backgrounds in those situations.

The combination of CSS3 Pie and some jQuery functions seems to produce an error in IE. I have not found a solution for this, but the page still loads and displays correctly in spite of it.

Modernization

Live demo of CSS3 Pie to test in Internet Explorer

With very little effort, CSS3 Pie can help your website look consistently appealing in all major browsers, without the headache of having to shape corner images or make fake drop shadows. The front page of the site includes a demo so that you can adjust CSS3 properties and see the live results in Internet Explorer. Best of all CSS3 Pie is free and open source and available for download at no cost.

Parse MSI installers by call MSI database [C#]

Purpose: Parse MSI installer, to get information such as product name, product code, properties etc.

MSI is a standard windows install techonoly, so there are APIs for developers to access. But they are c/c++ methods, instead of C#. After google, i found the ‘Wrapping the Windows Installer 2.0 API’(http://www.codeproject.com/KB/cs/msiinterop.aspx), which is can let .net developers access MSI api easily.

After download the library, you can visit MSI datatable like this

 

 1:  using System;
 2:  using WindowsInstaller;
 3:   
 4:  namespace MsiTest
 5:  {
 6:      class Program
 7:      {
 8:          static void Main(string[] args)
 9:          {
10:              test("c:\\xxx.msi");
11:          }
12:   
13:          private static void test(string fileName)
14:          {
15:              IntPtr databasePtr;
16:              var retDatabase = MsiInterop.MsiOpenDatabase(fileName, MsiDbPersistMode.ReadOnly, out databasePtr);
17:   
18:              IntPtr viewPtr;
19:              var ret = MsiInterop.MsiDatabaseOpenView(databasePtr, "SELECT Value FROM Property where Property = 'SecureCustomProperties'", out viewPtr);
20:   
21:              IntPtr recordPtr = IntPtr.Zero;
22:              ret = MsiInterop.MsiViewExecute(viewPtr, IntPtr.Zero);
23:              ret = MsiInterop.MsiViewFetch(viewPtr, ref recordPtr);
24:   
25:              uint buffer_length = 2550;
26:              string return_buffer = new string(' ', (int)buffer_length);
27:              MsiInterop.MsiRecordGetString(recordPtr, 1, return_buffer, ref buffer_length);
28:              MsiInterop.MsiCloseAllHandles();
29:   
30:              Console.WriteLine(return_buffer.Trim());
31:          }
32:   
33:      }
34:  }
35:   
36:   

HTML 5 参考手册

HTML 5

通过制定如何处理所有 HTML 元素以及如何从错误中恢复的精确规则,HTML 5 改进了互操作性,并减少了开发成本。

HTML 5 中的新特性包括了嵌入音频、视频和图形的功能,客户端数据存储,以及交互式文档。

HTML 5 还包含了新的元素,比如:<nav>, <header>, <footer> 以及 <figure> 等等。

HTML 5 工作组包括:AOL, Apple, Google, IBM, Microsoft, Mozilla, Nokia, Opera, 以及数百个其他的供应商。

注释:HTML 5 还没有成为 W3C 正式的推荐标准。

如需阅读更多有关 W3C HTML 5 活动的内容,请阅读我们的 W3C 教程。

按字母顺序排列的标签列表

new : HTML5 中的新标签。

标签
描述

<!–…–>
定义注释。

<!DOCTYPE>
定义文档类型。

<a>
定义超链接。

<abbr>
定义缩写。

<acronym>
HTML 5 中不支持。定义首字母缩写。

<address>
定义地址元素。

<applet>
HTML 5 中不支持。定义 applet。

<area>
定义图像映射中的区域。

<article>
定义 article。

<aside>
定义页面内容之外的内容。

<audio>
定义声音内容。

<b>
定义粗体文本。

<base>
定义页面中所有链接的基准 URL。

<basefont>
HTML 5 中不支持。请使用 CSS 代替。

<bdi>
定义文本的文本方向,使其脱离其周围文本的方向设置。

<bdo>
定义文本显示的方向。

<big>
HTML 5 中不支持。定义大号文本。

<blockquote>
定义长的引用。

<body>
定义 body 元素。

<br>
插入换行符。

<button>
定义按钮。

<canvas>
定义图形。

<caption>
定义表格标题。

<center>
HTML 5 中不支持。定义居中的文本。

<cite>
定义引用。

<code>
定义计算机代码文本。

<col>
定义表格列的属性。

<colgroup>
定义表格列的分组。

<command>
定义命令按钮。

<datalist>
定义下拉列表。

<dd>
定义定义的描述。

<del>
定义删除文本。

<details>
定义元素的细节。

<dfn>
定义定义项目。

<dir>
HTML 5 中不支持。定义目录列表。

<div>
定义文档中的一个部分。

<dl>
定义定义列表。

<dt>
定义定义的项目。

<em>
定义强调文本。

<embed>
定义外部交互内容或插件。

<fieldset>
定义 fieldset。

<figcaption>
定义 figure 元素的标题。

<figure>
定义媒介内容的分组,以及它们的标题。

<font>
HTML 5 中不支持。

<footer>
定义 section 或 page 的页脚。

<form>
定义表单。

<frame>
HTML 5 中不支持。定义子窗口(框架)。

<frameset>
HTML 5 中不支持。定义框架的集。

<h1> to <h6>
定义标题 1 到标题 6。

<head>
定义关于文档的信息。

<header>
定义 section 或 page 的页眉。

<hgroup>
定义有关文档中的 section 的信息。

<hr>
定义水平线。

<html>
定义 html 文档。

<i>
定义斜体文本。

<iframe>
定义行内的子窗口(框架)。

<img>
定义图像。

<input>
定义输入域。

<ins>
定义插入文本。

<keygen>
定义生成密钥。

<isindex>
HTML 5 中不支持。定义单行的输入域。

<kbd>
定义键盘文本。

<label>
定义表单控件的标注。

<legend>
定义 fieldset 中的标题。

<li>
定义列表的项目。

<link>
定义资源引用。

<map>
定义图像映射。

<mark>
定义有记号的文本。

<menu>
定义菜单列表。

<meta>
定义元信息。

<meter>
定义预定义范围内的度量。

<nav>
定义导航链接。

<noframes>
HTML 5 中不支持。定义 noframe 部分。

<noscript>
定义 noscript 部分。

<object>
定义嵌入对象。

<ol>
定义有序列表。

<optgroup>
定义选项组。

<option>
定义下拉列表中的选项。

<output>
定义输出的一些类型。

<p>
定义段落。

<param>
为对象定义参数。

<pre>
定义预格式化文本。

<progress>
定义任何类型的任务的进度。

<q>
定义短的引用。

<rp>
定义若浏览器不支持 ruby 元素显示的内容。

<rt>
定义 ruby 注释的解释。

<ruby>
定义 ruby 注释。

<s>
HTML 5 中不支持。定义加删除线的文本。

<samp>
定义样本计算机代码。

<script>
定义脚本。

<section>
定义 section。

<select>
定义可选列表。

<small>
将旁注 (side comments) 呈现为小型文本。

<source>
定义媒介源。

<span>
定义文档中的 section。

<strike>
HTML 5 中不支持。定义加删除线的文本。

<strong>
定义强调文本。

<style>
定义样式定义。

<sub>
定义下标文本。

<summary>
定义 details 元素的标题。

<sup>
定义上标文本。

<table>
定义表格。

<tbody>
定义表格的主体。

<td>
定义表格单元。

<textarea>
定义 textarea。

<tfoot>
定义表格的脚注。

<th>
定义表头。

<thead>
定义表头。

<time>
定义日期/时间。

<title>
定义文档的标题。

<tr>
定义表格行。

<track>
定义用在媒体播放器中的文本轨道。

<tt>
HTML 5 中不支持。定义打字机文本。

<u>
HTML 5 中不支持。定义下划线文本。

<ul>
定义无序列表。

<var>
定义变量。

<video>
定义视频。

<xmp>
HTML 5 中不支持。定义预格式文本。

HTML5 表单元素

HTML5 的新的表单元素:

HTML5 拥有若干涉及表单的元素和属性。

本章介绍以下新的表单元素:

  • datalist
  • keygen
  • output

浏览器支持

Input type
IE
Firefox
Opera
Chrome
Safari

datalist
No
No
9.5
No
No

keygen
No
No
10.5
3.0
No

output
No
No
9.5
No
No

datalist 元素

datalist 元素规定输入域的选项列表。

列表是通过 datalist 内的 option 元素创建的。

如需把 datalist 绑定到输入域,请用输入域的 list 属性引用 datalist 的 id:

实例
Webpage: <input type="url" list="url_list" name="link" />
<datalist id="url_list">
<option label="W3School" value="http://www.W3School.com.cn" />
<option label="Google" value="http://www.google.com" />
<option label="Microsoft" value="http://www.microsoft.com" />
</datalist>

亲自试一试

提示:option 元素永远都要设置 value 属性。

keygen 元素

keygen 元素的作用是提供一种验证用户的可靠方法。

keygen 元素是密钥对生成器(key-pair generator)。当提交表单时,会生成两个键,一个是私钥,一个公钥。

私钥(private key)存储于客户端,公钥(public key)则被发送到服务器。公钥可用于之后验证用户的客户端证书(client certificate)。

目前,浏览器对此元素的糟糕的支持度不足以使其成为一种有用的安全标准。

实例
<form action="demo_form.asp" method="get">
Username: <input type="text" name="usr_name" />
Encryption: <keygen name="security" />
<input type="submit" />
</form>

亲自试一试

output 元素

output 元素用于不同类型的输出,比如计算或脚本输出:

实例
<output id="result" onforminput="resCalc()"></output>

HTML5 Input 类型

HTML5 新的 Input 类型

HTML5 拥有多个新的表单输入类型。这些新特性提供了更好的输入控制和验证。

本章全面介绍这些新的输入类型:

  • email
  • url
  • number
  • range
  • Date pickers (date, month, week, time, datetime, datetime-local)
  • search
  • color

浏览器支持

Input type
IE
Firefox
Opera
Chrome
Safari

email
No
4.0
9.0
10.0
No

url
No
4.0
9.0
10.0
No

number
No
No
9.0
7.0
No

range
No
No
9.0
4.0
4.0

Date pickers
No
No
9.0
10.0
No

search
No
4.0
11.0
10.0
No

color
No
No
11.0
No
No

注释:Opera 对新的输入类型的支持最好。不过您已经可以在所有主流的浏览器中使用它们了。即使不被支持,仍然可以显示为常规的文本域。

Input 类型 – email

email 类型用于应该包含 e-mail 地址的输入域。

在提交表单时,会自动验证 email 域的值。

实例
E-mail: <input type="email" name="user_email" />

亲自试一试

提示:iPhone 中的 Safari 浏览器支持 email 输入类型,并通过改变触摸屏键盘来配合它(添加 @ 和 .com 选项)。

Input 类型 – url

url 类型用于应该包含 URL 地址的输入域。

在提交表单时,会自动验证 url 域的值。

实例
Homepage: <input type="url" name="user_url" />

亲自试一试

提示:iPhone 中的 Safari 浏览器支持 url 输入类型,并通过改变触摸屏键盘来配合它(添加 .com 选项)。

Input 类型 – number

number 类型用于应该包含数值的输入域。

您还能够设定对所接受的数字的限定:

实例
Points: <input type="number" name="points" min="1" max="10" />

亲自试一试

请使用下面的属性来规定对数字类型的限定:

属性

描述

max
number
规定允许的最大值

min
number
规定允许的最小值

step
number
规定合法的数字间隔(如果 step=”3″,则合法的数是 -3,0,3,6 等)

value
number
规定默认值

请试一下带有所有限定属性的例子:亲自试一试

提示:iPhone 中的 Safari 浏览器支持 number 输入类型,并通过改变触摸屏键盘来配合它(显示数字)。

Input 类型 – range

range 类型用于应该包含一定范围内数字值的输入域。

range 类型显示为滑动条。

您还能够设定对所接受的数字的限定:

实例
<input type="range" name="points" min="1" max="10" />

亲自试一试

请使用下面的属性来规定对数字类型的限定:

属性

描述

max
number
规定允许的最大值

min
number
规定允许的最小值

step
number
规定合法的数字间隔(如果 step=”3″,则合法的数是 -3,0,3,6 等)

value
number
规定默认值

Input 类型 – Date Pickers(数据检出器)

HTML5 拥有多个可供选取日期和时间的新输入类型:

  • date – 选取日、月、年
  • month – 选取月、年
  • week – 选取周和年
  • time – 选取时间(小时和分钟)
  • datetime – 选取时间、日、月、年(UTC 时间)
  • datetime-local – 选取时间、日、月、年(本地时间)

下面的例子允许您从日历中选取一个日期:

实例
Date: <input type="date" name="user_date" />

亲自试一试

输入类型 “month”: 亲自试一试

输入类型 “week”: 亲自试一试

输入类型 “time”: 亲自试一试

输入类型 “datetime”: 亲自试一试

输入类型 “datetime-local”: 亲自试一试

Input 类型 – search

search 类型用于搜索域,比如站点搜索或 Google 搜索。

search 域显示为常规的文本域。

About Sina App Engine

Sina App Engine(以下简称SAE)是新浪研发中心于2009年8月开始内部开发,并在2009年11月3日正式推出第一个Alpha版本的国内首个公有云计算平台(http://sae.sina.com.cn),SAE是新浪云计算战略的核心组成部分。     

    SAE作为国内的公有云计算,从开发伊始借鉴吸纳Google、Amazon等国外公司的公有云计算的成功技术经验,并很快推出不同于他们的具有自身特色的云计算平台。SAE选择在国内流行最广的Web开发语言PHP作为首选的支持语言,Web开发者可以在Linux/Mac/Windows上通过SVN、SDK或者Web版在线代码编辑器进行开发、部署、调试,团队开发时还可以进行成员协作,不同的角色将对代码、项目拥有不同的权限;SAE提供了一系列分布式计算、存储服务供开发者使用,包括分布式文件存储、分布式数据库集群、分布式缓存、分布式定时服务等,这些服务将大大降低开发者的开发成本。同时又由于SAE整体架构的高可靠性和新浪的品牌保证,大大降低了开发者的运营风险。另外,作为典型的云计算,SAE采用“所付即所用,所付仅所用”的计费理念,通过日志和统计中心精确的计算每个应用的资源消耗(包括CPU、内存、磁盘等)。     

    总之,SAE就是简单高效的分布式Web服务开发、运行平台。