生活的一半是遇到问题,另一半是解决问题
问题也许很简单,但问题毕竟是问题
1、xNix下Apache 2.2启动
guoh@KNIGHT:~/apps/volcano/apache/bin$ ./apachectl -k start
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
只需要以$sudo ./apachectl -k start运行即可,没有别人写的那样复杂,httpd的own和group也不需要都为root用户
http://callaly.net/blog/archives/94.html
2、Perl的DateTime模块装不上
perl install-module.pl DateTime
CPAN.pm: Going to build D/DR/DROLSKY/DateTime-0.66.tar.gz
Can’t locate Module/Build.pm in @INC (@INC contains: /home/allcom/volcano/bugzilla-4.0/lib/i386-linux-thread-multi /home/allcom/volcano/bugzilla-4.0/lib /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at Build.PL line 5.
BEGIN failed–compilation aborted at Build.PL line 5.
Warning: No success on command[/usr/bin/perl Build.PL ]
DROLSKY/DateTime-0.66.tar.gz
/usr/bin/perl Build.PL — NOT OK
Skipping test because of notest pragma
Running Build install
Make had some problems, won’t install
Could not read metadata file. Falling back to other methods to determine prerequisites
我是在安装Bugzilla的时候碰上的,解决办法是先装perl install-module.pl DateTime::Locale这个
3、Undefined subroutine &Math::Random::Secure::irand called at Bugzilla/Util.pm line 577, line 522.
解决办法是rm -rf lib/Math/Random/Secure*,这个目录是Bugzilla下的目录,这个是从推特上看来的
4、64位Ubuntu安装Android SDK后执行adb emulator之类的命令时提示“No such a file or directory”,中文“没有那个文件或目录”
有可能是没有安装ia32-libs,所以只需要sudo apt-get install ia32-libs应该就可以
5、Can’t update table ‘tablek’ in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
触发器通过UPDATE语句更新本表刚刚插入或者修改的数据会造成循环引用
下面这样写就可以,相当于一个拦截器,AOP之类的思想吧
CREATE trigger insert_before_tablek before insert on tablek for each row begin set new.status = 25; end
6、/bin/bash: AR@:找不到命令
编译安装SysBench-0.4.12
sudo ./configure –prefix=SYSBENCH_INSTALLATION_HOME –with-mysql-includes=MYSQL_INSTALLATION_HOME/include –with-mysql-libs=MYSQL_INSTALLATION_HOME/lib
sudo make
前面遇到的几个小问题都解决了,但遇到个新的问题
Making all in mysql
make[3]: 正在进入目录 `/home/aristel/sysbench-0.4.12/sysbench/drivers/mysql’
rm -f libsbmysql.a
/bin/bash: AR@:找不到命令
make[3]: *** [libsbmysql.a] 错误 127
make[3]:正在离开目录 `/home/aristel/sysbench-0.4.12/sysbench/drivers/mysql’
make[2]: *** [all-recursive] 错误 1
make[2]:正在离开目录 `/home/aristel/sysbench-0.4.12/sysbench/drivers’
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/home/aristel/sysbench-0.4.12/sysbench’
make: *** [all-recursive] 错误 1
AR@找不到命令,这个感觉有可能是Make脚本中参数或什么没有替换对什么的,但不知道怎么改,看不懂Makefile
机器中目前ar命令是存在的
目前没有找到解决办法
7、MySQL类似这种语句写法SELECT value FROM paras WHERE pkey = ‘freeze’ AND domain = domain;
create table paras (value varchar(50), pkey varchar(50), domain varchar(50));
这个问题浪费了我很不少时间,因为在Linux下面,又是在存储过程中,并且是封装了异常的存储过程中,异常信息被吞掉了
调试工具也不给力,所以基本是人工看的
CREATE PROCEDURE tdemo(domain VARCHAR(50)) BEGIN DECLARE v_value VARCHAR(50); SELECT value FROM paras WHERE pkey = 'freeze' AND domain = domain INTO v_value; END
这个过程编译通过,执行的时候报了下面的错误
ERROR 1172 (42000): Result consisted of more than one row
想想也知道是返回了多条数据到INTO,这是错误的
但为什么会返回多条数据呢?明明后面限制了
问题就处在存储过程的那个入参domain上,它和表的一个字段名一模一样的了
这时候MySQL就认为这两个始终相同,于是语句变成了下面这样子
SELECT value FROM paras WHERE pkey = 'freeze';
所以就错了
存储过程中变量命名也是值得考究的一个问题,当存储过程太长了时候是件很痛苦的事情
有人这么做
入参变量加IN_前缀
出参变量加OUT_前缀
零时变量加TMP_前缀
整形变量加I_前缀
字符串变量加S_前缀
时间日期变量加D_前缀
另外为了简单,避免出错,参数不要和字段一模一样
8、Java连接SQLServer,不说了,直接上最新驱动
时隔多年不碰SQLServer,突然要偶弄SQLServer存储过程,还给了偶三个最老的JAR包
连接池一上,错误警告百出,坑爹啊
直接下载新版驱动
http://msdn.microsoft.com/zh-cn/data/aa937724.aspx
然后设置,新驱动的连接串不一样
http://blogs.msdn.com/b/jdbcteam/archive/2007/06/15/java-lang-classnotfoundexception-com-microsoft-jdbc-sqlserver-sqlserverdriver.aspx
貌似驱动还有中英文的区分,我中文数据库随便用了个英文的好像也可以
如下列举的是可能出现的问题:
com.microsoft.jdbc.sqlserver.SQLServerConnection@9980d5 threw an Error when we tried to check its default holdability. This is probably due to a bug in your JDBC driver that c3p0 can harmlessly work around (reported for some DB2 drivers). Please verify that the error stack trace is consistentwith the getHoldability() method not being properly implemented, and is not due to some deeper problem. This message will not be repeated for Connections of type com.microsoft.jdbc.sqlserver.SQLServerConnection that provoke errors of type java.lang.AbstractMethodError when getHoldability() is called.
和C3P0一起用的时候
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid parameter binding(s).
还有诸如什么切换语言之类的警告
9、在Ubuntu使用Wireshark时,Interface为空的,什么都没有
dumpcap: There are no interfaces on which a capture can be done
需要用root权限开启这个软件就好,即sudo
其他Linux应该也如此