IE6方程式: 提高开发效率

Posted by Jay on December 28, 2008

Jeremy Keith在他的博客中写到关于如何选择对IE6支持的问题。对于不同的网站,他们有不同的用户群,如果很少部分的人用IE6,还要考虑对老版本的支持么?又如果在IE6中发现很小的错误,是否要修正,应该用多少工作时间?

Jeremy分析了不同层面极端的几个方案:

  • 将所有的 IE6 访问者踢出你的站点
  • 完全遵循标准开发,并且没有任何针对 IE6 的测试
  • 只使用 Dean Edwards 的脚本让 IE6 支持额外的 CSS
  • 编写针对 IE6 的样式解决大部分问题(比如布局等)
  • 让站点在 IE6 以及其他浏览器上看起来一摸一样

并和Cennydd Bowle一起推算出一个数学公式(使用 t 表示总的开发时间、t6 表示花在 IE6 上的时间;所有的访问者数目表示为 a、 a6 则表示正在使用 IE6 的访问者):

p = 50 [ log ( at6 / ta6 ) + 1 ]

运算出来的p概率可以判断是应该应用 Dean Edwards 的 IE 脚本:

<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript"></script>
<![endif]-->
<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
<![endif]-->

当然在某些极端的情况下,比如公司的政策内部一定要运用IE6,作为内部网络软件开发人员,应当要保证IE6的100%正常运作。在浏览器支持的问题上,Yahoo YUI发布过一篇很好的文章”Graded Browser Support“, 作为好的开发人员,这篇文章应该是必读的。

当然这些都不能解决本质问题,为软需要加大力度让客户门升级自己的IE。在2008年低,我们的AJAX技术不能单单的存活在1997年的浏览器技术上。

VirtualHost browser cache

Posted by Jay on August 10, 2008

Setting up a virtual host on PC, Mac or Linux isn’t difficult, but the browser cache problem drives me crazy. Apart from editing the /etc/hosts mappings and httpd.conf, you need to restart both Apache and browser. Refreshing the browser(Firefox) doesn’t clean the cache, so the result will be always add /xampp/index.php at the end of the virtual host name.

Leopard system environment PATH setting

Posted by Jay on August 09, 2008

Leopard PATH setting is quite different from Tiger. Configuring PATH on Tiger, we used to either modify the /etc/path or user path configuration. With Leopard, system-wide path configuration is managed by /etc/profile. The file loads a path_helper script. So what the script does?

The path_helper constructs the system environment PATH in this order:

  1. Reads the local user configuration first, under ~/.bash_login
  2. Appends default system paths /usr/bin:/bin:/usr/sbin:/sbin
  3. Reads the paths line by line in /etc/paths
  4. Retrieves all the files in /etc/paths.d/ that contains other packages configurations. For example, I created a file /etc/paths.d/system and stuff in some user paths settings. They are appended after step 3.

In my case, I wanted my XAMPP packages overrides the default Leopard MySQL, PHP and Apache paths ( so I don’t have to type in /Application/xampp/xamppfile/bin to use the command every time, also the package is easier to manage ). So just put the paths in the ~/.bash_login, that will override the system default.

Close the Terminal and open it again, to check your path settings, type:

 echo $PATH

There we go, it’s updated.

Code Collector Pro帮助整理代码 3

Posted by Jay on August 06, 2008

Code Collector Pro代码整理问题一直是我的难题,不想用大的IDE整理自己的代码,特别是一些很小的部分。今天看到Code Collector Pro这个在MacOSX上面简单的程序能够帮助整理日常用的代码碎片。

确实,如果你是一个经常写代码的工作人员或者学生,总是有一些有用的代码需要记住又一时不能记下来,一般的办法,就是创建一个空的文本档暂时粘贴到里面;再有就好好整理到一个自己的记事本上;或者再源文件里加上注释;要么在什么网站上找到的就当作书签。时间长了,代码就都很凌乱,这样总不是个办法。

Screen Shot

CCP支持很多整理功能:

  • 将代码分组
  • 语言种类的标实
  • 搜索
  • Drag & Drop代码的片断
  • 增加标签
  • 输入,导出文本
  • 到CodeCollector.net上下载或者上传代码的碎片
  • 设置这片代码的版权
  • 自动更新版本,等等

CCP有两个版本,一个免费的Lite版本,支持少部分的功能,但是足够可以完成整理的工作;收费版本支持更多的功能,价钱也很合理,大约20欧元。

如果大家知道Windows和Linux下面有什么整理代码的好工具,可以留言和我分享一下。

Git:更好的SCM版本管理系统 1

Posted by Jay on July 12, 2008

一直在忙着工作的事情,清闲下来准备一下毕业项目的资料。特别是代码版本管理的软件,有考虑到CVS, SVN等等,这些大多数是中心服务器结构的管理,最近看到Google工程师开发的Git, 让我感到一阵兴奋。

Linus Torvalds 开发了Git,一开始主要因为CVS和SVN不能满足开源的需求,需要一种新的方式管理Linux Kernel。Git是一个distributed SCM(Source Code Management). 他的最大优势在于开发人员可以随意的创建自己的Brunch,简便多版本的整合(merge)问题,并且优化下载速度。

如果有人用过CVS, SVN在一个开发小组,都会发现这样的问题:大家都不能Commit,直到觉得代码被第二个开发人员review过,或者通过测试才可以,这样才能保持Source trunk的整洁。这样是件很麻烦的事情,如果在SVN, CVS上创建branch, 做自己的一些新功能的试验,也会造成麻烦,你会想到底用什么tag? 大的公司里面会有一堆的规则创建branch(加B下划线版本号码等等),然后整合到trunk上又给自己代来一堆麻烦,所以如果用过centerailized SCM开发人员大都会在trunk上开发。

如果你是一个充分利用Brunch的开发人员,那Git可以是一个不错的选择。给个Git官方网站,还有YouTube 2005年的Git开发介绍会(一个小时的录像)。