Archive for January, 2009
lighttpd 上配置 phpmyadmin
服务器从apache2.2改成lighttpd后phpmyadmin不能使用了,其实只要改一下lighttpd.conf文件,加一句 alias.url += ( “/phpmyadmin/” => “/usr/share/phpmyadmin/” )
linux 下删除.svn目录的命令
find . -type d -iname “.svn” -exec rm -rf {} \;
ubuntu 添加 ssh 服务的命令
apt-get install openssh-server
vim 退出命令
用 x 可代替 wq
vim 常用快捷键
h: left l: right j: down k: up w: move cursor one word to the right b: move cursor one work to the left 0: move to beginning of line $: move to end of line gg: move to beginning of document G: move to end of document nG: move to line #n
window.location方法获取URL各部
首先解释一下URL: 参考百度百科:URL条目 URL即:统一资源定位符 (Uniform Resource Locator, URL) 完整的URL由这几个部分构成: scheme://host:port/path?query#fragment scheme:通信协议 常用的http,ftp,maito等 host:主机 服务器(计算机)域名系统 (DNS) 主机名或 IP 地址。 port:端口号 整数,可选,省略时使用方案的默认端口,如http的默认端口为80。 path:路径 由零或多个”/”符号隔开的字符串,一般用来表示主机上的一个目录或文件地址。 query:查询 可选,用于给动态网页(如使用CGI、ISAPI、PHP/JSP/ASP/ASP.NET等技术制作的网页)传递参数,可有多个参数,用”&”符号隔开,每个参数的名和值用”=”符号隔开。 fragment:信息片断 字符串,用于指定网络资源中的片断。例如一个网页中有多个名词解释,可使用fragment直接定位到某一名词解释。(也称为锚点.) 对于这样一个URL http://www.x2y2.com:80/fisker/post/0703/window.location.html?ver=1.0&id=6#imhere 我们可以用javascript获得其中的各个部分 1, window.location.href 整个URl字符串(在浏览器中就是完整的地址栏) 本例返回值: http://www.x2y2.com:80/fisker/post/0703/window.location.html?ver=1.0&id=6#imhere 2,window.location.protocol URL 的协议部分 本例返回值:http: 3,window.location.host URL 的主机部分 本例返回值:www.x2y2.com 4,window.location.port URL 的端口部分 如果采用默认的80端口(update:即使添加了:80),那么返回值并不是默认的80而是空字符 本例返回值:”” 5,window.location.pathname URL 的路径部分(就是文件地址) 本例返回值:/fisker/post/0703/window.location.html 6,window.location.search 查询(参数)部分 除了给动态语言赋值以外,我们同样可以给静态页面,并使用javascript来获得相信应的参数值 本例返回值:?ver=1.0&id=6 7,window.location.hash [...]
启用apache2.2 rewrite
系统移植后出现 Internal Server Error 错误 判断是新环境没有启用 rewrite module。 启用方法原文: now use locate to find if the mod_rewrite.so is availble on your server updatedb locate mod_rewrite.so it will found in “/usr/lib/apache2/modules” new apache follow some folders to enable and desuable mods. so now do this: cd /etc/apache2/mods-enabled touch rewrite.load gedit rewrite.load (you may use any editor [...]
使 VIM 支持 PHP 语法高亮
在 /etc/vim/vimrc 最后添加 :syntax enable 如果打开语法高亮后发现类似错误:Sorry, the command is not available in this version: syntax on 可能是有些包没有装在 ubuntu 下通过 apt-get install vim 即可解决