06月 6th, 2008 by ender
昨天遇到的bug,发现在复制某个结构时老是不对,调了大半天才发现是指针算术运算的问题:-(.
在指针可以和整数进行加减运算。具体见圣经K&R
如果p是一个指针,n为整数。 则p + n 表示 p 之后 n 个对象的地址。 在计算p+n时, n 将根据 p指向的对象的长度按比例缩放. 例如:
[code:c++]
int * p = &a ; //假设p的地址为0x61234f0, int 为4个字节
...
p+=1; // Now, p=0x61234f4 而不是0x61234f1
[/code]
原本想在操作内存区域用字节来操作,结果忘了将p强转为(char*) -__-|||,导致p作指针加法时,偏移量不对, 然后就是一堆莫名奇妙的错误~
Tags: Bug, C
Posted in Bug, Computer Science, Programming | No Comments »
04月 22nd, 2008 by ender
今天早上 收到的邮件,Google Summer Of Code的proposal总算是通过了^o^
内容是PostgreSQL hash索引的改进
http://code.google.com/soc/2008/postgres/about.html
虽然只是proposal 被接受,还是蛮高兴的。
第一天Mentor就发信过来了,建议我05.16前就能做好第一个patch,毕设的代码我也才刚准备写,看来有得忙了。
P.S.我的那台可怜的台式机不幸在前几天挂掉了,决心换笔记本了。虽然奖金还没拿到-_-|||
Fight for pgsql and $ !!!
Tags: Google Summer Of Code, GSoC, pgsql, postgresql
Posted in GSoC | 1 Comment »
04月 10th, 2008 by ender
有一台远程主机的话,就可以通过ssh作代理了 原理如下
/ foo.com
浏览器ssh server – bar.com
\ example.com
然后在本机运行
$ssh -fND 6666 username@remote.ssh.server
6666是本地端口号,这样在本机就可以将localhost:6666 设为socks5代理
参数的解释可以看这里
Windows下可以用putty的后台命令行程序plink
见车东[Blog^2] 的 http://www.chedong.com/blog/archives/001246.html
$plink -N username@remote.ssh.server -D 127.0.0.1:6666
其中 -N 表示不需要shell
username@remote.ssh.server 替换成 -load sessionname 也可以
如何在Windows下使用密钥方式登录Linux服务器
如果设置需要基于密钥的登录(如果不设置密钥密码,就可以自动登录了),目前成功的方法是:
先在服务器上用服务器上用./ssh-keygen生成密钥对,将公钥 id_rsa.pub >>部署到要登录到的服务器上:/home/username/.ssh/authorized_keys 中.
密钥在Windows客户端下使用:将密钥id_rsa下载到本地,然后用puttygen导入id_rsa 另存转换为putty格式的密钥id_rsa.ppk即可。然后使用
plink -i c:\path\to\id_rsa.ppk username@example.com
登录。
补充:
为避免每次输入密码,可已将生成公钥将其部署到服务器上
$sshgen
它会在本机$HOME/.ssh目录下生成
id_rsa id_rsa.keystore id_rsa.pub
这几个文件,将公钥id_rsa.pub加到远程主机example.com的$HOME/.ssh下的authorized_keys就可以了。
参考 http://rainux.javaeye.com/blog/235777
Tags: ssh, 代理
Posted in Linux | No Comments »
01月 17th, 2008 by ender
明天回家^o^。
接下来将是火车上28个小时的煎熬,嗯。
Posted in Life | No Comments »
01月 11th, 2008 by ender
2008-01-11 Skin Care: Don’t Let a Little Cut Fool You(2/2)
As the wound heals, inspect for signs infection including pain, redness and flood it fluid around. A high body temperature is also a sign of infection. If a wound seems infected, let the victim rest. Physical activities activity can spread the infection. If there are signs of infections, seek help from a doctor or other skilled medical provider.
For
a larger wound or in case bleeding does not stop quickly, use direct
pressure. Place a clean O of cloth on the area and hold it firmly in
the place until the bleeding stops or medical help arrives.
Direct pressure should calm down be kept on a wound for about 20 minutes. Do not remove the cloth until if the blood dropped drips through it. Instead, put another cloth on top and continue pressure.
Use more pressure if the bleeding has not stopped after 20 minutes.
Deep cuts usually need immediate attention from trained medical providers.
Doctors suggest get a tetanus vaccination every 10 years.
~ maybe required if a wound is deep or dirty.
To learn more about first aid, contact the hospital or local orgnization organization like Red Cross or Red Crescent society. There may be training program available offered in your area.
Words:
fluid n. 流体,液体
victim n. 受害人,牺牲者,牺牲品
drip vt.使滴下 n. 水滴
tetanus n.破伤风
vaccination n.接种疫苗,种痘
booster n.后推的人,支持者,后援者,调压器
Red Crescent n.红新月会(穆斯林国家中相当于红十字会的组织)
organization orgnization
pronounce pronunciation
Posted in VOA | No Comments »
01月 11th, 2008 by ender
2008-01-10 Skin Care: Don’t Let a Little Cut Fool You(1/2)
Even minor cuts can become infected if they’re left untreated. Any break in the skin can let bacteria into enter the body. And An increasing number of O skin infection are resistant to antibiotic medicines.
This infection These infections can spread throughout the body.
But taking good care of any injury that breaks the skin can help prevent an infection.
Many Medical experts say, the first step in treating a wound is using to use clean water. Lake or ocean water should not be used. To clean the area around the wound, experts suggest using a clean cloth and soap.
They say there’s no need to use products like hydrogen peroxide or iodine.
It is important to remove all dirt and other material from the wound.
After the wound is clean, use a small amount of antibiotic ointment or cream. Studies have shown these medical medicated products can aid in healing.
They also keep the surface of the wound from becoming dry. Finally, cover the cut with a clean band bandage while it heals. Change the bandage daily and keep the wound clean.
Words:
antibiotic n. 抗生素 a. 抗生的
bacteria n. 细菌
iodine n.碘,碘酒
hydrogen peroxide n.双氧水
ointment n.药膏,软膏
medicated adj.加有药的
Posted in VOA | No Comments »
01月 11th, 2008 by ender
2008-01-08 Will it be cats, cars, beautiful women in swimsuits or Elvis?(1/2)
The New Year is the time for new beginnings. It’s also the time to buy
a new calendar.Yet it can take a lot of time just to choose the right
one.There are lots and lots of choices.There are small ones, big ones,
calendars that sit on the desk, calendars that hang on the wall,
calendars that carry around, calendars that show a whole month or one
day at a time.
Of course, in one way, all calendars are the same. They all list the same days of the year in exactly the same order.
But
people do not buy calendars just know what day it is.Calendars have
become popular gifts because many are filled with beautiful pictures.
Some have pictures of famous art works, it is like hanging a
different painting on your wall each month. You can even learn from
calendars. They often give information about their subject such as
famous writers or American Indians or flower gardens.
There are calendars about food and about beautiful places in the
world, calendars about sports and about movies, funny calendars with
popular cartoon characters, calendar of famous people like Elvis
Presley (猫王) or Marilyn Monroe.
2008-01-09 Will it be cats, cars, beautiful women in swimsuits or Elvis?(2/2)
For pet lovers, there are calendars with pictures of cats doing unusual things.
Three hundred sixty-five of them ~ one for each day of the year.
Calendars of dogs wearing clothes. And calendars of beautiful women in swimming suits, not wearing much at all.
Would you rather look at pictures of cars? There are calendars with those, too. There are even calendars for children who can draw the pictures themselves.
Some people do not just look at their calendars. They use them to write down important things they must remember, like meetings or doctor’s appointments. These Busy people can buy small calendars to carry around to help them organize and plan their life.
But what if they forget to look at their calendar? Do not worry, there are electronic organizers that make sounds to remind people of things they must do. These days, if you forget something, it is getting harder and harder to find a good excuse. Some people do not like little calendars, or big ones, or noisy electronic ones. They are happy just to write down notes to themselves on small pieces of paper. The smaller the better, usually.
Posted in VOA | No Comments »
01月 9th, 2008 by ender
gvimdiff file1 file2 [file3 [file4]]
It’s so cool~
Posted in Linux | No Comments »
01月 7th, 2008 by ender
from http://blog.donews.com/airu/archive/2007/12/28/1240974.aspx
1.首先用命令free查看系统内 Swap 分区大小。
$free -m
引用
total used free shared buffers cached
Mem: 1002 964 38 0 21 410
-/+ buffers/cache: 532 470
Swap: 951 32 929
可以看到 Swap 只有951M,不符合 Oracle-xe-client 的安装要求。
2.创建一个 Swap 文件。
$mkdir swap
$cd swap
$sudo dd if=/dev/zero of=swapfile bs=1024 count=100000
出现下列提示,上面命令中的 count 即代表swap文件大小。
引用
记录了 100000+0 的读入
记录了 100000+0 的写出
102400000 字节 (102 MB) 已复制,0.74704 秒,137 MB/秒
把生成的文件转换成 Swap 文件
$sudo mkswap swapfile
引用
Setting up swapspace version 1, size = 102395 kB
no label, UUID=09fde987-5567-498a-a60b-477e302a988b
3.激活 Swap 文件。
$sudo swapon swapfile
再次查看 free -m 的结果。
引用
total used free shared buffers cached
Mem: 1002 967 34 0 22 410
-/+ buffers/cache: 534 467
Swap: 1053 32 1021
添加成功。
扩展:
如果需要卸载这个 swap 文件,可以进入建立的 swap 文件目录。执行下列命令。
$sudo swapoff swapfile
如果需要一直保持这个 swap ,可以把它写入 /etc/fstab 文件。
引用
swapfilepath swap swap defaults 0 0
Posted in Linux | No Comments »
01月 7th, 2008 by ender
补昨天的,这个语速好快啊,没怎么听懂。后来才知道原来是标准VOA,不是原来听的慢速VOA。
2008-01-06 Huckabee, Romney Lead Republican Presidential Pack in Iowa(1/2)
“I think it’s important to have somebody who knows something about change, whose who has lived in the private sector, who knows why jobs come and why they go, whose O work to who has traveled in the world and understands how can we beat compete with other nations.”
Former New York City Mayor Julie Anna Rudy Giuliani has not complain campaigned much in Iowa, even though he has led the Republican field in national ports polls for months.
Giuliani hopes to score some victories in primaries in late January and early February in larger states like Florida, Califorlia California and New York.
Among the Republican contenders in Iowa, there is also a struggle underway for third place between John McCain and former Senator Fred Thompson of Tennessee.
Senator McCain emphasis emphasizes his military background and his experience in former policies foreign policy issues.
“I have one guiding principle, one ambition that , and that is to keep America safe and to achieve and maintain our greatness.”
Thompson also argues that his background as a lawyer and senator makes him uniquely qualified to be a commander and in chief.
单词:
mayor [mɛə] n. 市长
poll [pəul] n. 民意测验
senator ['senətə] n. 参议员
contender n. 竞争者
private sector 私营部门
California Califorlia
February Feburary
who’s = who has
emphasize v.
emphasis n.
Posted in VOA | No Comments »