支持特性
CodeColorer支持的语言有:(支持的语言多达数十种,以下根据使用频繁度有删减)
1 2 3 4
| apache,applescript,apt_sources, bash,c, cmake,css,
dos, ini, inno,java,java5,javascript, make,mysql,oracle11,oracle8,
perl,php, plsql,powershell,python,rails,reg,robots,ruby,sql,
tcl,text,tsql,vim, xml, xorg_conf |
使用方法
使用时,将编辑器切换到HTML模式,而不是可视化。在想要插入代码的地方,输入以下代码:
<code lang=”lang_name”>这里是代码</code>
lang_name表示语言名称
效果:1
1
| echo "This is php code"; |
参考资料
CodeColorer项目主页:http://kpumuk.info/projects/wordpress-plugins/codecolorer/
WordPress
近几天想把工作中的一些经验发布出来,每次打开live write的快捷方式,都提示“找不到可执行文件”。一忙,也就放着不管了。
今天才想起来,好几年前微软发布一款“Windows Installer 清理工具”,可以用来彻底程序注册信息。Google搜了下载地址,安装直接使用,清除残余的Live Writer注册信息,重新安装,我又爬上来了-_-.
下载地址:PCHome
1 2
| 因为**原因,微软新版的清理工具已经不支持除Office套装之外的注册信息清除。
详细页面:http://support.microsoft.com/kb/290301/zhcn |
Windows
有些站点,经常因为被别人绑定了未备案的域名,遭电信关闭IP。
该规则,也经常被竞争对手恶意利用。因此,对Web Serve设置默认虚拟主机,来屏蔽非法域名很重要。
Nginx的做法
添加以下server zone
1 2 3 4
| server {
listen 80 default;
return 500;
} |
Read the rest of this entry
Apache, Nginx
1. WordPress Mu后台开启永久链接功能
1
| 后台-设置-永久链接-自定义结构-/blog/archives/%post_id% |
2. 修改Nginx.conf,加入rewrite rules
Read the rest of this entry
WordPress
在《解决Linux Server时间不准确的问题》一文中,使用了crontab定期执行ntpdate来校对时间。之后恰巧某博客上的文章,提出一个观点“时钟的跃变,有时候会导致很严重的问题。许多应用程序依赖连续的时钟——毕竟,这是一项常见的假定,即,取得的时间是线性的,一些操作,例如数据库事务, 通常会地依赖这样的事实:时间不会往回跳跃。”时间的瞬变,对于crontab等对时间敏感的系统任务,也是很容易造成错乱的。
Read the rest of this entry
databse, Linux
服务器每隔好几个月,总会差那么几分钟。应对措施,就是每隔段时间,进行网络对时。
以下摘自《鸟哥的私房菜》,可解读为什么会有偏差的问题。
1 2 3 4 5 6 7
| 事實上,在我們的身邊就有很多的原子鐘,例如石英表,還有電腦主機上面的 BIOS 內部就含有一個原子鐘在
紀錄與計算時間的進行吶!不過由於原子鐘主要是利用計算晶片 (crystal) 的原子震盪週期去計時的,
這是因為每種晶片都有自己的獨特的震盪週期之故。 然而因為這種晶片的震盪週期在不同的晶片之間多多少少都會有點差異性,
甚至同一批晶片也可能會或多或少有些許的差異(就連溫度也可能造成這樣的誤差呢!),
因此也就造成了BIOS的時間會三不五時的給他快了幾秒或者慢了幾秒。
或許您會認為,BIOS 計時器每天快個五秒也沒有什麼了不起的,不過如果您再仔細的算一算,會發現,一天快五秒, 那麼一個月快2.5分鐘,
一年就快了 75 分鐘了!所以說,呵呵!時間差是真的會存在的! (依据该原理,只要关机或者重启次数越多,时间就会差得越离谱) |
1.挑选最快最稳定的ntp上层服务器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| C:\Documents and Settings\linqp >ping ntp.api.bz -n 100
Approximate round trip times in milli-seconds:
Minimum = 67ms, Maximum = 89ms, Average = 80ms
C:\Documents and Settings\linqp >ping t3.hshh.org -n 50
Approximate round trip times in milli-seconds:
Minimum = 18ms, Maximum = 22ms, Average = 19ms
C:\Documents and Settings\linqp >ping t1.hshh.org -n 50
Approximate round trip times in milli-seconds:
Minimum = 22ms, Maximum = 27ms, Average = 24ms
C:\Documents and Settings\linqp >ping 1.cn.pool.ntp.org -n 50
Ping statistics for 122.226.192.4:
Packets: Sent = 50, Received = 50, Lost = 0 (0 % loss ),
Approximate round trip times in milli-seconds:
Minimum = 18ms, Maximum = 24ms, Average = 21ms |
2.使用ntpdate同步系统时间
1
| root@krc:~# /usr/sbin/ntpdate t3.hshh.org |
修改前
1 2 3 4
| root@krc:~# date
Tue Jul 13 16:22:42 CST 2010
root@krc:~# hwclock -r
Tue 13 Jul 2010 04:21:23 PM CST -0.001126 seconds |
修改后
1 2 3 4
| root@krc:~# date
Tue Jul 13 16:26:33 CST 2010
root@krc:~# hwclock -r
Tue 13 Jul 2010 04:26:45 PM CST -0.001124 seconds |
3.建立计划任务
1 2 3 4 5 6 7 8 9 10
| root@krc:~#crontab -e
# m h dom mon dow command
00 00 * * * /bin/bash /usr/local/webserver/nginx/sbin/cut_nginx_log.sh
28 23 * * * /etc/webmin/cron/tempdelete.pl
1 0 * * 1 find /data1/backup_zone/data_www/* -mtime +28 |xargs rm -f
10 00 * * 1 cat /dev/null > /data1/backup_zone/data_www/snapfile
11 00 * * * bash /root/script-bak/bak_www.sh
1 1 * * * bash /root/script-bak/bak_conf.sh
11 1 * * 1 find /data1/backup_zone/data_conf/* -mtime +28 |xargs rm -f
*/10 * * * * /usr/sbin/ntpdate t3.hshh.org && /sbin/hwclock -w |
4.参考资料
1 2 3
| 鸟哥的教程 http://linux.vbird.org/linux_server/0440ntp.php
Public NTP Server http://support.ntp.org/bin/view/Servers/StratumTwoTimeServers
Asia Public NTP Server http://www.pool.ntp.org/zone/asia |
Linux
系统环境 – Vmware WorkStation 7(同系列其他产品,如ESX/Esxi类似)
客户机操作系统 – Ubunt Linux Server 9.10
搭建测试环境,为了快速部署,使用Vmware的Clone功能,快速复制出许多客户机。
启动后发现个问题,除了源客户机,其他副本客户机,网络功能都不正常,具体表现为
- ifconfig输出的网络配置,只有lo,没有eth0
- “ifconfig –a”输出的网络配置中,eth0已经被自动修改为eth1了
- /etc/udev/rules.d/70-persistent-net.rules中,有eth0和eth1的详细定义。eth0为源客户机copy过来的;eth1为虚拟机自动生成的新网卡,定义区块的ATTR{address}记录着新网卡的mac(在虚拟机目录的VMX文件中,也能找到该mac地址)
Read the rest of this entry
Linux, network
如同Linux的”sudo”
C:\Documents and Settings\linqp>runas /h
RUNAS 用法:
RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/user:<UserName> program
RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/smartcard [/user:<UserName>] program
Read the rest of this entry
Windows