Xupeng's blog

圆外之大,心向往之

Tricks to use sub-domain name at hostmonster.com

I have a domain name(thinkingtracker.com) which is registered at godaddy.com, I think godaddy is one of the best domain name providers, because it’s price is relatively lower, and most important thing is that godaddy allow you to control your domain name in very detail mode, such as you can set your mx records, add/delete cname, add/delete a record, it’s very convince if you need flexibility as I need. My requirement:
  1. use my domain name(thinkingtracker.com) to setup google apps service.
  2. point one of my sub-domain to my company’s server, to serve my django powered blog.
  3. point one of my sub-domain to hostmonster.com, to test hostmonster’s service, then determine if I use it as my next virtual hosting provider.
My requirement is very simple, right? but unfortunately it is not that easy as I think at first. I first setup my google apps service, and then point one of my sub-domain name to our companny, these two steps work perfectly. but the last one make me very disappointed, there is no way to just point one sub-domain to hostmonster, the only way to use a new domain name is to add my domain name as an add-on domain name, which means that I should use hostmonster’s DNS server as my domain’s default DNS server, in that way, I cannot point any of my sub-domain to my company’s server. But I find there are tricks to satisfy my requirement:
  1. change my default DNS server to hostmonster.com’s ones, then add my domain name as an add-on domain name at hostmonster.com, now I can add as much sub-domain names as I want, but this sub-domain names can only be used at hostmonster.for example: I add cake.thinkingtracker.com and django.thinkingtracker.com
  2. change the default DNS server to godaddy’s ones, and add A records which point to hostmonster’s IP, for example: I add two A records:
    cake -> 1.1.1.1(hostmonster IP)
    django -> 1.1.1.1(hostmonster IP)
  3. add A records point to my company’s server.
ah, all works perfectly now, tastes great!

在postgresql中查看数据库/表占用的物理存储空间大小

因为需要使用物理硬盘,而普通用户是没有权的,google的搜索结果中有人有说更改sshd的配置,使之允许root登录就可以,这个方法看来不可行,因为我的ssh原本就是允许root登录的。

查看vmware配置文件所在目录,发现有文件/etc/vmware/vmwaregroup,尝试在其中加入新的一行:wheel,然后重新启动vmware服务就可以了。

回忆百度招聘

2006年9月27日,我向百度“搜索新产品运维工程师”一职投递了简历,杳无音讯,直到5月21号,我收到一条短信告诉我我的背景符合该职位的要求,让我于22日11:00参加在线笔试,当时有一些事情我正在回家的路上,并不方便上网,不过我尽快办完了事情后在第二天11点之前赶回了学校,参加这场迟到的笔试。

笔试共10题,前7题为技术相关,后3题大概是要考察综合能力,应该说题目难度都不大,但在一个小时内答好也不容易,紧紧张张地答完题在最后一分钟把答案提交了上去,也没有来得及审查。百度处理笔试结果速度挺快的,第二天下午3点多就收到了告知我通过笔试的邮件,并说会安排时间与我面谈。

第一次电话面试,百度的工程师依照我的简历对我进行了一些提问,诸如 Apache 启动时创建了一个文件,文件的内容是什么,有什么作用,Apache 的 Listen 指令是否可指定多个端口,MySQL 的两大存储引擎的特点等等,以及 RAID 相关的东西,并根据我的回答问了一些相关的或更深入的问题。这次电话面试让我感触很深,让我认识到我对知识的学习还是有些肤浅,尽管他问的这些问题在需要时我都可以很快地找到答案和解决方案,但回答时的些许不顺畅的确让我的自信心受到了一些打击。学技术,切忌肤浅,这是这次面试给我的教训。

接到第二次电话面试的电话的确让我有点惊讶,因为我正在为我在第一次技术面试时的表现感到有些懊恼,这些懊恼由我的浮噪而生。这次的面世官没怎么问技术问题,问了一下我使用 Linux 的经历以及我毕业设计的内容,随后介绍了一下搜索新产品运维工程师这个职位的主要职责,问我是否有兴趣,看什么时间可以安排到北京进行最后一次面试。再后来百度的工程师又打了两次电话,可惜我没有接到,感到抱歉,随后收到了邮件,询问我面试的时间。

我最终选择了放弃最后的面试,是的,我非常喜欢运维类的工作,5年来我想的最多的大概也就是这些事情,这是我最主要的兴趣所在。不过现在的工作也很好,工作起来很舒服,还有一堆可爱的同事:)更为重要的是,我女朋友希望我留在这里,因为,这里给了我第一次机会,我也这么想。

感谢百度的工程师,使我在这个过程中我领悟到了一些东西,为我给他们带来的不便感到抱歉。百度的招聘流程和我们挺像的,就连电话面试都很像。我觉得百度这种形式的在线笔试挺好,合理地应用可以提高招聘效率,也可以考察应试人在压力下的工作效率与质量。我们也可以使用这样的方法,不过我们最好是先和候选人约定好笔试开始时间,不然可能会错过一些合适的人选。

vmware崩溃了,浅谈几种虚拟机的使用感受

Vmware workstation又崩溃了,似乎在我这里很容易崩溃,但我不知道到底在怎样的情况下能够重现,虽然在我这里已经出现了两次了。 跟升级有关?上一次崩溃是因为vmware workstation有了新版本,随手emerge -u给升级了,结果升级以后就不能用了:
aiyi@devr bin $ vmware
process 1694: Attempt to remove filter function 0xb6b74956 user data 0×87ff3a0, but no such filter has been added
  D-Bus not built with -rdynamic so unable to print a backtrace
process 1705: Attempt to remove filter function 0xb6f81956 user data 0×88018a0, but no such filter has been added
  D-Bus not built with -rdynamic so unable to print a backtrace
Vmware player也是一样,再降回老版本也不成,卸载,删除系统中所有与vmware相关的的文件包括没有卸载干净的文件、配置文件、内核模块等等,这下再安 装总该行了吧?结果还是没戏…… 但又不能没有vmware,因为我所用的河南网通当时没有linux下的pppoe客户端(现在也没有,不过也不需要了),又使用了非标准的认证(我当时 这么认为,现在被证明是错误的),只能用vmware的bridge模式在虚拟的windows拨号再共享给我的gentoo。非常无奈之下只得重新安装 了一份gentoo,代价之大令我不堪回首。 这次又崩溃了,是前些时在公司里为了尝试新的vmware workstation 6.0,结果新的没用上旧的反倒牺牲了,跟上次一模一样的问题,依然没有解决办法,google也有没用的时候啊,hiahia。算了,尝试其他的虚拟技 术吧,现在的虚拟技术这么多,不一定非要用vmware吧,因为我现在不需要虚拟的windows来拨号上网了。 先用kvm,以前用过qemu+kqemu,跑windows 2003非常的快,而xp或者2k就逊色多了,这次使用kvm,结果让我很失望,跑xp的速度还不及qemu+kqemu(主观感觉而已),并且只能使用 标准的分辨率,1280×800的宽屏就很无奈了,全屏太丑,窗口模式800×600太小,1024×768又会有一部分看不到,有点鸡肋的感觉,换吧。 再试virtualbox,这个东西速度真不错,kvm还需努力啊。在guest机里装上 additions也可以适应宽屏,其实任意分辨率都没有问题,你要是高兴,可以用1000×100?呵呵。不过它也有它的缺点,用usb设备太麻烦,网 络也不容易使用,欠灵活性,还有就是guest和host的Ctrl+Space是有冲突的,全屏也不行,不得不让我使用其他的方法来启动或关闭 guest里的输入法,十分别扭。时不时的还会出现一些古怪的问题,比如guest里键盘不能输入,分辨率不能自适应,但是重启一下可能就又好了。不过总 体上来说vrtualbox是一款很不错的软件,速度很好,起码给用户的速度感受很好,内置的RDP支持也很方便。 还是不太如意,试试vmware server?先装一个vmware server console看,ok,这个居然可以起来,那就来一个vmwae server吧,太好了,居然起来了,没有vmware workstation在我这里给我的崩溃感,就是它了,呵呵。虽说vmware server是免费版的,但是1.0.3还是需要serial number的,到 http://register.vmware.com/content/registration.html 注册一个就可以了。 PS:qemu、kvm、virtualbox都是分给多少内存就全拿去,而不是如vmware一样用多少拿多少,很奇怪他们这样做我还是没有比使用vmware时更好的速度体验呢?

用于查找包含某个关键字的命令的脚本

用于查找包含某个关键字的命令的脚本,时不时用一用可能会有意想不到的收获,找到你非常想用但是你不知道的命令哦:)
#!/usr/bin/python

import os
import sys
import glob

def color_keyword(str, keyword):
    has_output = True
    try:
        from output import red
    except:
        has_output = False
    colored_str = ''
    partials = str.split(keyword)
    for partial in partials[:-1]:
        colored_str += partial + (has_output and red(keyword) or keyword)
    colored_str += partials[-1]

    return colored_str

def main():
    if len(sys.argv) < 2:
        print 'Usage: %s keyword' % sys.argv[0]
        sys.exit(1)

    keyword = sys.argv[1]

    paths = os.environ['PATH'].split(':')
    cmds = []
    for path in paths:
        if path.startswith('~'):
            path = os.path.expanduser(path)
        if not path.endswith('/'):
            path += '/'
        cmds.extend(glob.glob(path + '*'))
    for cmd in cmds:
        dirname, filename = cmd.rsplit('/', 1)
        if keyword in filename:
            print '/'.join([dirname, color_keyword(filename, keyword)])

if __name__ == '__main__':
    main()