Tuesday, August 5, 2008

原来RFC规定url是不准带下划线的。

今天想在tencent的网站下载一个foxmail,发觉打开连接失败,提示如下:

ERROR

The requested URL could not be retrieved


While trying to retrieve the URL: http://dl_dir.qq.com/foxmail/foxmail65beta02.exe

The following error was encountered:

  • Invalid URL

Some aspect of the requested URL is incorrect. Possible problems:

  • Missing or incorrect access protocol (should be `http://'' or similar)
  • Missing hostname
  • Illegal double-escape in the URL-Path
  • Illegal character in hostname; underscores are not allowed

Your cache administrator is sysadm@cse.cuhk.edu.hk.


Generated Tue, 05 Aug 2008 14:17:54 GMT by pluto.cse.cuhk.edu.hk (squid/2.5.STABLE12)

仔细看,似乎是因为underscore的问题。

网上搜得出了这个答案:

出错的原因是你提到的这个域名有一个不称职的管理员。

RFC 1034中明确指出:

代码:

The following syntax will result in fewer problems with many applications that use domain names (e.g., mail, TELNET).

<domain> ::= <subdomain> | " "

<subdomain> ::= <label> | <subdomain> "." <label>

<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]

<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>

<let-dig-hyp> ::= <let-dig> | "-"

<let-dig> ::= <letter> | <digit>

<letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case

<digit> ::= any one of the ten digits 0 through 9


下划线有保留意义,不能随意使用。

引自:http://www.freebsdchina.org/forum/viewtopic.php?=&p=188440
据说是squid的问题。

Monday, August 4, 2008

关于sudo的一个必须注意的point

今天在往一个只有600权限的文件中写入内容时发现了一点小问题:

iveney@iveney-laptop:~$ ll /var/run/xl2tpd/l2tp-control
prw------- 1 root root 0 2008-08-04 11:21 /var/run/xl2tpd/l2tp-control

iveney@iveney-laptop:~$ sudo echo "d ResNet" > /var/run/xl2tpd/l2tp-control
bash: /var/run/xl2tpd/l2tp-control: Permission denied

非常奇怪,为什么用了sudo还是permission denied了呢?难道一定要先chmod后再echo?
岂不是非常不符合逻辑?

后来查阅了一下发现原来是这样的:
echo,ls等是bash的built-in命令,echo时实际是shell自己往文件里头写东西,而我是以普通用户身份运行的shell。

因此只要在命令前再加上生成一个子shell的命令即可。

sudo sh -c 'echo "c ResNet" > /var/run/xl2tpd/l2tp-control'


Sunday, August 3, 2008

对CUHK网络的初步认识

CUHK的网络历史很悠久,由学校的ITSC部门负责,主页上(itsc.cuhk.edu.hk)有详细介绍。
是香港最早联通互联网的实体,后来还建立了HK唯一的一个internet exchange中心:HKIX。

现在CUHK的网络处于改进迁移之中,特别是无线网络方面最近似乎有许多大的工程要动。
比如ITSC主页说要在2009年开放802.11n,然而事实上我认为与其考虑incorporate新技术,
不如先解决校园无线网覆盖范围小的问题(相比HKUST的全覆盖,CUHK只有可怜的一点,
宿舍和公路都没有,不过也跟CUHK的地理范围大有关)

另外在不同地区接入需要不同的设置和方法,略显呆板(用户不友好)
比如要访问CUHK的内网则必须分为以下几类:
1) ResNet,Residence Net,即宿舍网络。据观察IP地址范围是10.0.192/18,CUHK的研宿有6座,
UG学生宿舍也有近10座。
2) ClassNet,据介绍,原理是跟ResNet一样的,还没尝试过。
3) CUHKNet,用于从外网访问(VPN)使用。
4)教学楼的网络,这个还没仔细看过是怎么样的架构。
5)无线网络,这个比较乱,因为以前好像是分为几个不同的部分接入的,现在全部统一成一个ssid了,
但是连接后也必须建立VPN链接才能接入Internet。

附:一点补充
据观察
宿舍网段是10.0.192.0/18
公网IP地址范围是137.189.0.0/16
在宿舍上网后能拿到两个dns地址
然后必须通过pptp或者l2tp+ipsec登录到学校网络
dns刷新为新的两个
分配到一个137.189.x.x的IP地址
并且校内的dns自动添加分配的IP
比如现在的IP是137.189.244.7
显示为h244007.xxx.xxx.xxx

不过始终不是很懂为什么要用VPN来建立连接
是为了分配一个公网IP吗?

Solution : Google Reader的“合烧功能”

稍微搜索了一下,发觉Google Reader本来就有"合烧"的功能。
之所以加上双引号,是因为google reader本来没有标榜自己提供这个服务。
然而强大的greader提供了文件夹功能,每个folder的属性设置为public后,拥有一个public page,只需要把feed移入文件夹即可达到合烧的效果。
我的合烧地址在这里:
http://www.google.com/reader/shared/user/00212757343177934295/label/BurnTogether

有兴趣的朋友可以浏览此页面,也可以把它添加进您的rss reader。
to be done:
The link is a little bit long.
Gonna seek if there is url redirection provided in CUHK's ihome.

Saturday, August 2, 2008

有一个想法:feed合烧

一直以为我的blog是私人日记。
这两天才发觉其实我的blog还是一两个人看的。
一般我是通过email群发到blogger和windows live space。
然而有时也想从google reader分享一些好的文章给朋友看
(虽然blog几乎没人看,但是还是希望看到的人能与自己一起分享好文章 ^_^ )
greader自动生成一个页面,提供我的share与note item
然而我还想把自己blog的内容也放到上面,最后再加上delicious的tag
也就是说,这个feed拥有四个内容:
1.my personal blog
2.my delicious tag
3.my google reader share items
4.my google reader noted items

而以上四个东东的Service Provider都是能提供feed输入的。
因此有必要弄一个feed合烧,呵呵。

另外还有一个小小的idea,搜索了下发觉还没人做过,因此先不公布,看什么时间有空做一下。