Category: 小小草

IT 技术领域学海无涯。其实任何领域都学海无涯,无非 IT 发展太快了,让我有更多嘘唏。希望我掌握的技术有如小小草,虽然渺小,却有旺盛的生命力。

  • I need more accounting concept

    虽然学过几门会计课,但我还是很缺乏会计知识。我意识到会计在ERP中的重要性越来越突出,看来要恶补会计知识了。

  • W3C markup validator soap interface may be outdated

    我想在一个网站上添加W3C markup xhtml 自动验证功能:如果一个网页通过 xhtml 验证,就会在页脚出现 W3C 设计的一个”valid” Icon;如网页未通过验证则不会出现该标志。

    W3C markup validator 能以 soap 1.2 方式输出验证结果,但无论我在 php SoapClient 里怎么设置传递参数,它总拿不到 validator soap response。W3C 对此 soap interface 也没提供足够的说明文档,我仅知道它不支持 wsdl,我猜想 soap method 应该是 validate 或 check,但猜想归猜想,实际上没有一个能返回我想要结果。

    我想这跟 W3C 声称 soap output 只是个实验型产品有关,soap 以外还有其他方式的 output,难道多年来 soap 受到的关注较少?如果硬要以 soap 方式 得到 validator 的结果,我只能用 PEAR Service W3C HTMLValidator package,但看到这个 package 多年来一直没有更新,它所依赖的 HTTP Request package 已经废弃(Request2 取代之),而 HTTP Request package 所依赖的 Net URL package 也已废弃 (URL2 取代之)。这一连串的废弃让我觉得 Service W3C HTMLValidator 用起来不舒服。

    算了算了,反正我想要的只是一个网页自验证功能,何必用 soap client方式去访问 validator 呢?最后我用 file_get_content()了事。

  • How to get rid of annoying Windows Live ID popup

    不知 Windows update 在我计算机上改了什么,最近发现浏览某些目录时,会跳出烦人的”Sign in With Windows Live ID”窗口。我 google 了一下,此症状的起因不明,但解决办法还是有的,在网上邻居或者 Documents and Settings/(username)/NetHood 里删掉 My website on MSN 就可以了。

    Microsoft 因为审视一下这个问题了,这个”Sign in With Windows Live ID”弹出窗口的手法跟冒牌杀毒软件的病毒何其相似。

  • I’m leaving Aptana

    今天因为要处理一个 wsdl 文件,发现 Aptana 根本不支持。当然我可以下载 WTP plugin for eclipse 来让 Aptana 支持 wsdl,但 plugin for eclipse 的功能能算到 Aptana 头上吗?因为这件事让我重新审视了 Aptana,发现 Aptana 主要卖点是 Jaxer as Ajax server 和 Cloud。我只是想要一个php IDE,这两卖点对我关系都不大。即使日后需要 Ajax server,我想 Jaxer 之外应该会有更好的 alternative。云服务应该是 Aptana 的生财之道,对 Aptana 公司来说,卖服务当然要比卖产品更好,但对用户来说,还是离能避免的交年费、月费服务越远越好。

    Aptana php IDE 应该是 PDT 的改头换面,那么何不回到原装的 PDT?PDT 还是 eclipse 亲出,又有 php 业界老大 Zend 支持,跟着 Zend 走,应该是不会错的。PDT 最近出了 PDT 2.0,Aptana 似乎没有跟上脚步,当然 Aptana 有很多 php 以外的事情要做,我不强求 Aptana 什么,但这已经给我自己足够的理由回到 PDT。

    我用 Aptana 创建了一个存储在 workspace 以外的 php project,Aptana 就在此 project 的根目录创建了 .cache 的子目录。卸了 Aptana,装了 PDT,原位置重建 php project,会提示An internal error occurred during: “Building PHP projects …”. 解决的办法是,删了 .cache(PDT 会重建一个 .cache)。

  • Fedora services command line restart

    To restart some services of Fedora linux using command line –

    apache: /etc/init.d/httpd restart
    named: /etc/init.d/named restart
    mysql: /etc/init.d/mysqld restart

    To turn on and off firewall –

    off: /etc/init.d/iptables save
    /etc/init.d/iptables stop

    on: /etc/init.d/iptables start

  • Crontab file does not accept variables

    我建了一个每日自动备份的cron job,备份文件的文件含有系统日期`date +%m%d%y`,但发现crontab file里command不接受变量,导致crontab file这一行被忽略。

    我只好把含变量的command专门建一个bash文件,command间接由crontab file调用。

  • Magento new version notification is annoying

    It is exciting to see Magento new versions keep coming out once after a while. Magento notify administrator upon login, and administrator upgrades it, then Magento should stop notifying until another new version is available. The logic should be as simple as that.

    However, currently Magento message is always active even after upgrading. It only disappears when administrator marks it read or deletes it. Very annoying, isn’t it?

  • PayPal问题多多

    在使用paypal越来越深入时,我和同事们发现了paypal存在着很多问题,有些问题还算是低级错误,所以给我们的感觉是paypal对business用户(特别是美国以外的business用户)照顾得不周到。可能paypal名声在外,原来在我心目中是一个非常好用的payment solution,期望值高了,失望也大。平心而论,这些问题还不是nightmaire,如果发生在其他的payment service provider,我也不会有那么大感慨。

    目前我碰到的最大的问题是:paypal download history下载来的交易记录不能直接拿来做帐用,我专门写了个转化程序,用于正规化交易记录。从paypal download history中,可以下载到好几种交易记录,我主要关心两种:all activities和balance affecting payment。前者确实包含了所有的交易活动,但后者包含了一些不影响余额的交易。

    说到余额,记录中balance那一栏只能参考,很多时候它并不是真正的余额,搞得bookkeeper很头痛,这也是我写转化程序的直接动机。迄今为止,我遇到14种交易类型(type):

    1. eBay Payment Sent
    2. Payment Received  (仅用于money request)
    3. Pre-approved Payment Sent (paypal月费)
    4. Refund
    5. Shopping Cart Item (paypal cart模式,excluding VAT)
    6. Shopping Cart Payment Received (paypal cart模式,including VAT)
    7. Temporary Hold (dispute时,paypal暂扣款)
    8. Update to eCheque Received
    9. Update to Payment Received (虚拟终端模式,accept transaction)
    10. Update to Reversal (dispute结束后,paypal释放暂扣款)
    11. Virtual Terminal Transaction
    12. Web Accept Payment Received
    13. Web Accept Payment Sent
    14. Withdraw Funds to a Bank Account

    通过对比all activities交易记录和balance affecting payment交易记录,以下三种记录包含在all activities里,但被balance affecting payment剔除:

    1. Virtual Terminal Transaction with Status “Pending”
    2. Virtual Terminal Transaction with Status “Refused” (若accept transaction,会有两条记录,type分别为Virtual Terminal Transaction 和 Update to Payment Received;若refuse transaction, 只有一条记录,type仍是Virtual Terminal Transaction,只是Status为Refused)
    3. Web Accept Payment Received if payment by eCheque (upon being paid, not cleared)

    但实际上,仅剔除以上三种记录远远不够。比如:

    Shopping Cart Item 是 Shopping Cart Payment Received 同笔交易,excluding VAT的记录不应该和including VAT的记录同时进入数据表;

    Virtual Terminal Transaction 如果有accept transaction,就会有Update to Payment Received,同笔交易决不该有两条记录affacting balance。

    正因为paypal 对balance affecting 逻辑不清,balance那一栏的数据就很乱套。光看paypal net 和 balance那两栏,很多人会认为上一条记录的balance 加当前记录的net 应该等于当前的balance,但paypal balance不是这么算的,谁也不知道paypal的逻辑,搞得bookkeeper说paypal有时会就一笔交易重复收费。

    事实上,说paypal重复收费也冤枉了paypal。我转化程序的验证balance和paypal的最终余额还是完全吻合的。只能怪paypal提供的原始记录没有逻辑。

  • Workaround to row cannot be located for updating

    用ADO + ODBC操作Mysql database,用起来总不顺手。经常有莫名其妙的错误,其中不乏connector bugs。这些bugs不是我等能解决的,只有尽量不去触发bugs才是上策。

    比如,我今天在使用recordset.update时被提示”Row cannot be located for updating. Some values may have been changed since it was last read.” 我排错了好久,最后总结出以下best practices:

    • 避免使用”SELECT *”来查询,用到哪些字段就SELECT那些字段;
    • 如果SELECT中的字段中,某些值没有改变,recordset.update 可能会出错(也就是说,所有字段值都被改变后才能update)
    • Connector/ODBC Application Specific Tips特别提到Access can’t always handle the MySQL DATE column properly. If you have a problem with these, change the columns to DATETIME.
    • Float或double类型字段值,避免用Float或Double运算后的值直接去更新,应该保留必要精度后的值去更新。例如,x和y都是double类型,total字段也是double类型,不要用x+y去更新total字段,若total只要保留两位小数,就用formatnumber(x+y, 2)去更新total。

    综上,为了简单起见,如果要update a record,干脆先删除这条record,再recordset.addnew,赋予新值。对于新鲜记录的更新,以上四种可能的错误均没有出现。

  • I give up Godaddy’s DNS servers

    When I first started with Godaddy, I used to use my dedicated server as a DNS server for my domains. At that time, I could only use Godaddy’s Simple Control Panel (Turbopanel in another name) to edit DNS settings. Simple Control Panel did not have export and import facility, which meant editing multiple domains’ DNS settings was time consuming. Over a period of time, I discovered Godaddy domain management GUI was so powerful, but I must use Godaddy’s DNS servers, e.g. mns01.domaincontrol.com, etc. I knew these DNS servers were slower than average (probably they are overloaded), but I really need a facility like export and import DNS settings. Godaddy domain management GUI could let me export and import DNS settings, so I was quite relaxed using Godaddy’s DNS servers for a long time.

    Not until recently had I compared one of my websites using and not using Godaddy’s DNS servers. The benchmark score as per webceo report is 2 vs 6 (0 is the worst, 10 is the best). Using Godaddy’s DNS servers, the website DNS lookup time is extremely longer than if not. When DNS lookup is slow, connection, ping, and download are all slow.

    Reading these reports, I decided to relaunch my own dedicated server as a DNS server. However, I do not like use Simple Control Panel to manage DNS settings. I spend quite some time research Godaddy Fedora server structure. Finally I find the named conf files are stored at /var/named-chroot/etc/name-turbopanel.conf and /var/named-chroot/var/named/forward.mydomain. So I can edit these files to achieve the efficiency as using export and import.