`
wooce
  • 浏览: 180409 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

tech diary追记

阅读更多
03/04/12:

Q:  mysqld_safe启动不成功, 查看/var/log/mysqld.log有以下错误:

061110  9:44:16 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
061110  9:44:16 [ERROR] Fatal error: Can't open privilege tables: Can't find file: './mysql/host.frm' (errno: 13)

但查看存在/var/lib/mysql/mysql/host.frm这个文件, 如何解决?

A:  这是因为权限的问题,查看/var/lib/mysql/mysql/ 下的文件的用户组都是属于root.root

      把/var/lib/mysql/mysql/ 这个目录删掉, 然后用mysql_install_db --user=mysql重新初始化一次mysql,再查看/var/lib/mysql/mysql/ 下的文件的用户组都是属于mysql.mysql, 这时启动mysqld_safe即可正常启动了。



03/05/15:     

Q:  solaris下能否创建链路层的socket字吗?

就象linux下的SOCK_PACKET:

socket(AF_INET, SOCK_PACKET,0)

A by Wooce:   solaris是用DLPI(Data Link Provider Interface)

http://www.science.uva.nl/pub/solaris/solaris2/Q6.15.html

FTP the paper "How to Use DLPI in Solaris 2.x" by Neal Nuckolls of Sun Internet Engineering. Look in these FTP directories: opcom.sun.ca:/pub/drivers/dlpi

可以去那里下载资料.

刚才说的那个FTP速度好像比较慢,

这里的快多了:
http://sunsite.lanet.lv/ftp/unix/sun-info/development-tools/

那个dltest.tar.Z,  里面有份postscript文档和sample程序.

03/05/26:    


Q:  我想让js实现类似“上一页”“下一页”“第一、最后。。”等功能。写了个page.js,但有bug,按“下一页”只能翻到第8页,且从最后一页往前翻页码有误!

A by Wooce:  原来的js出问题的原因是因为javascript的parseInt(string, radix) 函数当接收到的字符串string以"0"开头的时候,  并且没有指定radix参数的时候, 它会把string当作8进制来处理,  也就是parseInt("0008.htm")的结果是0而不是8,   就造成了翻到第8页的时候出问题.

解决的方法只要显示指定radix参数就可以了, 
页就是把var Num=parseInt(URL.substring(L-8)) 改为var Num=parseInt(URL.substring(L-8),10)  就可以了,  这样就始终都会按10进制制去转换字符串为数字.


03/06/27: 


Q:   javascript如何获取屏幕分辨率?

A:   
if( screen.width==1024 && screen.height==768 )
              {
                 x=112;
                 y=331;
               }
          else if( screen.width==800 && screen.height==600 )
            {x=...;
             y=...;
            }


03/08/22:  

Q:  WINDOWS有没软件可以访问UNIX上的LDAP?
A by Wooce:   这个不错啊:

http://www.iit.edu/~gawojar/ldap/

java的. 

下载后双击打开lbe.jar即可运行.

前提是你的windows上有javaw.exe, 并且jar文件设定由javaw.exe打开. 


05/3/8:    hackers use google seach engine as hacking tool
http://www.syngress.com/catalog/?pid=3150

The Google Hack Honeypot (GHH) is a reaction to a new type of malicious web traffic:
The GHH Team
http://ghh.sourceforge.net


05/3/9:      02年的时候曾因为多线程程序移植到linux下时,linux并非native的thread, 导致clone出一大堆进程的原因, 研究过IBM的ngpt线程库, 最近注意到原来ngpt已经停止开发, 让位给redhat的nptl了

05/11/24:    
Q:  MyEclipse里Add jsp page, 
这样自动生成的jsp文件的开头是:
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

这样Eclipse会报告:
   File "http://struts.apache.org/tags-bean" not found.

能否让MyEclipse new jsp page的时候自动生成的是以下这样的呢?
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

A:  
编辑 'C:Program FilesMyEclipseeclipsepluginscom.genuitec.eclipse.w
izards_3.9.310TemplatesStruts-1_2.jsp'
和'C:Program FilesMyEclipseeclipsepluginscom.genuitec.eclipse.wizards_3.9.3
10TemplatesStruts2-1_2.jsp'
等就可以了.


05/12/2:
Q:  在redhat AS4 上编译postfix2.0.4, 出现错误: undefined reference to ctype_b"

A: 
(1)"This usually means that there is version skew between your libc6 headers
and the library itself.  Be sure that you have a full matching set of
files. "
(2) This is because libc.so.6 does not have ctype_to_lower, ctype_b, ctype_toupper functions, but ctype_tolower_old etc.
例如在redhat 7上:
[root@localhost /lib]# nm -v libc-2.1.92.so |grep ctype_b
0011c9a0 D __ctype_b
而在redhat as4上:
[root@wooceredhat lib]# nm -v libc-2.3.4.so |grep ctype_b
00022690 T __ctype_b_loc
001265c8 D __ctype_b@GLIBC_2.0


06/05/10:
Q:  如何查找包含文件libstdc++-libc6.2-2.so.3的rpm文件的下载?

A:   去rpm.pbone.net

06/05/15:
Q:  用hibernate + mysql数据库, 出现以下问题:
Communication link failure: java.net.SocketException, underlying cause: Broken pipe: Broken pipe
** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Broken pipe: Broken pipe
STACKTRACE: java.net.SocketException: Broken pipe: Broken pipe
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:116)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1399)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1775)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1109)
at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1070)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2027)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1984)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1152)
A:  
1.  Mysql在经过8小时不使用后会自动关闭已打开的连接,摘录原文如下:
I have a servlet/application that works fine for a day, and then stops working overnight
MySQL closes connections after 8 hours of inactivity. You either need to use a connection pool that handles stale connections or use the "autoReconnect" parameter (see "Developing Applications with MySQL Connector/J").

Also, you should be catching SQLExceptions in your application and dealing with them, rather than propagating them all the way until your application exits, this is just good programming practice. MySQL Connector/J will set the SQLState (see java.sql.SQLException.getSQLState() in your APIDOCS) to "08S01" when it encounters network-connectivity issues during the processing of a query. Your application code should then attempt to re-connect to MySQL at this point.
2.  Should the driver try to re-establish stale or dead connections? If enabled the driver will throw an exception for a queries issued on a stale or dead connection, which belong to the current transaction, but will attempt reconnect before the next query issued on the connection in a new transaction. The use of this feature is not recommended, because it has side effects related to session state and data consistency when applications don'thandle SQLExceptions properly, and is only designed to be used when you are unable to configure your application to handle SQLExceptions resulting from dead andstale connections properly. Alternatively, investigate setting the MySQL wait_timeout system variable to some high value rather than the default of 8 hours.

http://dev.mysql.com/doc/refman/5.0/en/cj-configuration-properties.html

好象用了autoReconnect以后会自动重新连接的
虽然第一次执行失败了,
但是以后会自动重新连接的
3.  在这个页面找到了第三种方法,即不使用Hibernate内置的连接池(Hibernate强烈推荐不使用但我以前一直在用),改用C3P0连接池,这个连接池会自动处理数据库连接被关闭的情况。要使用C3P0很简单,先从Hibernate里把c3p0-0.8.3.jar复制到项目的lib目录中,再在hibernate.properties里去掉hibernate.c3p0开头的那些属性的注释(使用缺省值或自己需要的数值),这样Hibernate就会自动使用C3P0代替内置的连接池了。到目前为止前面的问题没有再出现过。

以前对Hibernate警告不要使用内置连接池作产品用途没有太放在心上,这次是一个教训,所以不论从稳定还是性能的考虑,都应该选择相对更加成熟的连接池。
4.  在服务器上过期的‘Wait—timeout’基本上是服务器给与的强制性网络故障。你通过把‘Wait—timeout’设置的高点儿就可以改正它,尽管如此,作为一个开发者,你的代码应该包含相关的异常处理并采取适当的恢复措施,不要都把它们传到调用堆中。

   连接错误总是有一个SQL状态‘08’。如果你发现它的话,你可以再连接一次并重试事务(如果是适当的话)


   不管什么原因,如果这样不起作用的话,配置你的连接池来测试是否处于连接状态并且那些长时间闲置连接(所有的连接池都能这样做,但是它们的配置取决于池子)。
作者说明:在MYSQL4.1以后的版本当中,没有“wait_timeout”变量,由interactiveClient代替
参考资料:http://dev.mysql.com/doc/connector/j/en/cj-configuration-properties.html

06/06/06:
Q: 在执行一个程序时,出现如下错误:
*** glibc detected *** double free or corruption: 0x0937d008 ***
是怎么回事?
A:  设置MALLOC_CHECK_环境变量再运行程序,呵呵,错误信息消失

MALLOC_CHECK_=0  ./myprogram

红帽企业 Linux 4 提供的 glibc 可以执行附加的内部数据健全检查,从而在尽可能早的时候发现和保护数据被破坏。在默认的情况下,当被破坏的数据被发现时,与以下相似的错误信息会被显示在标准的错误输出上(如果 stderr 没有打开,会被记录在 syslog 中):

*** glibc detected *** double free or corruption: 0x0937d008 ***

在默认的情况下,产生这个错误的程序也会被中止。但是,这(以及是否产生错误信息)可以通过环境变量 MALLOC_CHECK_ 来控制。以下的设置是被支持的:

0 — 不产生错误信息,也不中止这个程序

1 — 产生错误信息,但是不中止这个程序

2 — 不产生错误信息,但是中止这个程序

3 — 产生错误信息,并中止这个程序

备注
如果 MALLOC_CHECK_ 被设置为除 0 以外的值,这会使 glibc 进行更多的检查并可能影响到系统的性能。

06/06/08:

开源的LDAP Server除了OpenLDAP之外, 多了以下其他选择:


1)Apache Directory Server        JAVA写的, 刚起步

2)Fedora Directory Server         Sun给Redhat的

06/08/05:

ls的漏洞: http://dcs.nac.uci.edu/support/sysadmin/security/archive/msg00547.html

文中提到的fileutils的update的rpm包fileutils-4.1-10.4.i386.rpm 在网上已找不到下载。 fileutils-1.0.6.patch.tar.gz也没找到可用的下载。
直接去这里 http://www.gnu.org/software/coreutils/coreutils.html  下载coreutils试试看, 结果在Redhat 上编译不成功(包括7.3和AS4),缺少fshelp.h, 可能需要下载hurd。 到其他目录下载fileutils-4.1 , 编译成功, 编译出来的ls可执行文件的大小(210090)比Redhat原来的ls(46888)大。

06/08/07:

一台Redhat 7.3 Server上在目录下ls找不到当前目录下的*.sh文件, 但ls单个文件例如ls httpd.sh则可以知道httpd.sh还是存在的。


用chkrootkit检查是中了Suckit rootkit ,    搜索sk, 找到在/usr/local/games/sk/ 下面。


cd /usr/local/games/sk/

./sk u

然后下载SysVinit-2.84-2.i386.rpm (在这里找到下载:http://redhat.dulug.duke.edu/pub/redhat/linux/7.3/en/os/i386/RedHat/RPMS/SysVinit-2.84-2.i386.rpm)

从中解出init,  用它覆盖/sbin/init,  重启Server.


last | head -n7 查看到以下记录:


ftp      ftpd7743     162.105.146.202  Wed Aug  9 10:16 - 10:16  (00:00)
ftp      ftpd6184     162.105.146.23   Wed Aug  9 10:15 - 10:15  (00:00)
于是vi /etc/hosts.deny   在其中加入:


all:162.105.146.

然后# /etc/rc.d/init.d/xinetd restart

# /etc/rc.d/init.d/network restart

06/09/08:

Q: 有以下CSS:     input {  border-style: solid; border-color:black; border-width:1; }

在IE和Firefox下显示效果一样, 但在HTML头部加上<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
之后,Firefox和IE下都不正常,变成了加粗的黑框, 如何解决?



A: 如果改成border-width:thin;  则Firefox下正常, 但IE下仍不正常。 改成border-width:1px;   则问题得到彻底解决。

06/11/02:

Q:  servlet server为resin, 用jdbc访问mysql, 出现以下两个问题:
      1)表名大小写有关, 程序里有些sql语句里所写的mysql表名跟实际表名不严格一致的时候 就会说找不到表
      2)从数据库抽取出来的字段值在页面上显示出现中文问题

A:   这是因为在resin.conf里写的链接池资源定义写成了用resin自己的mysql_caucho驱动
<resource-ref>
   <res-ref-name>jdbc/mysql</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <init-param driver-name="com.caucho.jdbc.mysql.Driver"/>
   <init-param url="jdbc:mysql_caucho://202.xxx.x.xx:3306/TestDb"/>
   ......
   <init-param max-connections="20"/>
   <init-param max-idle-time="30"/>
</resource-ref>

改成用那个mysql_uncomp.jar驱动:
<resource-ref>
  <res-ref-name>jdbc/mysql</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <init-param driver-name="org.gjt.mm.mysql.Driver"/>
  <init-param url="jdbc:mysql://202.xxx.x.xx:3306/TestDb"/>
  ......
  <init-param max-connections="20"/>
  <init-param max-idle-time="30"/>
</resource-ref>
就可以了

06/11/23:RESIN的官方网站http://www.caucho.com,发现访问不了,想想人家RESIN这么有名网站不会打不开,上网搜索一下,发现好多人也说打不开,说RESINIP被封,郁闷了。最后在GOOGLE上搜索出下面一段话
resin换ip了,估计ip段正好在国内被封段

用这个地址:
http://caucho.rz.klopotek.de/

06/11/24:
Q:    在Redhat EL4上编译subversion.
./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --with-ssl
编译subversion成功, 但:
[root@localhost ~]# svn co https://svn.sourceforge.net/svnroot/miranda miranda
svn: 不支持 SSL

查看ldd `which svn` | grep -i ssl的输出为空
A: 

You need to compile Subversion with SSL support.


Actually Subversion uses the Neon library, and it's Neon that needs
to have its SSL support enabled. Add "--with-ssl" when you ./
configure Neon.
即编译neon的时候要用./configure --with-ssl , 注意./configure --with-ssl=/usr/local/ssl反而不对, 重新编译neon后再重新编译subversion.
[root@localhost subversion-1.4.2]# ldd `which svn` | grep -i ssl
        libssl.so.4 => /lib64/libssl.so.4 (0x0000003d40000000)
解决!
06/12/27:
Q:  iptables配置怎么加载到自启动里面去?
A:  1.  如果你使用的是Rehat,那就非常简单,编辑/etc/sysct1.conf,将net.ipv4.ip_forward = 0的值改为1,然后直接修改/etc/sysconfig/iptables,将需要的内容添加进去,最后使用redhat的服务器配置,让iptables在开机时自启动。
      2.  你也可以在配置成功以后 用 iptables-save > /etc/sysconfig/iptables 来保存
      3.  service iptables save
07/02/27:
Q:  如何查找当前目录(包括所有递归子目录)的所有可执行文件?
A:  find . -perm 111 ! -type d

Q:  redhat linux AS4下面启动网卡eth0不成功,出现: Device eth0 has different MAC address than expected, ignoring  如何解决?
A:  编辑/etc/sysconfig/network-scripts/ifcfg-eth0 , 把HWADDR= 注释掉,再启动eth0即可。
07/03/19:
Q:  Apache如何支持中文文件名
A:  Apache下支持中文文件名的模块mod_encoding,该模块是一日本人开发的。http://webdav.todo.gr.jp/download/
07/03/20:Q:   如果用javascript判断一URL是否存在?
A: 
            function isExist(sURL) {
               var xmlHttp;
               if (window.ActiveXObject){
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
               }else{
                xmlHttp=new XMLHttpRequest();
               }
               xmlhttp.abort();
               xmlhttp.open("GET",sURL,false);
               xmlhttp.send();
              
               if (xmlhttp.readyState==4) {
                if (xmlhttp.status==200)
                 return true; //成功
                else if (xmlhttp.status==404)
                 return false; // 没有找到
                else if (xmlhttp.status==500)
                 return false; // 服务器错误
                else
                 return false;
               }
              }

07/03/25:        
html的<form...> 里如果有加上: ENCTYPE="multipart/form-data"  
那么用户在<textarea>....</textarea>里键入的回车符可能不能用普通的方法被正确接收,只能接收到第一行的数据,必须用适应文件上传的特殊方法来接收。
07/04/10:
Q: FreeBSD,  SSH远程登陆出现:
"May 7 21:38:26 FreeBSD sshd[595]: error: Could not load
host key: /etc/ssh/ssh_host_dsa_key"
  立刻结束失败
A: 
%ssh-keygen -t dsa
一路回车, 默认有个钥匙对放到了 ~/.ssh/id_dsa
#cp ~/.ssh/id_dsa /etc/ssh/ssh_host_dsa_key
再试,OK

Q:   FreeBSD, 执行/usr/libexec/ftpd,  出现:  "Fatal: Socket operation on non-socket"
A:  这通常意味着在 proftpd.conf 配置文件中 ServerType 指令被配置成 inetd
(超级服务器)方式而不是 standalone(独立服务器) 方式来运行

Q:  FreeBSD, root用户不能SSH登陆?
A:  vi  /ec/ssh/sshd_config
把PermitRootLogin的那个改为yes
07/08/04:
Q: jdk1.6 下载安装Able, 成功
但是打开http://localhost:8080/able-web/
就出现错误信息:
HTTP ERROR: 500
java.util.concurrent.ConcurrentHashMap cannot be cast to sun.misc.SoftCache
RequestURI=/able-web/
A:  编辑com.opensymphony.able.util.I18nFilter.java:
               Class klass = ResourceBundle.getBundle("StripesResources").getClass().getSuperclass();
            Field field = klass.getDeclaredField("cacheList");
            field.setAccessible(true);
            sun.misc.SoftCache cache = (sun.misc.SoftCache)field.get(null);
            cache.clear();
      以上代码是确保读取最新的ResourceBundle的作用, sun.*下的包不推荐使用。把此处的sun.misc.SoftCache改成java.util.concurrent.ConcurrentHashMap就可以了.  另参见这里的讨论: http://forum.java.sun.com/thread.jspa?threadID=343554&messageID=1416986


07/08/16:在Redhat AS5上编译程序,编译出现:

/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../include/c++/4.1.1/i386-redhat-linux/bits/gthr-default.h:102: 错误:‘pthread_mutexattr_settype’ 在此作用域中尚未声明

hack这个错误的出现原因,费了好大的劲,最后知道了是因为我把一处#define __USE_UNIX98 注释掉了, 而没有把另外一处相对应的#undef  __USE_UNIX98 也要相应注释掉,

07/10/6:

Q: 如何在页面里启动打印?

A:

<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0>
</OBJECT>
<input type=button value=打印 onclick=document.all.WebBrowser.ExecWB(6,1)>
<input type=button value=直接打印 onclick=document.all.WebBrowser.ExecWB(6,6)>
<input type=button value=页面设置 onclick=document.all.WebBrowser.ExecWB(8,1)>
<input type=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)>
07/10/24:

Q: 如何在Spring中配置Log4J ?

A: 在web.xml中加入:

    <!--由Spring载入的Log4j配置文件位置-->
     <context-param>
      <param-name>log4jConfigLocation</param-name>
      <param-value>/WEB-INF/classes/log4j.properties</param-value>
     </context-param>

    <!--Spring默认刷新Log4j配置文件的间隔,单位为millisecond-->
     <context-param>
      <param-name>log4jRefreshInterval</param-name>
      <param-value>60000</param-value>
     </context-param>

    <!--Spring log4j Config loader-->
     <listener>
      <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
     </listener>

07/11/21:

Q: [root@web ~]# rpm -e postgresql-libs-8.1.4-1.1
error: "postgresql-libs-8.1.4-1.1" specifies multiple packages
然后rpm -qa, 发现确实有两个postgresql-libs-8.1.4-1.1 , 怎么办

A:  用rpm -e --allmatches postgresql-libs-8.1.4-1.1命令即可删除

07/11/23:

服务器安装优化手记:

1. 编辑/etc/profile, 在最后面加上ulimit -HSn 4096  (增加一个进程能打开的最大文件句柄数,缺省为1024)

2. 设置利用CentOS5的yum库来升级AS5:

(1).删除AS5原来自带的yum, 下载并安装yum-3.0.5-1.el5.centos.2.noarch.rpm文件,下载地址为:
yum-3.0.5-1.el5.centos.2.noarch.rpmftp://ftp.pbone.net/mirror/ftp.centos.org/5.0/os/i386/CentOS/

(2).修改或建立/etc/yum.repos.d/rhel-debuginfo.repo为如下内容:
[base]
name=Red Hat Enterprise Linux $releasever -Base
baseurl=http://ftp.riken.jp/Linux/caos/centos/5.0/os/$basearch/
gpgcheck=1
[update]
name=Red Hat Enterprise Linux $releasever  -Updates
baseurl=http://ftp.riken.jp/Linux/caos/centos/5.0/updates/$basearch/
gpgcheck=1
[extras]
name=Red Hat Enterprise Linux $releasever  -Extras
baseurl=http://ftp.riken.jp/Linux/caos/centos/5.0/extras/$basearch/
gpgcheck=1
[addons]
name=Red Hat Enterprise Linux $releasever -Addons
baseurl=http://ftp.riken.jp/Linux/caos/centos/5.0/addons/$basearch/
gpgcheck=1

(3).修改或建立/etc/yum.repos.d/dag.repo为如下内容:

[dag]
name=Dag RPM Repository for RHEL5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt

(4)

添加rpmforge一个源:
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

vi /etc/yum.repos.d/be10.repo
添加以下内容:
[base]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=http://mirror.be10.com/centos/5.2/os/$basearch/
gpgcheck=0
[update]
name=Red Hat Enterprise Linux $releasever  -Updates
baseurl=http://mirror.be10.com/centos/5.2/updates/$basearch/
gpgcheck=0
[extras]
name=Red Hat Enterprise Linux $releasever  -Extras
baseurl=http://mirror.be10.com/centos/5.2/extras/$basearch/
gpgcheck=0
[addons]
name=Red Hat Enterprise Linux $releasever -Addons
baseurl=http://mirror.be10.com/centos/5.2/addons/$basearch/
gpgcheck=0


安装lighttpd:

需要自己手工创建/etc/lighttpd 目录, 然后自己把lighttpd.conf拷贝进去。

lighttpd.conf里加上:

proxy.server = (
".jsp" => ( ( "host" => "127.0.0.1", "port" => 8080 )) ,
".do" => ( ( "host" => "127.0.0.1", "port" => 8080 ))
)
同时要在server.modules里面加上mod_proxy


07/11/24:

Q: Resin经常因为.jsp里含有不合法的UTF-8字符而不能正确解析这个jsp, 郁闷.

08/03/08:

发现ECSide列表组件会导致以div+css定位的页面在IE6下出现显示错误。

花了一个多小时调试,发现是ecside_style.css里面

.ecSide .toolbar {
  border :1px solid #aac0dd;
把这里的solid去掉, 就显示正常了。 比较古怪。

08/05/28:

Q: 在windows下gem install postgres不成功,错误信息:

ERROR:  Error installing postgres:
        ERROR: Failed to build gem native extension.

E:/InstantRails-2.0/ruby/bin/ruby.exe extconf.rb install postgres
checking for main() in /ms/libpq.lib... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

A:

* prerequisites
** MS Visual C++ compiler (I used version 8 successfully) (Free version available as MS Visual Studio Express)
** MS Windows Platform SDK (Available on MS website)
* installation
*1 download postgres sources from https://rubyforge.org/projects/ruby-pg/
*2 The lib postgres is looking for by default is wrongly named, here you have 2 solutions:
*3 Either: Edit extconf.rb and change have_library('pq.lib') to have_library('ms/libpq.lib')
*4 Or: copy $PGSQLDIR/lib/ms/libpq $PGSQLDIR/lib/pq.lib
*5 if you use a VC different than VC6, then comment or remove the following line from config.h found in $RUBY_HOME/lib/ruby/1.8/i386-mswin32/config.h
*#: #if _MSC_VER != 1200
*#: #error MSC version unmatch
*#: #endif
*# Open a terminal and load the VC environment vars: C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat
*6 load the SDK environment vars (apparently there is a script for this too but I failed to find it. If you fail, like me you'll need to add a few options, see below)
*7* If you succeeded in loading the SDK env. vars: run ''ruby extconf.rb --with-pgsql-dir=$YourPGSQLDIR''
*8* Otherwise run ''ruby extconf.rb --with-pgsql-dir=$YourPGSQLDIR --with-opt-lib=$PathToSDK/lib ---with-opt-include=$PathToSDK/lib''
*9 run ''nmake''
*10 embed the manifest into the library: ''mt.exe -manifest postgres.so.manifest -outputresource:postgres.so;2''
*11 run ''nmake install''
* NOTES:
** Useful resources:
*** Explains everything in details on how to compile a ruby c extension on windows (totally saved me): http://blogs.law.harvard.edu/hoanga/2006/12/14/getting-a-ruby-c-extension-to-compile-on-windows/
*** Chats of other users running into troubles with a few pointers: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/165404
** About path names in windows: The commands you type shouldn't have any spaces in the paths. To get the 8char name for a folder in windows, use ''dir /x''


Two quick notes:
1. Sorry for the formatting, it's wiki-formatting
2. About point *3, I it be a really quick fix to do in the extconf.rb to get this straight for windows user...


08/06/25:

Q: scp不支持断点续传,怎么解决?

A:  用rsync -avzP即可断点续传文件到远程服务器上,关键是这里的-P选项  -P = -partial -progress

Q: 解决 libXp.so.6 找不到的问题

A: 一般服务器上都不装X环境的,不过有些变态的程序却要用到X环境的组件:比如java写的Tidy,oracle的安装程序。一般遇到这种情况,偷懒的人都直接rpm或apt-get到libXp.so.6来装。不过我喜欢什么都在自己的掌握中,不喜欢装到哪都不知道的感觉(Slackware甚至不支持rpm,我太欣赏了)。其实libXp.so.6只是XFree86的一个很小的库,根本没必要装整个X。自己动手,乐趣多多的解决办法:
lynx http://ftp.xfree86.org/pub/XFree86/
1)到 http://ftp.xfree86.org/pub/XFree86/,找到最新版本点进去,现在是4.7.0。
2)如果对自己系统不熟悉,可以先下个Xinstall.sh。然后运行 sh Xinstall.sh -check
他会告诉你下哪个编译好的版本适合你的系统。我的是"Linux-x86_64-glibc25″。
然后点binaries进去,不研究源码,只是拿来用,就下预编译的好了。接着点“Linux-x86_64-glibc25”。
3)这有很多tar,注意:你只要下Xbin.tgz就够了(现在是7.3M)
4)mkdir /usr/X11
5)tar zxf Xbin.tgz -C /usr/X11
6)vi /etc/ld.so.conf,加入/usr/X11/lib,对于64位的系统则是/usr/X11/lib64
7)ldconfig
完毕。

08/07/09:

Q: rhel5下运行yum , 出现以下错误信息:
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
如何解决?

A: 首先locate bin/python, 查找python版本,发现/usr/bin/python和/usr/local/bin/python, 前者为安装rhel5时已有的python2.4, 后者为后来自己手工装的python2.5 ,  /usr/local/bin下的可执行文件比/usr/bin/下的优先执行,所以执行python的时候是执行python2.5, 于是删除了/usr/local/bin/python, 改为python2.4,但运行yum问题依旧。

08/08/27:

Q: 在 64位linux 系统下载装 apache , 在 make 的时候出现如下错误
/usr/lib/libexpat.so: could not read symbols: File in wrong format
A by Wooce:  在64位的系统上编译时需要链接64位的库文件,而/usr/lib/libexpat.so是32位的ELF格式,所以格式不对。在configure的时候添加LDFLAGS="-L/usr/lib64 -L/lib64" 选项即可

08/09/01:

Q: Powerdesigner中不能定义主键?
A: Tools-->Model Options-->Data Item 的unique code去除勾选

09/02/01:
Q: './mysql-bin.index' not found (Errcode: 13) 的解决方法
A: (1)到数据库根目录查看该文件是存在的,可能是文件权限的问题,查看了数据库根目录的权限是700,所有者和用户组都是root,可能是上次转移数据库的时候不小心修改了文件夹的权限。
解决方法:
chgrp -R mysql ./var && chown -R mysql ./var  (这里数据库根目录为/*****/var)
   (2)打开my.cnf,检查里面的datadir = ... 的目录路径设置,再如前面的(1)检查其权限。
1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics