变态家族

新家是biantaishabi.com/blog

平日看新闻还有一些无聊的东西的时候,英文也就凑合了,但是这两天读专业上东西发现还是有不少英文的单词不认识.于是就想将这些不认识的英文词汇记下来,并且查查字典将解释也记下来,放在了桌面上的一个记事本里面,有空翻翻,就能记下来了.这样倒是很方便,在桌面上随时都可以打开,再配合一个不知道从那里下到的韦氏词典(似乎氏破解版),就可以学习这些不认识的词语了.只是有一个缺点,那就是这样的文本在记事本里面看起来很是不好看,我都是这样写的,一个单词,然后冒号,然后是词语的解释.单词多的时候看起来就会眼睛疼了.

看到格式还这么整齐,想到平时写blog的时候还经常用的li标记,就可以将一条一条很清楚的表示出来,如果可以做成这样的效果就好看了. 但是自己手写html也很麻烦,而且以前也写了不少生词了,于是写了个几行的perl小程序,将其自动的放到li标签中间,再生成一个html的文件.这样就好看多了.以下就是效果了,还不错吧.

  • avocation: customarty employment:VOCATION
    a subordinate occupation pursued in addition to one's vocation especially for enjoyment:HOBBY
  • tenure: the act, right, manner, or term of holding something (as a landed property, a position, or an office) especially, a status granted after a trial period to a teacher that gives protection from summary dismissal
    :GRASP,:HOLD
  • glitch: a usually minor malfunction: a glitch in a spacecraft's fuel cell:BUG
    a minor problem that causes a temporary setback:SNAG
    a false or spurious electronic signal
  • spurious: of illegitimate birth:BASTARD
    outwardly similar or corresponding to something without having its gnuine qualities:FALSE
    :FORGED or of a deceitful nature or quality
  • conjecture::SUPPOSITION
    inference from defective or presumptive evidence
    a conclusion deduced by surmise or guesswork
    a proposition before it has been proved or disproved
  • moat: a deep and wide trench around the rampart of a fortified place(as a castle) that is usually filled with water
  • rampart: a protective barrier:BULWARK
    a wall-like ridge
  • creed: a brief authoritative formula of religious belief
    a set of fundamental beliefs, also a guiding principle:CREDO
    creedal or credal

当然,以上的除了加入li标签以外还做了一些加颜色的处理.还把同义词都变成红色,前面一个冒号,并且大写的醒目格式还有粗体.都是用的自己觉得方便的标记,比如同义词,我就定义的是一个空格加上一个单引号,后面的词语就会变成这样的恶心的粉红色大写.如果是两个空格的话,就可以转成粗体. 呵呵,挺有意思.

这个故事告诉我们, 外表有时候还是很重要的.

两个小时后更新:后来想到到底是perl帮我学英文,还是英文帮我学perl呢?想到这应该其实这是一个和鸡生蛋还是蛋生鸡,男上女还是女上男一样博大精深的哲学问题,于是为了保护我的脑细胞,就没有想了.

继续ps:既然有极少数的观众qyt及其不大力的要求,那就把代码也帖出来吧.做了一个备份,bak还生成了一个扩展名是html的.你写的那些单词的文件名要是vab,或者你可以改一下$file的值,放到同一个目录底下run一下就可以了.

    $file=vab;    $old = $file;    $new = "$file.tmp.$$";    $bak = "$file.bak";    $html = "$file.html";    open(OLD, "< $old")         or die "can't open $old: $!";    open(NEW, "> $new")         or die "can't open $new: $!";    open(HTML, "> $html")         or die "can't open $html: $!";    # Format, preserving case    while (<OLD>) {        #get the list in html        s#(\w+):\s(.+)#<ul><li><font color="\#0000ff"><b>$1</b></font>: $2</li></ul>#;        #change \\ to a newline        s#\\\\#</br>#g;        #change the word after two space to bold font        s#\s\s(\w+)# <b>$1</b>#g;        #change the word after . to UPPERCASE and bold        s#\s'(\w+)#<font color="\#ff00ff"><b>:\U$1</b></font>#g;        #change the text between \p and \p into one para        s#\\p(.+)\\p#<p>$1</p>#;        #change the text between \q and \q into blockquote        s#\\q(.+)\\q#<p><blockquote>$1</blockquote></p>#;        #add link after ;        s#;(\w+)\.(.+)\s#<a href="http://www.$2/">$1</a>#;        (print NEW $_)          or die "can't write to $new: $!";        (print HTML $_)         or die "can't write to $html: $!";    }    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =                                                localtime(time);    $year += 1900;    close(OLD)                  or die "can't close $old: $!";    close(NEW)                  or die "can't close $new: $!";    close(HTML)                 or die "can't close $html: $!";    rename($old, $bak)          or die "can't rename $old to $bak: $!";    rename($new, $old)          or die "can't rename $new to $old: $!";    rename($html, $year.$mon.$mday.$html)                                or die "can't rename $html $!";




Trackback: http://tb.donews.net/TrackBack.aspx?PostId=1032360


[点击此处收藏本文]  发表于2005年11月29日 12:00 PM




正在读取评论……

news

这个blog停止更新了, 请去新家biantaishabi.com/blog

导航

blog stats

文章

收藏

相册

Cooooool!

My Lab

变态帮

存档


正在读取评论……