Mar 13, 2007

Google AJAX Search 使用简介

无意中发现了Google提供了AJAX Search功能,可以适用于各大Blog(包括wordpress,blogspot,自制网页,等等),随即用Google大神搜索了一下。结果我发现网上有不少相关的文章,但是适合我的一个都没有,于是我自己动手把这个功能加到blog中,具体效果请试用左侧的搜索栏。本着共享的原则,将方法写在这儿,给大家一个 参考。

Google AJAX Search的功能非常强大,可以搜索网页、地图、新闻、书籍等等。但是我觉得对一个blog搜索来说,只要有本站搜索和网页搜索两项就足够了;另外,现在的blog多会采用两栏或者三栏的布局方式,因此,我也选择了将搜索栏和搜索结果分开显示的方法,合理的利用空间,如果你希望添加更多的内容,请参见Google AJAX Search documentation

首先你要做的是去Google的网站申请一个Google AJAX Search API,点击左下角的确认框,并且输入你的blog地址后,你会得到一个长长的Key。

Show More >
Post by SUN @ 12:23 am 与时俱进 | Comment (1)
Mar 10, 2007

优化Wordpress-wp终极优化手册

更新:关于wp-cache的优化,请参见本站新作:
优化WP-Cache:Wordprss优化手册(2)

Wordpress的功能非常强大,诸多的插件、花哨的界面,使得它的读取速度也大大降低。因此,如何优化以加快访问者的浏览速度便成了wper们思考的问题。我将诸多高手的方法整理总结了一下,汇成此文,希望能对大家有所帮助。 (建议将WP系统更新至2.1.2 以上)

  1. 优化所有的图片(images):
    图片其实是影响网页读取速度的关键,稍大一些的图片就可能达到100K;因此,在上传自己的图片之前,务必用Photoshop的"保存至网页"(save for web)功能,对图片进行优化。(例如,保存成GIF, PNG格式等等)
  2. 关闭一切不必要的插件(plugins):
    在安装插件之前,首先问一下自己,你是否必须要此插件。不要安装UTW之类的超大插件,尽可能的降低插件数量。
  3. 开启WP自带的缓存(Cache)功能:
    1. 打开WP根目录下的wp-config.php文件,在最后一行之前添加 define('ENABLE_CACHE',true);
    2. 将WP-content目录下的cache目录属性改为777,以保证系统能够写入cache。
    3. 如果您的blog日访问量在200以上,建议安装WP-Cache插件,否则不推荐使用。
    4. 让WP-Cache也用上Gzip:如果你安装了WP-Cache,一定知道WP-Cache要求必须关闭WP的内置GZip功能,但是我们可以在wp-cache-phase1.php中添加代码来实现Gzip压缩功能。
      打开wp-cache-phase1.php,大概在35行左右找到如下代码:

      foreach ($meta->headers as $header) {
      header($header);

      在此代码前添加下面的代码:

      if ( extension_loaded('zlib') ) ob_start('ob_gzhandler');

(more...)

Post by SUN @ 10:35 pm 与时俱进 | Comments (31)
Mar 2, 2007

DW 8: FTP info does not save for remote sites

Dreamweaver 8 dunt save user name/password for those sites which are connected through ftp.
It happens once IE7 is installed.
Adobe didnot mention this issue on its website, but fortunately, Dreamweaver 8.0.2 Updater can fix this problem.

Post by SUN @ 4:47 pm 与时俱进 | Comment (0)
Feb 28, 2007

WP-Cache Plugin Bugfix for blank page

Must say, WP-cache is very powerful tool~, if you didn't install it, just try~
I found this bug when I installed WP-Cache yesterday. it took me half an hour to find the problem, so I'm going to write down this entry to help you out.

Encoding Issue
After installing and enabling WP-Cache, you can only see a blank page with IE but all your pages can be seen with firefox, then you have a problem, you have to change the encoding manually to figure it out. (if you cannot see any page with IE or firefox, please check this link).

So here comes the solution, very simple...

  • 1. Open up the WP-Cache folde, and you can see a file named "wp-cache-phase2.php".
  • 2. Open it up, and do a search for “$value = "text/html; charset” (about line 231).
  • 3. Once you find it, simply replace the whole line ($value = "text/html; charset=\"" . get_settings('blog_charset') . "\"";)
    with the following line:
$value = "text/html; charset=" . get_settings('blog_charset') . "";

4. Now, save, re-upload, sure, you must overwrite the old file. then empty the cache files.

Tips:
It happens coz the old file has two extra double quotation marks so that IE cannot recognize the correct encoding.

Post by SUN @ 8:53 pm 与时俱进 | Comment (1)
Oct 23, 2006

CSS hack for browsers

最近看到了MS发布了正式版的IE7,忍不住跑去升级了,但是升级完毕后就发现用IE7看我的blog时候,排版就有些小问题。

仔细研究了一下,发现代码出在css文件中的li 和ul上。不用的浏览器对li和ul的解释不一样,标准浏览器如firefox就中规中举的解释,而IE仗着自己强大的市场占有率非要按照自己的方法来诠释,更让人ft的是IE6和IE7的解释还不一样……

不得已,咱们只能想个折衷的办法,对不用的浏览器采用不同的代码:
向google大神求教以后得到如下解法

比方说我左侧sidebar的控制,可以针对不同的浏览器写出三个来:

#menu li {} /* Moz, firefox, */
#menu li ul {}

* html #menu li {} /* Moz, firefox, */
* html #menu li ul {}

*+html #menu li {} /* IE7, */
*+html #menu li ul {}

不同的浏览器只会解释各自的代码行,互相不干扰。
具体的解释见内,admire一下牛人,我就不多费口舌注解了。

Post by SUN @ 10:22 pm 与时俱进 | Comment (0)
Oct 17, 2006

Google Calendar

事情多的时候,就需要用行事历,之前我一直使用的是outlook所提供的功能。

可随着gmail的广泛使用,我开outlook的次数也越来越少了,所以今天打算搬到了Google Calendar上。
Google的东西,一直是品质优良的,之前不用,主要是习惯问题,懒得换了,今日既然痛下决心搬家,自然要好好研究一番了。

下面总结出来几个优点:
1.GC和Gmail整合很好,只要email里出现了时间信息,gmail系统中会自动在右侧显示gc,方便安排日程。
2.GC有着强大的提醒功能,你可以选择电脑、email或者手机提醒。目前来说,大多数国家的手机提醒服务是免费的。
3.基于网络的GC可以在任何能上网的地方读取、共享。

好处多多,下面是我的部分日程。

点击整合到自己的Google Calendar中。

Post by SUN @ 1:17 pm 与时俱进 | Comments (6)