Archive

Archive for the ‘Article’ Category

How to look up strange words in Terminal

February 18th, 2010 Huangam 3 comments

The following python script which is aiming for translating English words to Chinese runs perfectly on Mac Terminal:
Comments: This version requires that the data(String) has a integral xml structure.

#! /usr/bin/python
import re,urllib,sys
import xml.dom.minidom
from xml.dom.minidom import Node
url=”http://dict-co.iciba.com/api/dictionary.php?w=”
if len( sys.argv ) > 1:
  url +=sys.argv[1]
else :
  print “please input your searching word…”
  sys.exit(1)

file=urllib.urlopen( url )
content = file.read()
file.close()
doc = xml.dom.minidom.parseString( content )
acceptation=”"
for node in doc.getElementsByTagName(“acceptation”):
 for node1 in node.childNodes:
   if node1.nodeType == Node.TEXT_NODE:
    acceptation += node1.data+”\n”

print re.sub( ‘\\n$’,”, acceptation )

This version is more robust and fast:

#! /usr/bin/python
import urllib,sys
url=”http://dict-co.iciba.com/api/dictionary.php?w=”
if len( sys.argv ) > 1:
  url +=sys.argv[1]
else :
  print “please input your searching word…”
  sys.exit(1)
file=urllib.urlopen( url )
content = file.read()
file.close()
acceptation=”"
arr=()
content=content.partition(“<acceptation>”)[2]
while content :
  arr = content.partition(“</acceptation>”)
  acceptation +=arr[0] + “\n”
  content = arr[2].partition(“<acceptation>”)[2]

print acceptation.rstrip(‘\n’)

How to use it:
Requirements: Unix based system, Python installed, Internet connected
the file is named “dict” and given the permission 755.
when starting terminal, I always run the command alias dict=your path/dict
then you can test: dict Hello, the result will be 喂, 哈罗.

Tags: ,

本命年运程

February 15th, 2010 Huangam No comments

属虎人士的2010年运程
(来自 http://www.nongli.com/item1/2010/3.htm 或 http://www.ydjk.net/?article-2.html)
出生年:1938、1950、1962、1974、1986、1998、2010
整体运势:
断曰:船到江心浪拍天,羡君飞渡得平安
属虎人逢虎年,其年黑虎当道,多凶少吉,伤财神散,浮沉不定,临事不如意,心烦苦恼。今年虎人犯太岁、又有地煞等凶星,运气好比雪上加霜、热汤浇雪,无论做何事,都会出现很多的阻滞,还会惹来是非口舌。最好尽早向太岁祈福,虎人今年头脑比较混沌,吸收能力大减,只有加倍努力,才能保持成绩。
农历网提示:「值太岁」之年,是年变化较大较多,而这等变动并不一定为凶的,在灵活变化中,凭其努力奋博下,也会有事业及钱财之得益。但只要值太岁者不急不贪,多行正道,不作损人利己之事,及不要被值太岁一词影响心理,稳扎稳打,凡事三思后行,不怕辛劳,自强不息,当能转祸为吉。 Read more…

Tags: ,

老同学问候有感

January 8th, 2010 Huangam No comments

天冷地寒, 雪下无期
思乡念家, 归期不定

Tags:

窗前的月亮

December 6th, 2009 Huangam No comments

此该正值美国东部时间晚上1:40, 睡意全无, 抬头就能透过窗户望到让人类探索了几千年的月亮, 突然想把有关月亮的诗句摘抄一下:
首先映入脑海的是唐朝诗仙李白的《静夜思》:
床前明月光,疑是地上霜。举头望明月,低头思故乡。
想了想还有海上生明月, 天涯共此时. 谷歌了下, 全诗如下
《望月怀远》
作者:张九龄
海上生明月,天涯共此时。
情人怨遥夜,竟夕起相思。
灭烛怜光满,披衣觉露滋。
不堪盈手赠,还寝梦佳期。
再想, 还有什么呢, 对了, 还是李白的举杯邀明月,对影成三人. Read more…

Tags:

小沈阳

March 18th, 2009 Huangam 1 comment

[转自百度百科]
人生格言:走别人的路,让别人无路可走;穿别人的鞋,让他找去吧

  座右铭:
  不要只想要,付出不能少。 不要急着要,一定要戒躁。
  不要求回报,该到自然到。 不要急得到,心静便无恼。
  说话要想好,办事要公道。 说到要做到,不要瞎编造。
  做人要地道,才能步步高。 走就走正道,好人有好报。
  

Tags: ,

WebMSN 和 WebQQ

March 1st, 2009 Huangam 1 comment

上星期把机票买好了, 其中WebMSN和Fireinput发挥了不可估量的作用.
何谓WebMSN呢, 就是只要有浏览器就可以上MSN, 同理WebQQ也是这样的, 只有有浏览器就可以上QQ.
在浏览器中输入 http://webmessenger.msn.com/ 就可以上MSN了, 不过要允许浏览器能够弹出窗口.
在浏览器中输入 http://webqq.qq.com 这个更加高级, 不用弹出窗口, 一个页面就完了, 比MSN好多了

顺便说一下, 在英文版的操作系统中, 想输入中文怎么办呢, 呵呵, 也只要有浏览器就够了, 不过这里只能使用Firefox浏览器(其他浏览器还不知道有没有相应的插件), 在Google.com中搜索fireinput, 点击第一结果就是了, 或者点击 这里, 安装这个插件, 重启firefox就可以用中文输入了. Ctrl + F12 开启/关闭 中文输入, 这个还挺好用的.

Tags: , , ,

Love

February 22nd, 2009 Huangam 1 comment

第一最好不相见,如此便可不相恋。
第二最好不相知,如此便可不相思。
第三最好不相伴,如此便可不相欠。
第四最好不相惜,如此便可不相忆。
第五最好不相爱,如此便可不相弃。
第六最好不相对,如此便可不相会。
第七最好不相误,如此便可不相负。
第八最好不相许,如此便可不相续。
第九最好不相依,如此便可不相偎。
第十最好不相遇,如此便可不相聚。
但曾相见便相知,相见何如不见时。
安得与君相诀绝,免教生死作相思。

Tags:

讽刺

February 18th, 2009 Huangam 1 comment

奶协:特仑苏里有三聚氰胺吗?
蒙牛:没有!
奶协:有致癌物质吗?
蒙牛:没有!
奶协:有营养吗?
蒙牛:没有!
奶协:这个可以有!
蒙牛:这个真没有!!!

Tags: