Alas! Four-oh-four
看BeautifulSoup的一个faq时遇到了一个很有个性的404页面 http://www.crummy.com/software/BeautifulSoup/FAQ.html 内容: A browsing Victorian chap Encountered a server mishap. The page was no more: “Alas! Four-oh-four!” Enough with this limerick crap.
看BeautifulSoup的一个faq时遇到了一个很有个性的404页面 http://www.crummy.com/software/BeautifulSoup/FAQ.html 内容: A browsing Victorian chap Encountered a server mishap. The page was no more: “Alas! Four-oh-four!” Enough with this limerick crap.
python的unicode问题实在是让人痛苦,本身要写一段小程序,时间都被浪费在处理unicode上面了。 我的python版本 python -c 'import sys;print sys.version' 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1] import os,sys from BeautifulSoup import BeautifulSoup, SoupStrainer def get_info(cont): print type(cont) soup = BeautifulSoup(cont) a = soup.findAll('a') print type(a) print(a) if __name__ == "__main__": s = sys.stdin.read() s = unicode(s, 'utf-8') get_info(s) 出错信息: 505 ~/script/notsobad/python/tool>cat /tmp/book_2742/index.html | ./book_res.py Traceback (most recent call last): File "./book_res.py", line 28, in get_info(s) File "./book_res.py", line 20, in get_info print(a) UnicodeEncodeError: 'ascii' codec can't encode characters in position 79-82: ordinal not in range(128) type(a) 是unicode,但是print a却报错。 最后在python的mail list里找到了篇 http://mail.python.org/pipermail/tutor/2005-August/040991.html http://mail.python.org/pipermail/tutor/2005-August/040993.html ...
Javascript中的保留字,变量函数名不要使用这些字符。 IE JScript Reserved Words Firefox Reserved Words 注意IE中的“Protected Reserved Words”,在脚本加载时就会报错。
通常情况下curl被用来访问远程链接,并取回数据。但是curl支持很多协议。下面是一段php手册中关于curl的描述: PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP’s ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication. ...
带有机房的厕所,哈哈 上机房要先从女厕所通过 <http://thedailywtf.com/Articles/The-Stalled-Server- Room.aspx> 有人回复道: I always knew womens restrooms were nicer than what we guys got. Now I see they have server rooms in there too?!?!
摘自:《软件随想录》 Joel针对计算机专业学生的7条免费建议: (1) 毕业前练好写作。 (2) 毕业前学好C语言。 (3) 毕业前学好微观经济学。 (4) 不要因为枯燥就不选修非计算机专业的课程。 (5) 选修有大量编程实践的课程。 (6) 别担心所有工作都被印度人抢走。 (7) 找一份好的暑期实习工作。 ...
输出多行文本到文件中去 +239@~> echo " test `whoami` haha ">outfile +239@~> cat outfile test wang haha 但是里面如果出现引号之类的,比较难处理 可以用heredoc: +239@~> cat > outfile < just a test > "`whoami`" > haha'aa > EOF +239@~> cat outfile just a test "wang" haha'aa
几个网站,喜欢linux,shell的可以看一下 shell-fu http://www.commandlinefu.com/ http://snipt.net/public/tag/bash?page=2 good coders code, great reuse
十分钟年华老去 当你看完的时候,你又老了九十分钟。
创建个1M的文件 562 ~/script/notsobad/c/0105>dd if=/dev/zero of=file.in bs=1024 count=1024 记录了1024+0 的读入 记录了1024+0 的写出 1048576字节(1.0 MB)已复制,0.0125037 秒,83.9 MB/秒 563 ~/script/notsobad/c/0105>ls -lh 总计 1.1M -rw-r--r-- 1 wang wang 1.0M 2010-01-05 21:42 file.in 拷贝文件: #include #include #include #include #include int main(){ char c[1024]; int in, out; int nread; in = open("file.in", O_RDONLY); out = open("file.out", O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR); while( (nread = read(in, c, 1024)) > 0 ) write(out, c, nread); }