August 18, 2012
git下添加新项目及用户
"\u003cp\u003e我们在上一节()配置成功了git-server。这里我们新创建一个git项目并允许开者使用.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e1. 生成密钥与公钥\u003c/strong\u003e\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003e***\u003cem\u003e[dev1@bogon ~]$ ssh-keygen -t rsa\nGenerating public/private rsa key pair.\nEnter file in which to save the key (/home/dev1/.ssh/id_rsa):\nCreated directory ‘/home/dev1/.ssh’.\nEnter passphrase (empty for no passphrase):\nEnter same passphrase again:\nYour identification has been saved in /home/dev1/.ssh/id_rsa.\nYour public key has been saved in /home/dev1/.ssh/id_rsa.pub.\nThe key fingerprint is: …\u003c/em\u003e\u003c/p\u003e\u003c/blockquote\u003e"
August 14, 2012
CentOS 6.0 SSH命令无法执行的问题的解决办法
"\u003cp\u003e需要通过这台centos,ssh到另外一台\u003c/p\u003e\n\u003cp\u003e结果发现没有ssh\u003c/p\u003e\n\u003cp\u003e通常可能是未安装openssh所导致的\u003c/p\u003e\n\u003cp\u003e执行\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003erpm -qa | grep openssh\u003c/p\u003e\u003c/blockquote\u003e\n\u003cp\u003e如果没有:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eopenssh-clients\u003c/p\u003e\u003c/blockquote\u003e\n\u003cp\u003e那就安装:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003c/blockquote\u003e\n\u003cblockquote\u003e\n\u003cp\u003eyum -y install openssh-clients\u003c/p\u003e\u003c/blockquote\u003e"
August 14, 2012
Git中gitignore失效的问题
"\u003cp\u003e使用git来管理代码,但发现仓库中加入了.gitignore文件,但并不能解除对.gitignore文件中指定的路径及文件进行忽略。是因为加入.gitignore的之前已经进行过提交,提交中含有要忽略的文件,而这个时候.gitignore 对这些文件是失效的,为了解决这个问题,需要先删除这些中间文件,然后进行一次提交就可以解决这些问题了。\u003c/p\u003e\n\u003cp\u003e在本地仓库将.gitgnore文件里指定的相关文件及路径全部删除,再commit到本机一下。然后执行push到git Server就可以了。这样就可以将git sever上的那些临时文件删除掉。以后再使用的话,产生的文件就不会在提交到git server上去了。\u003c/p\u003e"
August 13, 2012
redmine使用nginx提供服务
"\u003cp\u003e上一节 \u003ca href=\"http://blog.haohtml.com/archives/13282\"\u003ehttp://blog.haohtml.com/archives/13282\u003c/a\u003e 我们介绍了在centos下安装redmine软件的方法,但使用时候需要使用ip:3000 的形式才可以访问,不是太方便,我们习惯使用域名的形式来处理的。这里我们直接使用域名redmine.haohtml.com 来访问. 我们使用的是web server 为 nginx 。\u003c/p\u003e\n\u003cp\u003e我们使用虚拟主机配置文件redmine.conf.内容如下:\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003eupstream mongrel{\nserver 127.0.0.1:3000;\n}\n\nserver {\n\nlisten 80;\nserver_name redmine.haohtml.com;\nroot /data/wwwroot/redmine/redmine-2.0.3/public;\nlocation / {\nindex index.php index.html index.shtml;\nproxy_pass http://mongrel;\nproxy_redirect off;\nproxy_set_header Host $host; …\u003c/code\u003e\u003c/pre\u003e"
August 12, 2012
centos安装redmine项目管理系统[教程]
"\u003cp\u003e这里操作系统为Linux Centos5,参考文档: \u003ca href=\"http://www.redmine.org/projects/redmine/wiki/HowTo_install_Redmine_on_CentOS_5\"\u003ehttp://www.redmine.org/projects/redmine/wiki/HowTo_install_Redmine_on_CentOS_5\u003c/a\u003e\u003c/p\u003e\n\u003ch3 id=\"另外网上也有一键安装的软件官方网站为\"\u003e另外网上也有一键安装的软件,官方网站为:\u003c/h3\u003e\n\u003ch3 id=\"ruby--ruby-on-rails--rack\"\u003eRuby \u0026amp; Ruby on Rails \u0026amp; Rack\u003c/h3\u003e\n\u003cp\u003eThe required Ruby and Ruby on Rails versions for a given Redmine version is:\u003c/p\u003e\n\u003cp\u003eRedmine version\u003c/p\u003e\n\u003cp\u003eSupported Ruby versions\u003c/p\u003e\n\u003cp\u003eRequired Rails version\u003c/p\u003e\n\u003cp\u003eSupported RubyGems versions\u003c/p\u003e\n\u003cp\u003ecurrent trunk\u003c/p\u003e\n\u003cp\u003eruby 1.8.7, 1.9.2, 1.9.3, jruby-1.6.7\u003c/p\u003e\n\u003cp\u003eRails 3.2.6\u003c/p\u003e\n\u003cp\u003eRubyGems \u0026lt;= 1.8\u003c/p\u003e\n\u003cp\u003e2.0.3\u003c/p\u003e\n\u003cp\u003eruby 1.8.7, 1.9.2, 1.9.3, jruby-1.6.7\u003c/p\u003e\n\u003cp\u003eRails 3.2.6\u003c/p\u003e\n\u003cp\u003eRubyGems \u0026lt;= 1.8\u003c/p\u003e\n\u003cp\u003e2.0.2\u003c/p\u003e\n\u003cp\u003eruby …\u003c/p\u003e"
August 10, 2012
Redmine局域网访问缓慢问题解决
"\u003cp\u003e笔者查阅网上意见,发现是由于Redmine自带的WebrickWeb发布的问题,需要使用Mongrel组件来替换Webrick。在此放在这里方便大家,形成一套完整的Redmine搭建方案。\u003c/p\u003e\n\u003cp\u003e1. 替换其自带的服务器webrick 为mongrel,方法:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003egem install mongrel\u003c/p\u003e\u003c/blockquote\u003e\n\u003cp\u003e如果提示类似“\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003ehttp11.c: In function ‘header_done’:\nhttp11.c:172:13: error: ‘struct RString’ has no member named ‘ptr’\nhttp11.c:172:13: error: ‘struct RString’ has no member named ‘ptr’\nhttp11.c:172:13: error: ‘struct RString’ has no member named ‘ptr’\nhttp11.c:174:89: error: ‘struct RString’ has no member named ‘ptr’\nhttp11.c:176:52: error: ‘struct …\u003c/code\u003e\u003c/pre\u003e"
August 10, 2012
incorrect MySQL client library version! This gem was compiled for 6.0.0 but the client library is 5.5.20. 的解决办法
"\u003cp\u003e从mysql官方下载 mysql-connector-c-noinstall-6.0.2-win32 解压到e:/。注意根据自己的实际情况下载相对应的版本,这里使用非安装版。\u003c/p\u003e\n\u003cp\u003eor Ruby 1.9.2:\u003c/p\u003e\n\u003cp\u003egem install mysql \u0026ndash;platform=ruby \u0026ndash; \u0026ndash;with-mysql-dir=e:/mysql-connector-c-noinstall-6.0.2-win32\u003c/p\u003e\n\u003cp\u003efor Ruby 1.9.3: (showing mysql2 variant)\u003c/p\u003e\n\u003cp\u003egem pristine mysql2 \u0026ndash; \u0026ndash;with-mysql-config=e:\\mysql-connector-c-noinstall-6.0.2-win32\u003c/p\u003e\n\u003cp\u003e这里我用64位的win7系统.\u003c/p\u003e\n\u003cp\u003e然后将** E:\\mysql-connector-c-noinstall-6.0.2-win32\\lib** 目录下的 libmysql.lib 文件复制到 \u003cstrong\u003eE:\\RailsInstaller\\Ruby1.9.3\\bin\u003c/strong\u003e 目录下。\u003c/p\u003e\n\u003cp\u003e重新执行刚才的命令即可。\u003c/p\u003e"
August 10, 2012
Windows下安装Redmine教程
"\u003cp\u003ewindows下的一键安装有:\u003c/p\u003e\n\u003cp\u003e参考网址:\u003c/p\u003e\n\u003cp\u003eRedmine是用Ruby开发的基于web的项目管理软件,是用ROR框架开发的一套跨平台项目管理系统,据说是源于Basecamp的ror版而来,支持多种数据库,有不少自己独特的功能,例如提供wiki、新闻台等,还可以集成其他版本管理系统和BUG跟踪系统,例如SVN、CVS、TD等等。这种 Web 形式的项目管理系统通过“项目(Project)”的形式把成员、任务(问题)、文档、讨论以及各种形式的资源组织在一起,大家参与更新任务、文档等内容来推动项目的进度,同时系统利用时间线索和各种动态的报表形式来自动给成员汇报项目进度。\u003c/p\u003e\n\u003cp\u003e我们这里使用RailsInstaller,Ruby和Rails都集成集中。\u003c/p\u003e\n\u003cp\u003e网址是:下载 \u003ca href=\"http://rubyforge.org/frs/download.php/75894/railsinstaller-2.1.0.exe\"\u003ehttp://rubyforge.org/frs/download.php/75894/railsinstaller-2.1.0.exe\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e安装在e:/盘根目录下。安装成功后目录如下图所示:\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"http://blog.haohtml.com/wp-content/uploads/2012/08/railsinstaller_folder.gif\"\u003e\u003cimg src=\"http://blog.haohtml.com/wp-content/uploads/2012/08/railsinstaller_folder.gif\" alt=\"\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e1.\u003cstrong\u003e下载 redmine\u003c/strong\u003e(http://www.redmine.org/projects/redmine/wiki/Download) …\u003c/p\u003e"
August 7, 2012
动态添加input表单元素的js代码
"\u003cp\u003eaddinput.js\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003e//======================\n//功能:在表单中input file控件\n//参数:parentID—要插入input file控件的父元素ID\n// inputID—-input file控件的ID,这个一定要和name保持一致的,否则会出问题\n// maxNum — 最大数量 0为不限制\n//======================\nfunction createInput(parentID,inputFileID, maxNum){\u003c/p\u003e\n\u003cp\u003eif (maxNum \u0026gt; 0) {\nx=document.getElementsByName(inputFileID);\ny=x.length;\nif (y \u0026gt;= maxNum) {\nalert(‘最多只允许添加’ + maxNum + ‘个’);\nreturn false;\n}\n}\u003c/p\u003e\n\u003cp\u003evar parent=$G(parentID);//获取父元素\u003c/p\u003e\n\u003cp\u003evar div=document.createElement(“div”);//创建一个div容器用于包含input file\nvar …\u003c/p\u003e\u003c/blockquote\u003e"
August 6, 2012
zend studio 破解及汉化(9.0.3/10.0.0)
"\u003cp\u003eZend studio 10 破解下载地址见: \u003ca href=\"http://www.geekso.com/ZendStudio100/\"\u003ehttp://www.geekso.com/ZendStudio100/\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e==========================================================\u003c/p\u003e\n\u003cp\u003ezend studio 9.0.3版本,官方下载地址如下:\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"http://downloads.zend.com/studio-eclipse/9.0.3/ZendStudio-9.0.3.msi\"\u003ehttp://downloads.zend.com/studio-eclipse/9.0.3/ZendStudio-9.0.3.msi\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e开始破解软件:\u003c/p\u003e\n\u003cp\u003e首先下载破解文件: \u003ca href=\"/wp-content/uploads/2012/08/com.zend.php.core_9.0.3.201205071416\" title=\"com.zend.php.core_9.0.3.201205071416.jar\"\u003ecom.zend.php.core_9.0.3.201205071416.jar\u003c/a\u003e ,下载完成后,复制到zend studio 9.0.3的plugins目录下,\u003c/p\u003e\n\u003cp\u003e覆盖原文件,记住不要解压。\u003c/p\u003e\n\u003cp\u003e启动zend studio 9.0.3, 输入下面注册码: …\u003c/p\u003e"
August 5, 2012
jQuery Datepicker 中文
"\u003cp\u003e\u003ca href=\"http://blog.haohtml.com/wp-content/uploads/2012/08/jquery-ui-datepicker-chinese.png\"\u003e\u003cimg src=\"http://blog.haohtml.com/wp-content/uploads/2012/08/jquery-ui-datepicker-chinese.png\" alt=\"\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e以前在使用 js 日历时,没有使用过 \u003ca href=\"http://jqueryui.com/demos/datepicker/\"\u003ejQuery Datepicker\u003c/a\u003e,今天第一次使用发现非常的好用。使用时需要将日历文字显示为中文,打开前边的链接在文章底部就可以看到将 jQuery Datepicker 文字显示为中文的方法,在 \u003ca href=\"http://jquery-ui.googlecode.com/svn/trunk/ui/i18n/\"\u003ehttp://jquery-ui.googlecode.com/svn/trunk/ui/i18n/\u003c/a\u003e 可以看到各种版本的语言,中文文件内容如下:\u003c/p\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003ejQuery(function($){\n $.datepicker.regional[\u0026#39;zh-CN\u0026#39;] = {\n closeText: \u0026#39;关闭\u0026#39;,\n prevText: \u0026#39;\u0026lt;上月\u0026#39;,\n nextText: \u0026#39;下月\u0026gt;\u0026#39;,\n currentText: \u0026#39;今天\u0026#39;,\n monthNames: [\u0026#39;一月\u0026#39;,\u0026#39;二月\u0026#39;,\u0026#39;三 …\u003c/code\u003e\u003c/pre\u003e"
August 5, 2012
jQuery mouseover mouseout事件在IE下闪烁的解决方法
"\u003cblockquote\u003e\n\u003c/blockquote\u003e\n\u003cpre tabindex=\"0\"\u003e\u003ccode\u003e$(\u0026#34;#category ul\u0026#34;).find(\u0026#34;li\u0026#34;).each(\n function() {\n $(this).mouseover(\n function() {\n $(\u0026#34;#\u0026#34; + this.id + \u0026#34;_menu\u0026#34;).show();\n $(this).addClass(\u0026#34;a\u0026#34;);\n }\n );\n $(this).mouseout(\n function() {\n $(this).removeClass(\u0026#34;a\u0026#34;);\n $(\u0026#34;#\u0026#34; + this.id + \u0026#34;_menu\u0026#34;).hide();\n }\n );\n }\n);\n\u003c/code\u003e\u003c/pre\u003e\u003cp\u003e浏览器之间的不兼容一直令前端开发者的头疼,而 IE 更是噩梦。鼠标在下拉菜 …\u003c/p\u003e"
July 30, 2012
MySQL开发规范[转]
"\u003ch1 id=\"mysql开发规范\"\u003eMySQL开发规范\u003c/h1\u003e\n\u003cp\u003e说明,此规范为内部制定的一个给开发人员如何使用MySQL的规范,由Team共同讨论制定,还在不断的完善中,有一些建议或者规定不一定十分合理,后续可能会修改。另外,MySQL版本不断进化,也会导致有一些条款失效,请大家根据自身的情况谨慎参考。\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e一、\u003c/strong\u003e \u003cstrong\u003e表设计\u003c/strong\u003e\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003e库名、表名、字段名必须使用小写字母,“_”分割。 \u003ca href=\"#MySQL-1-1\"\u003e【FAQ】\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e库名、表名、字段名必须不超过12个字符。 \u003ca href=\"#MySQL-1-2\"\u003e【FAQ】\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e库名、表名、字段名见名知意,建议使用名词而不是动词。 \u003ca href=\"#MySQL-1-3\"\u003e【FAQ】\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e建议使用InnoDB存储引擎。 \u003ca href=\"#MySQL-1-4\"\u003e【FAQ】\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e存储精确浮点数必须使用DECIMAL替代FLOAT和DOUBLE。 \u003ca href=\"#MySQL-1-5\"\u003e【FAQ】\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e建议使用UNSIGNED存储非负数值。 \u003ca href=\"#MySQL-1-6\"\u003e【FAQ】\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e建议使用INT UNSIGNED存储IPV4。 \u003ca href=\"#MySQL-1-7\"\u003e【FAQ】\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e整形定义中不添加长度,比如使用INT,而不是INT(4)。 \u003ca href=\"#MySQL-1-8\"\u003e【FAQ】\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e使用短数据类型,比如取值范围为0-80时,使用TINYINT UNSIGNED。\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e不建议使用ENUM类型,使用TINYINT来代替。 \u003ca href=\"#MySQL-1-10\"\u003e【FAQ】\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e尽可能不使用TEXT、BLOB类型。 …\u003c/p\u003e\u003c/li\u003e\u003c/ol\u003e"
July 22, 2012
使用pt-stalk诊断MySQL问题
"\u003cp\u003e在MySQL服务器出现短暂(5~30秒)的性能波动的时候,一般的性能监控工具都很难抓住故障现场,也就很难收集对应较细粒度的诊断信息。另外,如果这种波动出现的频率很低,例如几天才一次,我们也很难人为的抓住现场,收集数据。这正是pt-stalk所解决的问题。\u003c/p\u003e\n\u003cp\u003ept-stalk是 \u003ca href=\"http://www.percona.com/software/percona-toolkit/\"\u003ePercona-Toolkit\u003c/a\u003e 的一部分(其前身是\u003ca href=\"http://code.google.com/p/aspersa/\"\u003eAspersa\u003c/a\u003e的一部分)。安装Percona-Toolkit后,可以通过man pt-stalk了解如何使用该工具,本文的介绍是man pt-stalk的一个子集,强烈建议直接阅读man pt-stalk。额外的,本文将提供pt-stalk示例命令可供参考。\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e1. 使用pt-stalk\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003ept-stalk –collect-tcpdump –function status \\\u003c/p\u003e\n\u003cp\u003e–variable Threads_connected –threshold 2500 \\\u003c/p\u003e\n\u003cp\u003e–daemonize — –user=root –password=YOURPASSWORD\u003c/p\u003e\n\u003cp\u003e上面的命令表示,让pt-stalk后台运行(–daemonize),并监视SHOW GLOBAL STATUS …\u003c/p\u003e"
July 17, 2012
如何在linux下解压缩rar格式的文件压缩包
"\u003cp\u003e前言:没有特殊原因,文档如果要传到linux上,一定要打成*.zip格式,这样方便解压,一般来说没有理由要用rar.关于 linux上unzip命令有空细讲,本节讲下,如何让linux支持解压缩rar文件\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e一 、系统环境\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e1.1 系统环境\n实验环境一:\nCentOS release 5.5 (Final)\n2.6.18-194.el5\nx86_64 GNU/Linux \u0026lt;–64位系统\n实验环境二:\nCentOS release 5.4 (Final)\n2.6.18-164.el5\ni686 GNU/Linux \u0026lt;–32位系统\u003c/p\u003e\n\u003cp\u003e1.2命令查看方法:\n[root@oldboy tools]# cat /etc/redhat-release\nCentOS release 5.5 (Final)\n[root@oldboy tools]# uname -r\n2.6.18-194.el5\n[root@oldboy tools]# uname -m\nx86_64\n\u003cstrong\u003e二、下载并安装rar软件\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e2.1 下载( \u003ca href=\"http://www.rarsoft.com/download.htm\"\u003ehttp://www.rarsoft.com/download.htm\u003c/a\u003e) …\u003c/p\u003e"