Cun Zhang’s Blog

October 16, 2008

你的名字会被记多久?

Filed under: Uncategorized — Cun Zhang @ 19:29

昨天在听经济之声安然主持的财富星空,听到的故事。
那个晚上的影片好像是南斯拉夫的《桥》。他正要走进电影院,一个青年拦住了他。
那个青年看上去很焦急,说:“这位大哥,售票处已经买不到票了,您能把手中的票卖给我吗?”他一愣,有些为难。他问:“你没有问过别人?”“问过许多人,他们都……”青年的脸色有些黯然,“要不是为了母亲,我也不会麻烦您的……”“你母亲?”“是的,我们从乡下来,我想领着母亲看一场电影。”
就因为青年的孝心,那天他毅然把票给了青年,没要一分钱。青年除了千恩万谢,还郑重地要了他的名字。
这是纷繁的生活中极为普通的一个场景。十多年了,他几乎都把这件事忘记了。有一天,他走在街上,有一个人轻轻地喊他的名字。他一看,站在他面前的是一个笑容满面的中年人。他极力在脑海中搜索着这个面孔,但脑海中一片空白。
中年人说:“大哥,您还记得十几年前您给我的那张电影票吗?那一年,我从乡下来,给母亲看病。母亲病得很重,我怕母亲不能活着从手术台上下来,就想领着母亲看一场电影。那天,多少人都拒绝了我。只有您,慷慨地把票给了我。您知道吗,我母亲手术后又活了一年。那一年里,每当她幸福地说到‘我在城里看过一场电影’这句话的时候,我就在心里用感激一遍一遍地默念着您的名字。是的,大哥,这么多年了,我一直忘不了……”
这是朋友的父亲在一次吃饭时给我们讲的一个故事。就在那次酒席上,他颇有感慨地说:“我就做了那么一点事,却让一个素昧平生的人记住了我的名字,而且一记就是这么多年。说真的,他喊出我名字那一刻,我还是觉出了一种无法言说的幸福。我是说,你们以后的路还很长,你能把自己的名字留在别人的脑海里多长时间呢?”
一语惊心。是啊,这个世界上,有许多人的名字已经被时光的风吹得无影无踪了,而另一些名字,因为爱——爱的付出与施与,却在风中成了不倒的丰碑。
在纸上盲目地追问人生的意义之前,你在心底里问过自己这样一个问题吗:
我的名字被谁记住了,他们会记多久?

October 3, 2008

foxyproxy custom path problem’s solution

Filed under: Uncategorized — Tags: , — Cun Zhang @ 21:12

Here is the solution from foxyproxy FAQ:

I moved my Firefox profile to another PC or another path. Now FoxyProxy doesn’t work. How to fix?

You must edit the profile’s preferences. In Firefox, type about:config in the address bar. Enter extensions.foxyproxy.settings as a filter. If the preference doesn’t exist, create it as a new string (open the context menu (right-click) on any existing preference, go to the New menu, and select String). Enter extensions.foxyproxy.settings for the preference name. For the value of the string, enter the location of foxyproxy.xml in the form: file:///c:/path/to/file/foxyproxy.xml. For example: file:///C:/Documents%20and%20Settings/
EricJung/ Application%20Data/Mozilla/Firefox/Profiles/
r0yrkjob.prod/foxyproxy.xml
. Note that the path must be URL-encoded (e.g., space becoems %20). You can use this URL encoding calculator to easily URL encode a path.

For Linux and Mac operating systems, exclude the drive letter; e.g. file:///home/ejung/foxyproxy.xml.

If you are using Portable Firefox, the value of extensions.foxyproxy.settings should be a single space (” “). This tells FoxyProxy to look for foxyproxy.xml in the profile directory of the current drive. This is important because the drive letter of a USB drive can change.

September 13, 2008

Auto-Sending Mail Under GNU/Linux

Filed under: Uncategorized — Tags: , — Cun Zhang @ 17:08

Recently I’m running a matlab program which may need several days. And I don’t hope to login remote host many times to see whether  it is done, which is  a bad thing for me.

I hope when it’s done  there will be a mail for me. A mail client is working on my PC all the time, so I can see it.

I asked google if there is a solution for my problem. And I found it in many pages with the same content. And I can’t find who is the author for it. So bad!

The Solution:

You should install mutt and msmtp, and configure them right, and add your auto-sending scipt(I written it by bash) to cron.

And Debian GNU/Linux, it’s so easy.

Install mutt and msmtp via apt-get command:

sudo apt-get install mutt msmtp

The following is my configuration(you need replace user and domain.com to your mail account and server):

cunzhang@node31:~$ cat .msmtprc

#user@domain.com
account usr@domain.com
host smtp.domain.com
from usr@domain.com
tls on
auth on
user usr@domain.com
password ****

cunzhang@node31:~$ cat .muttrc

set folder=”~/.mail”
set mbox=”~/.mail/inbox”
set mbox_type=maildir
set record=”~/.mail/sent”

set sendmail=”/usr/bin/msmtp -a usr@domain.com”
set realname=”cunzhang”
set use_from=yes
set editor=”vim”

Then test whether it works.Mine works fine.

I write a bash script to detect matlab’s process and send email to me when the process is gone. Add it to crontab which makes that script run 1 time  every2 hours.

 For more information, please see mutt, msmtp and crontab.

June 9, 2008

data save/load in Octave(From Octave’s Manual)

Filed under: Uncategorized — Tags: , , — Cun Zhang @ 16:58

 The save and load commands allow data to be written to and read from disk files in various formats. The default format of files written by the save command can be controlled using the functions default_save_options and save_precision.

As an example the following code creates a 3-by-3 matrix and saves it to the file `myfile.mat‘.

     A = [ 1:3; 4:6; 7:9 ];
     save myfile.mat A

Once one or more variables have been saved to a file, they can be read into memory using the load command.

     load myfile.mat
     A
          -| A =
          -|
          -|    1   2   3
          -|    4   5   6
          -|    7   8   9

— Command: save options file v1 v2

Save the named variables v1, v2, , in the file file. The special filename `-‘ can be used to write the output to your terminal. If no variable names are listed, Octave saves all the variables in the current scope. Valid options for the save command are listed in the following table. Options that modify the output format override the format specified by default_save_options.

If save is invoked using the functional form

          save ("-option1", ..., "file", "v1", ...)

then the options, file, and variable name arguments (v1, ) must be specified as character strings.

-ascii
Save a single matrix in a text file.
-binary
Save the data in Octave’s binary data format.
-float-binary
Save the data in Octave’s binary data format but only using single precision. You should use this format only if you know that all the values to be saved can be represented in single precision.
-V7
-v7
-7
-mat7-binary
Save the data in Matlab’s v7 binary data format.
-V6
-v6
-6
-mat
-mat-binary
Save the data in Matlab’s v6 binary data format.
-V4
-v4
-4
-mat4-binary
Save the data in the binary format written by Matlab version 4.
-hdf5
Save the data in HDF5 format. (HDF5 is a free, portable binary format developed by the National Center for Supercomputing Applications at the University of Illinois.)
-float-hdf5
Save the data in HDF5 format but only using single precision. You should use this format only if you know that all the values to be saved can be represented in single precision.
-zip
-z
Use the gzip algorithm to compress the file. This works equally on files that are compressed with gzip outside of octave, and gzip can equally be used to convert the files for backward compatibility.

The list of variables to save may include wildcard patterns containing the following special characters:

?
Match any single character.
*
Match zero or more characters.
[ list ]
Match the list of characters specified by list. If the first character is ! or ^, match all characters except those specified by list. For example, the pattern `[a-zA-Z]‘ will match all lower and upper case alphabetic characters.
-text
Save the data in Octave’s text data format.

Except when using the Matlab binary data file format, saving global variables also saves the global status of the variable, so that if it is restored at a later time using `load‘, it will be restored as a global variable.

The command

          save -binary data a b*

saves the variable `a‘ and all variables beginning with `b‘ to the file data in Octave’s binary format.

— Command: load options file v1 v2
Load the named variables v1, v2, , from the file file. As with save, you may specify a list of variables and load will only extract those variables with names that match. For example, to restore the variables saved in the file data, use the command

          load data

If load is invoked using the functional form

          load ("-option1", ..., "file", "v1", ...)

then the options, file, and variable name arguments (v1, ) must be specified as character strings.

If a variable that is not marked as global is loaded from a file when a global symbol with the same name already exists, it is loaded in the global symbol table. Also, if a variable is marked as global in a file and a local symbol exists, the local symbol is moved to the global symbol table and given the value from the file. Since it seems that both of these cases are likely to be the result of some sort of error, they will generate warnings.

If invoked with a single output argument, Octave returns data instead of inserting variables in the symbol table. If the data file contains only numbers (TAB- or space-delimited columns), a matrix of values is returned. Otherwise, load returns a structure with members corresponding to the names of the variables in the file.

The load command can read data stored in Octave’s text and binary formats, and Matlab’s binary format. It will automatically detect the type of file and do conversion from different floating point formats (currently only IEEE big and little endian, though other formats may added in the future).

Valid options for load are listed in the following table.

-force
The `-force‘ option is accepted but ignored for backward compatibility. Octave now overwrites variables currently in memory with the same name as those found in the file.
-ascii
Force Octave to assume the file contains columns of numbers in text format without any header or other information. Data in the file will be loaded as a single numeric matrix with the name of the variable derived from the name of the file.
-binary
Force Octave to assume the file is in Octave’s binary format.
-mat
-mat-binary
-6
-v6
-7
-v7
Force Octave to assume the file is in Matlab’s version 6 or 7 binary format.
-V4
-v4
-4
-mat4-binary
Force Octave to assume the file is in the binary format written by Matlab version 4.
-hdf5
Force Octave to assume the file is in HDF5 format. (HDF5 is a free, portable binary format developed by the National Center for Supercomputing Applications at the University of Illinois.) Note that Octave can read HDF5 files not created by itself, but may skip some datasets in formats that it cannot support.
-import
The `-import‘ is accepted but ignored for backward compatibility. Octave can now support multi-dimensional HDF data and automatically modifies variable names if they are invalid Octave identifiers.
-text
Force Octave to assume the file is in Octave’s text format.

 From: Octave’s Manual

May 27, 2008

最让人恼火的软件(转自奇客)

Filed under: Uncategorized — Cun Zhang @ 15:09

ZDNet UK的一篇文章列举了10种常见的,但常惹你生气的软件(打印版)。互联网送给你很多玩具,它重写了商业和娱乐的规则。但是你并非不会产生烦恼,实际上它们常常会弄巧成拙,令你痛苦不堪,甚至幻想没有互联网,它从来没有出现过。

 

Adobe Reader:我们只是用它看电子书,但它却像官僚机构一样臃肿,不间断的更新(还要求重启,这是什么道理?)。

Apple:它让微软看起来是个好人。
Windows Update:“立即重启”,“不要关闭电源,直至5项更新完成”,“你需要安装Microsoft Genuine Advantage”,“请在安装前关闭所有应用程序”。
RealPlayer:犯下的罪行罄竹难书,它嵌入的广告比报纸首页还多(其实和国内的许多软件相比,它已算是圣人了)。
Java:它是一种程序语言,但是不甘寂寞,总是想提醒你Sun有多好,并推销OpenOffice,还在你的浏览器上安装Yahoo Toolbar,天底下有这种语言吗?
Yahoo:它设法控制你的邮件、搜索引擎、主页,更别提该死的工具栏了。
Norton Antivirus:就像是你的桌面出现了撒旦。
预先捆绑的软件:一些公司总是想夹带私货,索尼就是其中的王者:悄悄的安装程序,并加入到系统启动项中,或者消耗巨大的资源。
Outlook/Exchange:当免费的web email飞速发展时,它还是不紧不慢,过好多年才更新一次。
Flash:自我感觉良好的播放器。

Older Posts »

Powered by WordPress