档案 一月, 2010

默认Web字体样式

作者: seasun

通常用户看到的页面的样式会受到三层控制,第一层是浏览器的默认样式,第二层是网页定义 样式,第三层是用户自定义样式。和CSS一样,后面的优先级高于前面的,也就是说网页定义样式可以覆盖浏览器的默认样式,而用户自定义样式优先级最高。实 际情况是虽然浏览器都或多或少提供了用户自定义样式的功能,但是极少数会有用户去自定义,一般用也是高级用户。而浏览器默认的样式往往在不同的浏览器、不 同的语言版本甚至不同的系统版本都有不同的设置,这就导致如果直接利用默认样式的页面在各个浏览器下显示非常不一致,于是就有了类似YUI的reset之类用来尽量重写浏览器的默认设置保证各个浏览器样式一致性的做法。

拿字体来说,各个浏览器默认的字体种类、字体大小和字体行高都不一样,比如IE8的中文版在Windows XP下显示网页时默认字体是宋体,而英文版肯定不会如此。所以我们需要统一设置默认的字体样式,以便实现一致的显示效果来保证设计的一致性和提高开发效率。
(全文 …)

为移动网站编码

作者: seasun

如果你正准备为你的网站制作一个移动设备版本,那这篇文章将会对你相当有用,在本文中,将探索移动Web网页编码设计的各种技巧和注意事项:

  • 为了移动设备上的用户体验可以被接受,代码得怎么设计。
  • “Mobile Web”与普通网站的不同之处?
  • 可以让网站成功运行在移动设备和桌面浏览器上的基本技巧
  • 一些Mobile Web设计中的建议和禁忌、以及大量资源

(全文 …)

在网络发展领域,由于 jQuery 简单易学,易于使用和易于扩展的特点,因此正慢慢变得无处不在。以下是从一些 jQuery 相关文章中整理出来的 30+ 新鲜与惊奇的 jQuery 插件与教程。如果你正在寻找最新的 jQuery 信息,这些内容值得一读。
(全文 …)

1. PHP可阅读随机字符串

此代码将创建一个可阅读的字符串,使其更接近词典中的单词,实用且具有密码验证功能。

/**************
*@length - length of random string (must be a multiple of 2)
**************/
function readable_random_string($length = 6){
    $conso=array("b","c","d","f","g","h","j","k","l",
    "m","n","p","r","s","t","v","w","x","y","z");
    $vocal=array("a","e","i","o","u");
    $password="";
    srand ((double)microtime()*1000000);
    $max = $length/2;
    for($i=1; $i<=$max; $i++)
    {
    $password.=$conso[rand(0,19)];
    $password.=$vocal[rand(0,4)];
    }
    return $password;
}

(全文 …)

9个PHP库简介和下载

作者: seasun

9个非常有用的PHP类库,相信一定可以为你的WEB开发提供更好和更为快速的方法。

1. ReCAPTCHA

The reCAPTCHA 库让你可以为网站创建高级的 CAPTCHA 系统,这个系统其实是用来生成验证信息的,甚至包括语音验证。当然还有 reCAPTCHA 服务可以使用,其提供易用的免费 API,值得在你的网站试试。

下载 ReCAPTCHA | 获得 API Key | 文档
(全文 …)

HTTP Headers 傻瓜教程

作者: seasun

本文系统的对HTTP Headers进行了简明易懂的阐述,我仅稍作笔记。

什么是HTTP Headers

HTTP是“Hypertext Transfer Protocol”的所写,整个万维网都在使用这种协议,几乎你在浏览器里看到的大部分内容都是通过http协议来传输的,比如这篇文章。

HTTP Headers是HTTP请求和相应的核心,它承载了关于客户端浏览器,请求页面,服务器等相关的信息。

(全文 …)

eWeek网站于今日搞了一份TOP 10名单,罗列了10大有待改进的IT产品。这其中包含被世人唾弃的IE浏览器,也包含拥有众多混凝土粉给的Apple和Blackberry产品。看看他们都干了些什么,让eWeek叹气:”革命尚未成功,同志仍需努力!”
(全文 …)

如果您的服务器程序中正在使用PHP脚本语言,又或者可能已经使用了addslashes() 和 stripslashes()等方法去处理表单中引用的符号;但是在JavaScript中却没有同等的方法,通过以下方法您可以很方便地处理这个问题:
(全文 …)

Databases Files
Advantages
  • You can easily add new fields, or modify existing fields.
  • Updating player statistics (from outside the game) is much easier.
  • You can instantly and efficiently retrieve various statistics, via SQL queries.
  • There is no need to perform file I/O operations yourself, the database server will do that for you.
  • Easy to update/restore.
  • Very fast access (read/write).
  • Easy to implement.
  • No additional libraries needed.
  • No dependence on a database server. Therefore, you don’t have to worry about getting database updates or security issues.
Disadvantages
  • Easy to make mistakes. For example, doing an update query where you omit the ‘where’ clause. It can have disastrous effects, especially if you have old (or no) backups.
  • Databases may be slower than actually opening/writing a player file. You might lose a few milliseconds when retrieving some data, especially if a lot of players log in/out at the same time.
  • Additional code is required to convert your data to/from the database.
  • Database and SQL experience is required. In addition, you will need a library to interface between your program and the database.
  • If for some reason the database file becomes corrupt, you are out of luck; you can lose all the players (especially if no recent backups).
  • It can be very difficult to add new fields, unless you carefully design the file format/structure from the beginning.
  • Inability to do player-wide queries (this can be circumvented by having a program that adds every night the important fields in a database server).
  • Needs special coding if you want to update/check player stats.
  • A little bit harder to update/restore.

JavaScriptWeb 开发与设计中不可或缺的东西,不管是一个简单的网页还是一个专业的站点,也不管你是高手还是菜鸟,如今 JavaScript 库越来越强大,可以胜任许多复杂的工作,然而同时,人们在众多 JavaScript 库面前又觉得无所适从,本文,我们将使用 Google 搜索出排名前 10 位的 JavaScript 库,并对它们逐一进行介绍。
(全文 …)