Js控制输入字符数限制
From: http://www.phpcake.cn/archives/26/
- <script type="text/javascript">
- function ismaxlength(obj){
- var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
- if (obj.getAttribute && obj.value.length>mlength)
- obj.value=obj.value.substring(0,mlength)
- }
- </script>
- <textarea maxlength="10" onkeyup="return ismaxlength(this)"></textarea>
ZendFramework 使用数据表前缀
目录结构

在 config.ini 定义 prefix
adapter = PDO_MYSQL
host = localhost
username = root
password = 123456
dbname = test
charset = utf8
prefix = pf_ //表前缀
index.php 中将 prefix 注册
- // 读取数据库配置
- $dbconfig = new Zend_Config_Ini('../config/config.ini', 'general');
- // 配置数据库
- $database = Zend_Db::factory($dbconfig->adapter,$dbconfig->toArray());
- // 设置数据库编码
- $database->query("set names {$dbconfig->charset};");
- Zend_Db_Table::setDefaultAdapter($database);
- Zend_Registry::set('database',$database);
- // 数据表前缀
- Zend_Registry::set('dbprefix',$dbconfig->prefix);
在 library/Custom 目录下新建文件 Db.php 继承 Zend_Db_Table 类
- class Custom_Db extends Zend_Db_Table
- {
- public function __construct()
- {
- $dbprefix = Zend_Registry::get('dbprefix');
- $this->_name = $dbprefix.$this->_name;
- parent::__construct();
- }
- }
最后在 model 中继承 Custom_Db 即可
- class User extends Custom_Db
- {
- protected $_name = 'users'; //在Custom_Db中会自动加上表名的前缀
- protected $_primary = 'userid'; //主键
- }
ZEND studio 编辑器字体美化方法
我这里用的是 ZendStudio 5.5.0
找到这个目录 "Zend\ZendStudio-5.5.0\jre\lib"
除 fontconfig.properties.src 文件保留外,删除所有以 fontconfig. 开头的文件
将 fontconfig.properties.src 文件改名为 fontconfig.properties, 然后打开编辑
把以下的值
dialoginput.bold.alphabetic
dialoginput.italic.alphabetic
dialoginput.bolditalic.alphabetic
改成你要设置的字体名称
这里我设置的是
dialoginput.plain.chinese-ms950=MsYahei
dialoginput.bold.alphabetic=Lucida Sans Typewriter Bold
dialoginput.bold.chinese-ms950=MsYahei Bold
dialoginput.italic.alphabetic=Lucida Sans Typewriter
dialoginput.italic.chinese-ms950=MsYahei
dialoginput.bolditalic.alphabetic=Lucida Sans Typewriter Bold
dialoginput.bolditalic.chinese-ms950=MsYahei Bold
其中 dialoginput.xxxx.chinese-ms950 是中文所用字体
然后再文件末尾添加定义上面设置的字体名称
filename.MsYahei_Bold=MSYHBD.TTF
filename.Lucida_Sans_Typewriter=LucidaTypewriterRegular.ttf
filename.Lucida_Sans_Typewriter_Bold=LucidaTypewriterBold.ttf
其中如 filename.MsYahei 中的 MsYahei 就是上面 dialoginput.xxxx.chinese-ms950 所使用的中文名称, 这里空格要改成 "_", 后面的 MSYH.TTF 是你系统中安装的字体文件的名称, 打开系统字体文件夹(如c:\windows\fonts), 以详细方式查看, 文件名一列即是
打开 zend studio, 指定编辑器的字体为 "dialoginput",然后重启编辑器即可看到效果
Tags: IDE, zend, zendstudio, 字体为wordpress添加coolcode插件的quicktag
修改 wp-includes/js/quicktags.js 文件
1. 找到
- edButtons[edButtons.length] =
- new edButton('ed_code'
- ,'code'
- ,'<code>'
- ,'</code>'
- ,'c'
- );
在后面添加
- edButtons[edButtons.length] =
- new edButton('ed_coolcode'
- ,'coolcode'
- ,''
- ,'</coolcode>'
- ,'x'
- );
2. 找到
- else if (button.id == 'ed_link') {
- document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />');
- }
在后面添加
- else if (button.id == 'ed_coolcode') {
- document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertCoolcode(edCanvas, ' + i + ');" value="' + button.display + '" />');
- }
3. 在文件末尾添加
- function edInsertCoolcode(myField, i, defaultLang, defaultLine) {
- if (!defaultLang) {
- defaultLang = 'php';
- }
- if (!defaultLine) {
- defaultLine = 'off';
- }
- if (!edCheckOpenTags(i)) {
- var codeLang = prompt('输入需要加亮的程序语言', defaultLang);
- var codeLine = prompt('是否显示行号(on, off)', defaultLine);
- edButtons[i].tagStart = '<' + 'coolcode';
- if (codeLang) {
- edButtons[i].tagStart = edButtons[i].tagStart + ' lang="'
- + codeLang + '"'
- }
- if (codeLine) {
- edButtons[i].tagStart = edButtons[i].tagStart + ' linenum="'
- + codeLine + '"';
- }
- edButtons[i].tagStart = edButtons[i].tagStart + '>';
- edInsertTag(myField, i);
- }
- else {
- edInsertTag(myField, i);
- }
- }
自动等比例缩放网页中的图片
resizeimg.js
- window.onload = function() {
- for (var index = 0; index < document.images.length; index++) {
- var widthRestriction = 400;
- var heightRestriction = 400;
- var rate = document.images[index].width / document.images[index].height;
- if (document.images[index].width > widthRestriction) {
- document.images[index].width = widthRestriction;
- document.images[index].height = widthRestriction / rate;
- } else if (document.images[index].height > heightRestriction) {
- document.images[index].height = heightRestriction;
- document.images[index].width = heightRestriction * rate;
- }
- document.images[index].onclick = function() {window.open(this.src)};
- document.images[index].title = document.images[index].title + ' 点击在新窗口中查看原图';
- }
- }
vmware server (1.03) sn for linux
Your serial number(s):
9A44N-YAFFA-22J9Q-4J314
9814N-YAY4C-20N45-402AH
9AJFM-Y8ADA-28HC3-4TL8D
981D5-Y0A4V-2AM41-403LN
98N60-Y2FFZ-20JC2-4LQ1X
92J6J-Y8CDZ-200F4-421C0
92HD5-YAV4F-2AJ3P-4TMLX
98JF1-Y2VDZ-22036-4L6TX
9A1DM-YAF6U-20H4M-4A735
98041-Y2UFV-224DH-48QHR
90M6J-Y0U4C-2A5D4-40KHN
98MF1-YAU6C-22561-4A52M
9A16H-Y8ZDA-22MDH-48Q2D
90HD0-Y0Z6V-22H4N-48MUM
9054J-Y2YFV-2A592-4TKHM
98H6H-Y8ZDG-201D1-4042W
90M4J-Y0VDZ-20HFM-4A0HT
90H4H-Y2A4Y-2AMDJ-4A5TJ
90144-Y8U6V-2A112-4L2JJ
98165-Y0C4C-22H44-4AQ38
90H61-YAAFA-20H3L-4T6HX
9816M-Y8C6V-2A5FM-481TT
985DM-Y8GDY-20144-4809X
90M44-Y8AFU-28J36-4LK01
90M4H-Y2UDC-28540-407J9
