只不过换了一个脑袋,居然不认我了...
你的资料完整度只有70%。
大家都能看出这个是我吧 ;)
大家新年快乐!
2008年注定不平凡,2009呢,也一定不平凡。
未知的精彩,不是么?
Adblock屏蔽校内广告
Posted by
sKh
at
11:26 AM
|
昨晚上校内的时候惊奇的发现好多广告,在使用adblock并订阅了若干列表之后这是一件很不可思议的事情。google到这篇文章,试验了一下,相当有效。从此和xiaonei广告say 88了。
新加的Rules:
新加的Rules:
http://gg.xiaonei.com/*xiaonei.com#div(ad-bar)xiaonei.com#div(beta-bar)xiaonei.com#div(blank-holder)xiaonei.com#div(class*=selected)xiaonei.com#div(zidou_music)
小游Cornell
Posted by
sKh
at
12:56 AM
|
今天天气不错,微雪但是有太阳,于是驱车去康奈儿大学(Cornell University)。当然,驱车的不是我,是XY同学。尽管拿了XY同学的车熟悉了一段时间,但离马路杀手还是有点距离。杀手嘛,得保的住自己性命啊。回主题,一路上风景不错,可谓体验了一把美国式的山村小道。途经finger lakers,下去拍了几张小照,湖边好大的风。又经一酒庄,买了几瓶小酒带回来。驱车俩小时,终于到了Ithaca。Ithaca真不大,我们就直奔Cornell。
Cornell校园不小,似乎还分东西南北中五个校区,风景也是不错的,比起我那小小的学校那可是漂亮多了。我们就一路违章停车一路欣赏风景,只可惜是冬天,基本只剩下枯枝了。令人惊奇的是学校里有一瀑布,还非常壮观,一会儿上图便知。
回城之前在Ithaca吃了顿buffet,又一次论证了Pittsburgh不适合居住的命题。
流水帐完毕,上图。
Cornell校园不小,似乎还分东西南北中五个校区,风景也是不错的,比起我那小小的学校那可是漂亮多了。我们就一路违章停车一路欣赏风景,只可惜是冬天,基本只剩下枯枝了。令人惊奇的是学校里有一瀑布,还非常壮观,一会儿上图便知。
回城之前在Ithaca吃了顿buffet,又一次论证了Pittsburgh不适合居住的命题。
流水帐完毕,上图。
The Elements of Programming Style
抽空读完了传说中经典图书之一的。虽然书是以Fortran和PL/I作为主体语言的,但大多数内容却一点都不过时。书中的大纲如下:
Introduction
Introduction
- Write clearly - don't be too clever.
- Say what you mean, simply and directly.
- Use library functions.
- Avoid temporary variables.
- Write clearly - don't sacrifice clarity for 'efficiency.'
- Let the machine do the dirty work.
- Replace repetitive expressions by calls to a common function.
- Parenthesize to avoid ambiguity.
- Choose variable names that won't be confused.
- Avoid the Fortran arithmetic IF.
- Avoid unnecessary branches.
- Use the good features of a language; avoid the bad ones.
- Don't use conditional branches as a substitute for a logical expression.
- Use the 'telephone test' for readability.
- Use DO-END and indenting to delimit groups of statements.
- Use IF-ELSE to emphasize that only one of two actions is to be performed.
- Use DO and DO-WHILE to emphasize the presence of loops.
- Make your programs read from top to bottom.
- Use IF, ELSE IF, ELSE IF, ELSE to implement multi-way branches.
- Use the fundamental control flow constructs.
- Write first in an easy-to-understand pseudo-language; then translate into whatever language you have to use.
- Avoid THEN-IF and null ELSE.
- Avoid ELSE GOTO and ELSE RETURN.
- Follow each decision as closely as possible with its associated action.
- Use data arrays to avoid repetitive control sequences.
- Choose a data representation that makes the program simple.
- Don't stop with your first draft.
- Modularize. Use subroutines.
- Make the coupling between modules visible.
- Each module should do one thing well.
- Make sure every module hides something.
- Let the data structure the program.
- Don't patch bad code - rewrite it.
- Write and test a big program in small pieces.
- Use recursive procedures for recursively-defined data structures.
- Test input for validity and plausibility.
- Make sure input cannot violate the limits of the program.
- Terminate input by end-of-file or marker, not by count.
- Identify bad input; recover if possible.
- Treat end of file conditions in a uniform manner.
- Make input easy to prepare and output self-explanatory.
- Use uniform input formats.
- Make input easy to proofread.
- Use free-form input when possible.
- Use self-identifying input. Allow defaults. Echo both on output.
- Localize input and output in subroutines.
- Make sure all variables are initialized before use.
- Don't stop at one bug.
- Use debugging compilers.
- Initialize constants with DATA statements or INITIAL attributes; initialize variables with executable code.
- Watch out for off-by-one errors.
- Take care to branch the right way on equality.
- Avoid multiple exits from loops.
- Make sure your code 'does nothing' gracefully.
- Test programs at their boundary values.
- Program defensively.
- 10.0 times 0.1 is hardly ever 1.0.
- Don't compare floating point numbers just for equality.
- Make it right before you make it faster.
- Keep it right when you make it faster.
- Make it clear before you make it faster.
- Don't sacrifice clarity for small gains in 'efficiency.'
- Let your compiler do the simple optimizations.
- Don't strain to re-use code; reorganize instead.
- Make sure special cases are truly special.
- Keep it simple to make it faster.
- Don't diddle code to make it faster - find a better algorithm.
- Instrument your programs. Measure before making 'efficiency' changes.
- Make sure comments and code agree.
- Don't just echo the code with comments - make every comment count.
- Don't comment bad code - rewrite it.
- Use variable names that mean something.
- Use statement labels that mean something.
- Format a program to help the reader understand it.
- Indent to show the logical structure of a program.
- Document your data layouts.
- Don't over-comment.
Install Brother HL-2140 on Arch Linux
I bought Brother HL-2140 laser printer months ago and that time it was automatically configured in Ubuntu Hardy. Since I replaced my system with Archlinux, I had to reinstall the driver. Today I tried to install the driver, following the article "Brother HL-2040" on archwiki.
The instructions are almost the same, as well as the drivers. I tried the official 2.0.2-1 driver which is for HL-2140, however, not working. Instead, the driver for HL-2040, which version is 2.0.1-1 works fine for me.
Here is the instructions.
The instructions are almost the same, as well as the drivers. I tried the official 2.0.2-1 driver which is for HL-2140, however, not working. Instead, the driver for HL-2040, which version is 2.0.1-1 works fine for me.
Here is the instructions.
- install cups first
> pacman -S cups
> pacman -S lib32-libcups (if you're using x86-64) - downlaod the rpm packages of lpr driver and the cups wrapper
- extract rpm files
> rpmextract.sh brhl2040lpr-2.0.1-1.i386.rpm
if u do not have rpmextract,
> rpmextract.sh cupswrapperHL2040-2.0.1-1.i386.rpm> pacman -S rpmextract
- replace all instances of /etc/init.d/ with /etc/rc.d/ in ./usr/local/Brother/cupswrapper/cupswrapperHL2040-2.0.1
- replace all instances of /etc/printcap.local with /etc/printcap in ./usr/local/Brother/inf/setupPrintcap
- copy ./usr/ and ./var/ (these are extracted from rpm files and already modified in step #4,5) to /usr/ and /var/ respectively
- run the script to complete installation, it would aumatically restart cups server
> /usr/local/Brother/cupswrapper/cupswrapperHL2040-2.0.1
- finally, u can go to cups server http://localhost:631/ to have a test page as u like.
今天被科普了一下下
Posted by
sKh
at
12:39 PM
|
从水母上“万有引力是怎么产生的”一帖中,我发现我几乎就是不懂物理的人了。苹果为什么会落下来?高中的物理解答了,因为万有引力。为什么有万有引力?大学物理解答了,因为时空弯曲。为什么时空会弯曲呢?
好了,这个时候,众说纷纭了。但无外乎,就两种:要么如宗教信仰者说,是上帝创造的;要么就如人择原理告诉我们的,它就是这样的,不然就没有我们。然而,终究,没能解决本质问题,“为什么”。这个时候,也许哲学家们可以告诉我们答案。
关于“人择原理(Anthropic principle)”,可以看维基百科的页面,很白话的一种解释
好了,这个时候,众说纷纭了。但无外乎,就两种:要么如宗教信仰者说,是上帝创造的;要么就如人择原理告诉我们的,它就是这样的,不然就没有我们。然而,终究,没能解决本质问题,“为什么”。这个时候,也许哲学家们可以告诉我们答案。
关于“人择原理(Anthropic principle)”,可以看维基百科的页面,很白话的一种解释
问:为何宇宙是我们看到的这种样子?一方面,这个解释近乎于无懈可击,另一方面,这个原理就是一个废话。当我们无法解释的时候,于是我们就说“它一定是这样的”。另外,人择原理也承认了宇宙中人类的参与。
答:如果它不是这个样子,我们就不会在这里.
Although our situation is not necessarily central, it is inevitably privileged to some extent.--- Brandon Carter 1973
?? in usb device
Issue: The file/directory names in file system are ?? when auto-mounted using HAL. [Archlinux/Gnome]
Solution:
Solution:
- open gconf-editor
- system > storage > default_options > vfat
- append "iocharset=utf8" to the value of "mount_options"
彩色man
Posted by
sKh
at
8:42 PM
|
今天新学一招,彩色man,让man变得多彩起来。说出来其实很简单,在~/.bashrc里增加一下内容

ref: http://plog.longwin.com.tw/ost/1/409
# For colourful man pages (CLUG-Wiki style)就这么简单,效果如下图:
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'

ref: http://plog.longwin.com.tw/ost/1/409
Subscribe to:
Posts (Atom)