Author: 芳草苑主

  • I go back to ISP’s nameservers to resolve my domains

    很久以前什么都不懂的时候,觉得能自己做 DNS server,为自己的域名解析,是件很了不起的事情。再加那是 ISP 的 Domain Manager 对批量域名的更新支持不足,而自己的 DNS server 能 GUI 和 command line 并举,满足我对批量操作的要求。

    今非昔比。我倾向于放弃自行解析,重回 ISP nameservers 的环抱。这主要是基于以下考虑:

    • 自己的服务器是普通的服务器,ISP nameservers 是专业的,似乎它们的解析速度更快。
    • 自己的服务器一机多用,一迁移所有服务都要移,把 DNS 剥离出去可以少掉一项工作。
    • Godaddy Domain Manager GUI 有很大改进,现在批处理能满足我的要求。而我大部分域名在 Godaddy 注册,其他 ISP 不见改进,但我要求也不高,不能批量就一个个来吧。
    • Godaddy 控制面板的响应速度有很大提高,可能是它在荷兰建数据中心的功效。
    • 从节约开支的角度,我不得不降低一些服务器的配置,把 DNS 剥离出去可以减轻服务器负担。

    作为一个前期测试,今天先把一个域名交给 Godaddy nameservers 解析,试用一周,如满意就全盘放弃自己的 DNS。

  • Upgrade a server from Fedora 10 to 14

    今天终于把一台服务器从 Fedora 10 升到了 Fedora 14,一开始想用 yum 升级(在 fedora upgrader 的帮助下),尝试跳级升级的,不成功。然后用 Fedora 自身的 major upgrade,分别尝试了跳级升级和不跳级升级,都不成功,最后卡在 Fedora 11 拷贝完升级文件但进不了图形界面完成升级,彻底动弹不得。很懊恼,早知如此还不如一开始就全新安装,就是想绕开重建 server 的麻烦,但这看来是绕不开的。

    稍后我列出此次升级的 checklist(以前陆续也写过,但有两年没干这活了,变化还是很大)。

    此次升级损失了 DNS slave zones 的文件。本以为主 Server 有备份,但主 Server 几次搬家,什么时候把那些文件搬丢了也没印象了。

    升级的起因是我需要 php ssh2,却发现 Zend Server 暂不支持。不想经历自行往 Zend Server 添加 php ssh2 的麻烦,就想回到 Fedora 管理下的 php。不久前说过,我觉得 Zend Server 是鸡肋,这下更坚定我的看法。

  • Damn phishing

    网络骗子很可恶,因为它们在一个八杆子打不着的地方诱人上钩。虽然我不会上钩,但拿它们没办法,所以它们可恶。

    今天接到一个未知号码(诈骗特征一)的来电,接起来后线路质量不是很好(诈骗特征二),一个印度口音的男子自称来自我的手机公司,问我是某某某吗。

    因为线路不好,所以我根本没听清它到底称呼我什么,我就说:

    “Yes?”

    它说:

    “You ordered a brand new phone in a year’s time, right?”

    我这时不能确定它的意图,可能是手机公司要给我 upgrade,那就继续听下去。我还是说:

    “Yes?”

    它说:

    “Can you confirm your name?”

    我立马警觉,说:

    “Why do I need to confirm my name?”

    它说:

    “Because I want to verify your name.”

    我说:

    “Why do you want to verify my name?”

    它见我不上钩,挂了。我还是觉得很气愤,骗子们四处逛,总有无知的会上钩,谁能整整这些败类,啊?!

  • Reinstate Magento order status after upgrade

    Recently I upgraded a Magento store from 1.4.0.1 to 1.5.0.1.

    Magento has changed order tables from key-value type to flat structure in 1.4.1.0, which caused a big problem for my upgrade – all orders lost their status and state value.

    I have not discovered what exact reason made it happen, but I know it is my store specific, because I have other stores successfully upgraded from 1.3 to 1.5.0.1 without any problems.

    Just in case you had the same issue, you can run this mysql query code to reinstate Magento order status(and state as well).

    
    UPDATE magento_sales_flat_order AS o
    INNER JOIN (SELECT s1.parent_id, s1.status, c.state
     FROM magento_sales_flat_order_status_history s1
     JOIN (
     SELECT parent_id, MAX(entity_id) AS entity_id
     FROM magento_sales_flat_order_status_history
     GROUP BY parent_id) AS s2
     ON s1.parent_id = s2.parent_id AND s1.entity_id = s2.entity_id
     LEFT JOIN magento_sales_order_status_state AS c
     ON s1.status = c.status
    ) as s3
    ON o.entity_id = s3.parent_id, magento_sales_flat_order_grid AS g
    SET o.status = s3.status, o.state = s3.state, g.status = s3.status
    WHERE g.entity_id = s3.parent_id;
    
    
  • 非诚勿扰随想

    看过最近一期非诚勿扰,觉得众位老师似乎有逼嫁罗蔼轩之嫌。我虽然不苟同罗蔼轩的择偶标准,但支持她坚持自己的标准。

    同时我也注意到几个月来非诚勿扰的牵手成功率有所下降,这跟女嘉宾的惜售心理有关。男嘉宾总是尽一切努力展示自己,女嘉宾却可以任性地灭灯,这不公平。为了培育女嘉宾“过了这村,没了那店”的危机意识,避免她们抱着别样目的占着茅坑不拉屎,我建议非诚勿扰节目组在每期节目后搞一个末位淘汰,把人气最低的女嘉宾请下去。

    这样女嘉宾就会斟酌自己灭灯的理由。同时保持非诚勿扰的高可看性——激励对称嘛。

  • Activate Magento ajax loading graphic using jQuery

    I extend Magento js using jQuery.
    I need ajax loading mask and grahpic for jQuery ajax request.
    I want to achieve consistent look and feel.
    I want to activate Magento ajax loading graphic initially used in prototype using jQuery.

    Although prototype register global event handlers for ajax create and complete events, the handlers will not fire by jQuery ajax request. For jQuery to activate ajax loading graphic, I manually fire the onCreate event in jQuery function.

    var r = {options:{loadArea:''}};
    varienLoaderHandler.handler.onCreate(r);
    

    to deactivate

    varienLoaderHandler.handler.onComplete();
    

    Let me know if you know a better way to tie jQuery and prototype together.

  • Magento Cush module is about to release

    Long long time ago, I installed Customshippingrate module, but never made it work on my site. The module sits on the disk but disabled. Recently I took some trouble and about three days developing my own module Cush for admin panel users to charge special shipping price when creating an order.

    Cush module does not override any Magento classes so it is virtually 100% compatible with other modules. Neither does Cush module override any Magento templates so basically it reuses Magento native interface. Cush is not a shipping method so it can work with any Magento shipping methods or 3rd party shipping methods.

    Cush module injects customisation logic by javascript. What it actually customise are values in magento_sales_flat_quote_shipping_rate where is pool of shipping quotes. Values customised belong to an individual quote so the customisation hits its point.

    When writing Cush module, I found a defect in Magento own code app/design/adminhtml/default/default/template/sales/order/create/shipping/method/form.phtml.

    
    echo $this->getCarrierName($_rate->getCarrier());
    
    

    The above code reads value from configuration and shows it as carrier title. If I was not injecting shipping method customisation logic, I would not realise it is a defect. Carrier title value, like method title and shipping rate, if read from magento_sales_flat_quote_shipping_rate using $_rate->getCarrierTitle(), will make more sense. Values from configuration will not reflect carrier title changes done by Cush. I respect Magento own templates, especially adminhtml templates. Instead of overriding this template, I wrote some additional javascript in Cush module to correct carrier title. I stick to my green principle although it costs much more time developing.

    Upon installing Cush module, I removed all files of Customshippingrate module. A small accident happened – can not create shipment. It turns out during creating shipment, Magento is gathering all config paths start with “carriers/” and working out all carriers between two slashes. It is a bad logic, or I can call it a bug. It does not check whether this carrier exists or is active. So, very bad.

    Just add to my Magento caveats: after removing a shipping method, remove all entries of “carriers/CARRIER_CODE/*” in magento_core_config_data.

  • Godaddy 25% off promo code

    gdd5013g

    At GoDaddy, I can use gdd5013g for 25% off any order above $75.

    25% off godaddy orders
    25% off godaddy orders

    I just want to make a note here for myself instead of every time googling for a code.

    Let me know if you know a code for 30%, 35%, … off or even more. My orders are normally above $100 or I can put orders together to be qualified for higher discounts.

  • 欧陆制袋 = Euro Bags

    已经不止一次惊奇于 Google 的聪明了。

    今天无意中在 Google Translate 中输入申通快递,竟然翻出了 STO。

    然后我再想惊喜一下,输入欧陆制袋,很遗憾,没看到 Euro Bags,看到的是 Continental Bag。又试了一下逆向翻译,输入 Euro Bags,看到的是欧元袋。

    什么时候能让 Google 认识到 欧陆制袋 就是 Euro Bags 呢?

  • Magento datetime picker is not picking up time value

    Magento 用了 dynarch.com 的 calendar 1.0 javascript,有个 bug:无法得到 time 的值。

    dynarch.com calendar 已经是 2.0 了,单独使用的话,能显示和修改 time 的值。

    我暂时没想好该怎么办:我倾向于用 jQuery 去增强 Magento(prototype 我也用不好,其他的就更不要说了),但 jQuery 现下的版本只有 datepicker,官方还没有 datetimepicker。试过很多第三方 jQuery datetimepicker plugin,没觉得某一款有 jQuery 的神韵。