“技术”目录存档

win7 VMware 7.0下centos不能上网

2010年08月21日,星期六

之前的CentOS是xp和VMware下安装的,上网等功能一切正常,但后来装了win7后上网功能出现了问题
情况如下:
-> win7 ping不通虚拟机下CentOS
-> CentOS 能ping win7和外网,但是不能浏览网页
-> 在win7下,用putty也访问不了CentOS
-> win7, CentOS的防火墙都关了

后来发现原来是安装的瑞星防火墙的原因, 改变相应的设置,或直接把瑞星防火墙关掉就可以了

install_driver(Oracle) failed: Can’t load `…/DBD/Oracle/Oracle.so’ for module DBD::Oracle

2010年04月15日,星期四

Description

This section is from the "Practical mod_perl " book, by Stas Bekman and Eric Cholet . Also available from Amazon: Practical mod_perl

Here’s an example of the full error report that you might see:

install_driver(Oracle) failed: Can't load

'/usr/lib/perl5/site_perl/5.6.1/i386-linux/auto/DBD/Oracle/Oracle.so'

for module DBD::Oracle:

libclntsh.so.8.0: cannot open shared object file: 

No such file or directory at

/usr/lib/perl5/5.6.1/i386-linux/DynaLoader.pm line 169.

at (eval 27) line 3

Perhaps a required shared

library or dll isn't installed where expected at 

/usr/local/apache/perl/tmp.pl line 11


 

On BSD-style filesystems, LD_LIBRARY_PATH is not searched for setuid programs. If Apache is a setuid executable, you might receive this error. Therefore, the first solution is to explicitly load the library from the system-wide ldconfig configuration file:

panic# echo $ORACLE_HOME/lib >> /etc/ld.so.conf

panic# ldconfig

(使用该方法我的问题就解决了)

Another solution to this problem is to modify the Makefile file (which is created when you run perl Makefile.PL ) as follows:

  1. Search for the line LD_RUN_PATH=

  2. Replace it with LD_RUN_PATH=my_oracle_home/lib

where my_oracle_home is, of course, the home path to your Oracle installation. In particular, the file libclntsh.so.8.0 should exist in the lib subdirectory.

Then just type make install , and all should go well.

Note that setting LD_RUN_PATH has the effect of hardcoding the path to my_oracle_home/lib in the file Oracle.so , which is generated by DBD::Oracle . This is an efficiency mechanism, so that at runtime it doesn’t have to search through LD_LIBRARY_PATH or the default directories used by ld.

For more information, see the ld manpage and the essay on LD_LIBRARY_PATH at http://www.visi.com/~barr/ldpath.html .

Perl String Comparison Operators

2010年04月6日,星期二

In order to compare for string equality, or if one string is alphabetically bigger than another, you can use the six string comparison operators. Here are the string operators together with the numerical operators they correspond too:

String Operator Numerical Operator
eq ==
ne !=
gt >
lt <
ge >=
le <=

Notice that the string operators are built from the initials of their abbreviated names. (E.g: eq = equal, gt = greater than). Perl’s string comparison is case-sensitive. If you want a case insensitive string comparison, use the lc function to convert the strings to lowercase beforehand.

Do not throw exception in exception_handler function and __destruct without try-catch

2010年03月31日,星期三
Do NOT throw exception in exception_handler function, if you do it like below, 
the error “Fatal error: Exception thrown without a stack frame in Unknown on line 
0” will occur
set_exception_handler('handle_exception');
function handle_exception($e)
{
    throw new Exception('throwed in handle_exception');
}
throw new Exception('error occur');

if you try-catch the Exception in exception_handler function, it will be ok, the below code will work well

set_exception_handler('handle_exception');
function handle_exception($e)
{
    try {
        throw new Exception('throwed in handle_exception');
    }
    catch (Exception $e) {
        die('catch exception in handle_exception function');
    }
}
throw new Exception('error occur');
Do NOT throw Exception in __destruct like below, or “Fatal error: Exception thrown
without a stack frame in Unknown on line 0” will occur.
class Test {
    function __construct () {}
    function __destruct() {
        throw new Exception('throwed in __destruct');
    }
}
$test = new Test();

but it will work well when try-catch it like below

class Test {
    function __construct () {}
    function __destruct() {
        try {
            throw new Exception('throwed in __destruct');
        }
        catch (Exception $e) {
            die('catch exception in __destruct');
        }

    }
}
$test = new Test();

在windows下用wingrub安装backtrack 4 final双系统

2010年03月19日,星期五

在windows操作系统下利用wingrub安装backtrack 4 final,不需要你另外的磁盘分区、U盘.

下面讲一下安装过程

1. 安装WinGrub/Grub4DOS

http://sourceforge.net/projects/grub4dos/ 下载,然后安装,安装好了之后,打开wingrub, 点击Tools/Install Grub, 选择BOOT.ini, 填入”Back Track 4 Final”到Title, 再点击 Install, 这时会自动拷贝GRLDR 到c:\ ,还会创建c:\grub文件夹.

2. 从bt4-final.iso里拷贝/casper and /boot 到c:\

3. 修改C:\boot\grub\menu.lst. 当你打开文件时已经有一些内容, 但没有find –set-root /GRLDR这句话,所以应该加上。

最终内容应该为:<!– more –>

# By default, boot the first entry.
default 0

# Boot automatically after 30 secs.
timeout 10

splashimage=/boot/grub/bt4.xpm.gz

title BackTrack4 Pre Final Persistant USB
find –set-root /GRLDR
kernel /boot/vmlinuz BOOT=casper boot=casper persistent rw vga=0×317
initrd /boot/initrd.gz

title BackTrack4 Pre Final USB
find –set-root /GRLDR
kernel /boot/vmlinuz BOOT=casper boot=casper nopersistent rw vga=0×317
initrd /boot/initrd.gz

title BackTrack4 Forensics USB (no swap)
find –set-root /GRLDR
kernel /boot/vmlinuz BOOT=casper boot=casper nopersistent rw vga=0×317
initrd /boot/initrdfr.gz

title BackTrack4 in Text Mode USB
find –set-root /GRLDR
kernel /boot/vmlinuz BOOT=casper boot=casper nopersistent textonly rw quiet
initrd /boot/initrd.gz

title BackTrack Graphical Mode from RAM USB
find –set-root /GRLDR
kernel /boot/vmlinuz BOOT=casper boot=casper toram nopersistent rw quiet
initrd /boot/initrd.gz

title Memory Test
find –set-root /GRLDR
kernel /boot/memtest86+.bin

title Boot the First Hard Disk
root (hd0,0)
chainloader +1

4. 重起电脑, 这时可选择Back Track 4 Final进入系统。进入时会显示loading and wait, 时间比较久(有时我随便输入一些文字,就马上就可以了, 你也可以试一下)