ubuntu 9.04源

ubuntu 9.04上交的源, 我这里速度很快, 北京网通的 deb http://ftp.sjtu.edu.cn/ubuntu/ jaunty main multiverse restricted universe deb http://ftp.sjtu.edu.cn/ubuntu/ jaunty-backports main multiverse restricted universe deb http://ftp.sjtu.edu.cn/ubuntu/ jaunty-proposed main multiverse restricted universe deb http://ftp.sjtu.edu.cn/ubuntu/ jaunty- security main multiverse restricted universe deb http://ftp.sjtu.edu.cn/ubuntu/ jaunty-updates main multiverse restricted universe deb-src http://ftp.sjtu.edu.cn/ubuntu/ jaunty main multiverse restricted universe deb-src http://ftp.sjtu.edu.cn/ubuntu/ jaunty-backports main multiverse restricted universe deb-src http://ftp.sjtu.edu.cn/ubuntu/ jaunty-proposed main multiverse restricted universe deb-src http://ftp.sjtu.edu.cn/ubuntu/ jaunty-security main multiverse restricted universe deb-src http://ftp.sjtu.edu.cn/ubuntu/ jaunty-updates main multiverse restricted universe

June 12, 2009 · notsobad

从头学C

我也开始学C了,从头开始 在看Linux C编程一站式学习 写了这么简单一个程序居然也出错: #include <math.h> #include <stdio.h> /* main */ int main(){ int i; double pi = 3.1415; printf("sin(pi/2)=%f", sin(pi/2)); for (i=0; i<123; i++){ printf("%d => %c\n", i, i); } return 0; } 编译: 507 ~/script/cpp>gcc -Wall wang.c /tmp/ccuCPK1g.o: In function main': wang.c:(.text+0x29): undefined reference to sin’ collect2: ld 返回 1 google了一下,原来还是个FAQ 这样就ok了 514 ~/script/cpp>gcc -Wall -lm wang.c && ./a.out sin(pi/2)=1.000000 这个网站不错: c-faq.com ...

June 12, 2009 · notsobad

Lisp

最近在用emacs,看了些lisp的东西 原来现代语言的很多特性最早是从lisp中来的 找到几篇很好的文章: 十年学会编程 Lisp之根源 1. 条件语句。当初的语言是没有if else的,goto统治世界。 2. 函数类型。函数成了语言里的类型,可以被变量指代,可以被当成参数传来传去(的一类公民的必要条件,参考SICP第一章)。这一条可以极大简化编程,让我们写出非常漂亮的程序。所以现在的流行语言纷纷加入了这个特性(可惜Java没有)。 3. 递归。这个不用说了吧。 4. 动态类型。smalltalk, python, ruby。。。连C#也有一个类似的var了。 5. 垃圾收集。不要以为GC是Smalltalk的发明哈,更不是Java的。 6. 基于表达式的编程。任何表达式都可以成为另一个表达式的一部分。不像很多语言,把表达和陈述分开。 7. 符号类型。这个在python和ruby里被采用,广受欢迎。 8. 代码即解析树。这个让LISP能方便地定义新的句法,操作程序本身,编写元程序,生成真正意义上的宏。 9. 语言无时不在。代码运行/解析可以在任何时候发生。这点和8.配合可以让语言的扩展和交流变得非常容易。 ...

June 9, 2009 · notsobad

emacs vs vi

emacs与vi的对比 我习惯用vi,但一直想尝试下emacs,屡次失败 vi下的常用的几个操作,然后找出emacs对应操作就会简单的多了 VI EMACS -- ----- Right one column k ^f Right one word w Esc,f Left one word b Esc,b Next sentence ) Esc,e Previous sentence ( Esc,a Save file :w ^x,^s Delete paragraph d} Esc,x,kill-p[TAB],[RET] Edit a new file :ename ^x,^f,name RegEx search for "foo" /foo Esc,^sfoo Repeat search n ^s,[RET] Exit :q or QQ ^x,^c Save and Exit :x ^x,^s,^x,k,[RET] Repeat last search n ^s,[RET] Paste from clipboard p ^y Delete 7 lines 7dd ^a,Esc,7,^k Undo u ^x,u or ^/ Change a letter to "x" rx ^d,x Go to line 6 :6[RET] Esc,<,Esc,5,^n ..or 6G Esc,x,goto-l[TAB][RET],6[RET] 另外和bash里面的几个快捷键一样: 到行首:^a 到行尾:^e 删除行: ^k 粘贴:^y undo: ^x u 参考: http://www.grok2.com/vi-emacs.html http://www.io.com/~dierdorf/emacsvi.html <http://www.cs.rutgers.edu/LCSR- Computing/some-docs/emacs-chart.html> http://www.wlindley.com/gnu/vi.htm ...

June 8, 2009 · notsobad

PDA 网站

国内的pda和智能手机网站: tompda maxpda pdafans hipda 我现在有的,palm tx, bb 7230, _Dopod D700 使用下来,还是palm的系统速度快,操作方便 _

June 7, 2009 · notsobad

php中的会话阻塞

php中exec, system调用其它脚本,脚本中又将一些脚本放入后台,可能会话会被挂起,也就是其它所有的请求都会被阻塞,点任何链接都没反应。 似乎与这个问题有关: What happens is that the child process which is called by the system() ,exec() or shell_exec() command holds the file lock on the parent process, thus locking the session file. Thus, the session file being locked session_start(); function cannot access the file. This is due to to open file descriptors locking the session file.Your entire session will be locked, so none of the pages of the website can be opened ( which are under session control ) unless you change the browser or delete cookies. ...

June 1, 2009 · notsobad

用umask来定义权限

在linux下,有时需要多人改一个文件, a, b在同一个组内,但是默认的a创建的文件权限是“-rw-r–r–”,组用户是没有写权限的。 我希望修改默认的创建文件的权限,这样不用手动去改,今天发现umask就是干这个事的 这篇讲得很详细 http://linux.vbird.org/linux_basic/0220filemanager.php#umask 所以只要在.bashrc里面写: umask 0002 或者: umask g=rw doubanclaimdcac3ef1e9a427da ...

May 25, 2009 · notsobad

Javascript 来判断网络通断

一项应用可能会导致 web server 重启, 我需要检测这个重启过程,重启完毕能够给用户以通知 思路: js的生存期是在客户端,即使服务器已经重启,js仍可运行,所以用js是可以实现的 因为server上存在着favicon.ico文件,可以以检测是否能取得这个文件,来判断网络的通断。 ...

May 20, 2009 · notsobad

Form中action的参数限制

今天遇到的一个问题及其解决。 这样的一个表单: <form method=post action="/post.php?_in_form=123">... 在server端: <? //取不到$_GET['_in_form']! ?> 查了一些资料 参考: Methods GET and POST in HTML forms - what’s the difference? 关于GET和POST,数据的不同处理 If the method is "get" - -, the user agent takes the value of action, appends a ? to it, then appends the form data set, encoded using the application/x-www-form-urlencoded content type. The user agent then traverses the link to this URI. In this scenario, form data are restricted to ASCII codes. * If the method is "post" --, the user agent conducts an HTTP post transaction using the value of the action attribute and a message created according to the content type specified by the enctype attribute. 结论: get形式的from中,action中的get参数是不会传递的,应该把需要的附加参数作为form隐藏域处理 ...

May 18, 2009 · notsobad

ubuntu 9.04 的新notify的python示例

ubuntu的通知机制 参考: https://wiki.ubuntu.com/NotifyOSD https://wiki.ubuntu.com/NotificationDevelopmentGuidelines 下面是一个简单的python脚本,利用这个新的notify。 效果: https://wiki.ubuntu.com/NotificationDevelopmentGuidelines?action=AttachFile&do=get&target=icon-summary-body.png #!/usr/bin/python import sys import time import pynotify if __name__ == '__main__': if not pynotify.init ("update-notifications"): sys.exit (1) # try the icon-summary-body case n = pynotify.Notification ( "Inital notification", "This is the original content of this notification-bubble.", "notification-message-IM") n.show () time.sleep (3); # simulate app activity # update the current notification with new content n.update ("Updated notification", "Here the same bubble with new title- and body-text, even the icon can be changed on the update.", "notification-message-email") n.show (); time.sleep (6); # wait longer now # create a new bubble using the icon-summary-body layout n = pynotify.Notification ( "Initial layout", "This bubble uses the icon-title-body layout.", "notification-message-IM"); n.show () time.sleep (3); # simulate app activity # now update current bubble again, but change the layout n.update ("Updated layout", "After the update we now have a bubble using the title-body layout.") n.show ()

May 17, 2009 · notsobad