Archive for the ‘小小草’ Category

802.11n果然不同凡响

Friday, September 26th, 2008

我不是追新族。在802.11g还大行其道的今天,我本没有打算升级至802.11n。但因为需要在一幢大楼内组网,我想了好多方案,比如:

  • 用homeplug(怕途中电表太多干扰太大,觉得这个方案不好)
  • 用WDS,也就是wireless repeater(买了belkin的802.11g repeater,经常死机,换了一个也是如此,退货;linksys也有一款repeater,贵于belkin,但我对linksys的产品没信心,懒得买来再退了)
  • 用高增益天线(ebay HK有人卖得很便宜,贪便宜买来发现是烂货,教训啊,千万别上ebay买东西——其实我知道的,但就是禁不住便宜的诱惑,抱着反正几镑钱,就当扔水里也不太心疼的心理又去买了个教训)
  • 用高功率无线路由(恰好我有一台2Wire 2700HGV,但就算调到100mw效果也不理想)

802.11n的优越的传输性能我有耳闻,但百闻不如一见,我用买一个linksys repeater同样的价格买了一套Tenda 802.11n (draft 2)无线路由加USB无线网卡,两地用802.11n接通以后,效果出奇得好,已经完美解决我中长距离组网的需求。尽管走了很多弯路才落实这个方案,但我还是非常高兴。

而且,我发现Tenda的无线路由还带有WDS功能,这可是802.11n级别的WDS啊,比起单纯一个linksys repeater,仅是802.11g级的,要划算好多好多啊。

Godaddy mod_rewrite

Thursday, September 25th, 2008

I have two Godaddy accounts now. One is for a dedicated server, the other is for a deluxe share hosting package. Actually I do not need any share hosting once I get a dedicated server, but someone bought this for me, so I spent some time inspecting how good / bad it is.

I should regard myself as a Godaddy loyal client. I am 100% satisfied with their dedicated server service, and also, Godaddy domain management is the most powerful and convenient I have ever seen. However, Godaddy share hosting is definitely not something workable for me.

I am recently struggling at setting up magento in Godaddy share hosting. Magento setup is 50% successful. I mean, magento can run homepage, wishlist, popular search, etc all right, but it run into blank pages at many points, e.g. about us, customer service, etc. Initially I thought it was mod_rewrite problem, so I used phpinfo to check. I did not find mod_rewrite enabled. I quickly installed wordpress to double check, and if I enable wordpress search engine friendly url features, it runs into 404 error. I searched Godaddy Knowledge Base (FAQ centre). It says:

Mod_rewrite is an Apache web server module installed on all of our Linux servers by default; it does not have to be installed or enabled. Our Linux hosting accounts support most mod_rewrite functionality.

You do not need to enable mod_rewrite in your httpd.conf, as this is handled at a global level. All you need to do is add the desired code to the body of your .htaccess file.

For more information about mod_rewrite see the Apache Module mod_rewrite documentation.

NOTE:The .htaccess file containing the rewrite rules must be in the same directory as the target files.

This article did not help me. So I had to submit a ticket. Within several hours, I got the reply (I am satisfied with Godaddy support reponse speed) but it only contained the same words as the answer from Godaddy Knowledge Base. I googled “godaddy mod_rewrite” after I could not get a clear reply from Godaddy. I should have googled it earlier because soon I found someone mentioned rewrite rules in .htaccess with Godaddy share hosting DO NOT TAKE IMMEDIATE EFFECT.

This solved all my queries. Although I still do not know how Godaddy hide mod_rewrite from phpinfo, after several hours of being installed, wordpress is working properly.

However, magento is still not running properly. I assume it has nothing to do with mod_rewrite settings. By all means, to my opinion, magento is not suitable to run on a share hosting package. Installing magento on Godaddy share hosting account is only for my curiosity. I have been running magento successfully on my dedicated server.

Gmail Gcal Integration

Friday, September 19th, 2008

Gmail可以以Contact为单位,列出与某个Contact来往的Conversions。Google Calendar也可以搜索Who,把与某个人有关的Events都列出来。Google Contacts Management是以email address为identifier,而Google Calendar的客人名单也可以从Google Contacts里选取,可见Google Contacts, Google Email, Google Calendar可以三位一体。

但我研究了一天也没找到一个办法:选定某个Google Contact后,把Conversation (Email) 和 Events一起按时间顺序列出来。我知道很多人用 Gmail 和 Gcal 做 Business Diary,针对一个Google Contact的history可以视不同情况分别记录到Gmail或Gcal,但如果能合并查看的话,将会方便很多。

Magento Base

Sunday, September 14th, 2008

最近发现我的magento后台不能更新数据,但系统每次都提示保存成功,一开始我还以为数据库出了问题。

查了好久的原因,这才发现是因为我把www.goods-pro.com全部重写到goods-pro.com (non-www)的缘故。设定301规则之前,我没有更改Magento Base。这样,magento base记录的base url跟我维护时登录的url是不同的,大概为了安全考虑,magento不允许保存数据。但是,如果不允许,早说嘛,浪费我好长时间找原因。

Godaddy Offsite DNS

Wednesday, September 3rd, 2008

我非常感谢Godaddy提供的Offsite DNS服务,我已经全面实施。

最近发现Godaddy Offsite DNS一个考虑不够周到的方面:Setup Domain for Offsite DNS 之前不进行域名持有人的身份验证,这可能会有一些安全隐患。

我在Godaddy有若干帐号,帐号1对某个域名A设置的Offsite DNS,帐号2购有一个Godaddy Deluxe Plan,Deluxe Plan是个Share Hosting Plan,目前对我来说已经没有使用价值了,但以前曾针对域名A搞了一个测试。Deluxe Plan有自动设置DNS的功能,我没有从帐号2里删除域名A,造成帐号1里域名A的Offsite DNS无法生效。

这里我不理解的是:Offsite DNS和Deluxe DNS使用各自不同的Nameservers,但Deluxe DNS还是影响到了Offsite DNS。

这里我觉得不安全的是:如果帐号1和帐号2分属不同的人,或者域名A转让了主人,而前后主人都使用Godaddy DNS,那岂不是问题多多?

奥运成就了多少人的财梦

Thursday, August 14th, 2008

今天读到一篇报道,说某无纺布袋厂承接了奥运会的10万个礼品袋的订单,4块钱一个,不赚钱,全厂加班加点赶制出来,还说这种袋子市场价格在6块钱,云云。

这样的报道明显就有失水准,4块钱,这里指的应该是工厂销售价格;6块钱?绝对是指零售价格。如果也是指工厂其他订单销售价格的话,那我很难想象这会是怎样一个金贵的无纺布袋。而我采购过的数量在10万个,就算非常非常精美的,单价超过4元的无纺布袋,好像还没有过。

我想,中国肯定会有大把工厂愿意为奥运会不赚钱承接订单;但摆出4元/个的价位,还会有更多的工厂想抢这个订单,名利兼收,何乐不为?

NameVirtualHost has no VirtualHosts

Tuesday, August 12th, 2008

这个问题不大。如果是我自己手写Apache conf文件,我一般不会用到NameVirtualHost。

我发现这个问题出现在Godaddy Server上,预装的是Godaddy自带的Simple Control Panel。Simple Control Panel会把Virtual Host信息保存在simplepanel.conf。如果通过Simple Control Panel重启Apache,不会看到任何症状;但如果在ssh下运行/etc/init.d/httpd restart,就会有若干个Warning “NameVirtualHost xxx.xxx.xxx.xxx:80 has no VirtualHosts”。

Simple Control Panel为每个配置的域名都添加一个ip-based NameVirtualHost directive,其实是不必要的,过多相同的NameVirtualHost就导致了Warning,删掉就可以了。

在Fedora上安装mcrypt

Saturday, August 9th, 2008

最近我为了让Godaddy的服务器支持magento,就要装mcrypt module,顺便也可以了却phpmyadmin登录时的一段warning message。

Linux 的大虾们别笑话我,这么点小事让我忙乎了半天。对我来说,Windows下很简单的问题,Linux下就不简单。Linux命令我只能依样画瓢,很少能举一反三。Linux有不同版本,我的Godaddy Server装的是Fedora,好不容易找到一份明确适用于Fedora的mcrypt安装步骤。当然知道了步骤,操作起来是相当简单的。

  1. At the terminal, su root - you are now going to yum, not ./configure, make, and make install…
  2. yum install mcrypt - this will get you libmcrypt, mhash, and mcrypt
  3. yum install php-mcrypt - this will get you the functionality within PHP

favicon.ico in IE

Friday, August 8th, 2008

IE is a nightmare - 我对此体会越来越深刻。

想让自己的网站容易识别,就得从很多方面下功夫。个性化的,或与logo相配的favicon.ico就是要做的一件事情。如何让自己制作的favicon.ico在地址栏里显示出来,这点小事在Firefox下就是a piece of cake,在IE里我一直是忽视的,当我想起要重视的时候,为此整整折腾了一个晚上。所以我说IE is a nightmare。

首先,favicon.ico必须是标准的icon文件。之所以这么说,是因为有人说把favicon.bmp,或favicon.gif,或favicon.jpg格式保存的文件改名成favicon.ico就可以了,其实这样改名来的favicon.ico在Firefox下是能显示的,如果有人喜欢看重结果,不追求过程的话,Firefox下让favicon.ico出现的结果已经达到。但改名来的favicon.ico并不是真正的ico格式,IE是不认可的。对于这一点,错不在IE。我是追求完美的,要做就做一个正宗格式的favicon.ico,32 x 32 或 16 x 16都可以,我喜欢32 x 32,因为我没有ebay那么高水平,16 x 16还能尽显细节。

尽管有了标准格式的favicon.ico,能否在IE下显示还受很多因素制约。总的来说,我的感觉是,我按W3C标准出牌,但IE不按标准接牌,为兼顾到IE用户,我要付出成倍的时间。当然,我以外还有很多人,IE浪费了很多人宝贵的时间。好了,不发牢骚,让我总结一下IE下的制约因素。

  1. 虽说把favicon.ico放在网站的document root下就可以,但html里要有
    <link rel=“shortcut icon” type=“image/x-icon” href=“/favicon.ico” />
    更保险。我发现google等几个站点都没有这一条语句,但它们的favicon.ico在IE里的显示成功率还是很高,对此我百思不得其解。
  2. href绝对不能带域名,例如,不能写成
    <link rel=“shortcut icon” type=“image/x-icon” href=“http://example.com/favicon.ico” />
  3. 如果更新了favicon.ico,一定要清除cache才能看到更新,否则,无论怎么刷新都是不会更新的favicon.ico。
  4. 清除了cache,还得关闭IE,否则,你还是看不到更新。
  5. IE在清空cache后第一次运行,访问任何网站,你都无法看到它们的favicon.ico。
  6. 清空cache后,让IE运行一次,随便访问一个网站,让cache里留下点东西,关闭IE,再打开IE,然后你才可以看到更新后的favicon.ico。

复杂吧,我搞得头都大了,才总结出这么点经验,不保证在你的机子上IE也是按这个“规律”运行的。因为,你知道的,IE是反常规出牌的。

以上说的还是较新版本IE7,至于IE6,我劝你还是断了让favicon.ico在IE6的地址栏出现的念头。因为,你不光要符合以上条件,你还得让你的用户把你的网站收藏为favorite,IE6在访问被收藏的网站时,才会显示favicon.ico (这大概是favicon的由来?)。我很少收藏别人的网站,所以我就没指望别人来收藏我的网站。

Block Ad By Hosts

Thursday, August 7th, 2008

Internet上充满了垃圾广告,更有一些phishing广告。今天我发现有个细心的人整理了一份广告商所使用的域名清单,把它添加到hosts文件里,就不怕来自这些域名的广告在你屏幕上蹦出来了。只是:

  • Google Adsense 的广告也在打击范围之内,而我对Google的文字广告并不反感;
  • 我浏览的网站中,中文广告占很大比例,质量普遍不高,这份清单便宜了中文的广告商,对中文用户有欠照顾。

这个方法很简单,难得的是有心人在整理,大家就坐享其成了。因为全部是指向localhost,所以就算有心人判断失误,也不会有什么危害,更不会有DNS劫持发生。

# This Hosts file has been altered to block ad servers.
# To restore the file just
# delete everything below the first entry or rename hosts.nbk
# to hosts and move it to the proper directory.
# Updated: scroll down for date stamp
# This is an ad blocking hosts file compiled by
# Mike Skallas (user245 (at) hotmail.com)
# Available at http://everythingisnt.com/hosts.html
# Copyright 1999-2007. Please do not redistribute, use above link.
# Free only for Residential/Non-Profit use.
# Just add ‘127.0.0.1 ADSERVER’ to the bottom to continue the list.

因为列表很长,竟然超过WordPress Post字数限制,直接post需要修改”wp-includes/default-filters.php” file,

commenting

//add_filter(’the_content’, ‘wpautop’);

这么做还不知道对WordPress有什么副作用。还是做一个单独的文件让大家下载吧,hosts.