Apr 20

linux — how to extract tar ball file to specified folder

by default,tar will extract all the file to the current working directory.if you don’t want to change current working directory,then you can extract the tar ball’s content to specified folder by the -C command option of tar command.

this command will change the current working directory before tar extract the content.

Apr 19

putty — how to run putty without define a session

how to run putty without define a session? yes,you can run putty from command without any session.

Putty is very convenient if you like to work on ssh but you are working on window desktop.Putty can save host’s ip,login account and some other info as session.With the help of session,you save a lot of time.However,you will need to define those session if you move to a new computer.As putty save all session in the window registry,not as text file which can be copied to other computer.yes,you can export all the session from the window registry.

I prefer to run putty in command mode,without any session defined.PuTTY can be made to do various things without user intervention by supplying command-line arguments.

for example,the following command will login into the server as root user via ssh protocol,connect to the 5880 port of the remote server with ip 7x.8x.17x.16x.it also set up SOCKS-based dynamic port forwarding on a local port 30000,which i usually used as my firefox  proxy setting.

putty -ssh -P 5880 -pw bdKde?pNrfym  -D 30000 root@7x.8x.17x.16x

let me explain the option in detail:

-ssh specified the protocol to use

-P  set the remote port to connect to

-pw this option used to set the password

-D set up local port for SOCKS-based dynamic port forwarding

Apr 18

linux — how to list all files of a package installed by yum

yum is very helpful to install package.however,they are so many package from different repository with different kinds of configuration.for example, to install apache web server,there are a lot of package around the internet but each come with different file structure and configuration.To change the default setting,you need to find out the files where the package installed to first.so how to show all the files installed by yum?

in fact,yum is based upon rpm,so to list all file of a package,you can use the following command:

rpm -ql [package name]


rpm -ql php
rpm -ql httpd
rpm -ql httpd|more


Apr 17

zen cart — HTMLarea editor not worked with some language

It’s bad news.I just found that HTMLarea not worked in some language,ie danish,swedish.When i turn on HTMLarea editor from the zen cart backend for one of my website,then i found the HTMLarea not show in the product edit page.

With the help of Web developer(firefox addon), i found the HTMLarea editor need to load htmlarea/lang/sv.js when the site default language is swedish.but the sv.js is not existed at all.that’s why the editor not work.

form the js file path htmlarea/lang/sv.js,i guess the js file located in the subfolder lang are used to store translation for the HTMLarea.so i excute the following command:

cd htmlarea/lang

cp en.js sv.js

after refresh the zen cart product edit page,the editor’s toolbar show out.This solution worked for all the other language that’s not supported by HTMLarea by default.The files under lang subfolder are usded to store tool tips for the corresponding language.


Apr 16

zen cart — how to turn on HTMLarea editor from the backend

You need an WYSIWYG editor to edit the product for example to insert a link to the product description. Without an editor, you will need to edit it somewhere else(ie. macromedia) and then copy / paste it to the zen cart backend.that’s really no good.

Don’t be too frustrated,however.Zen cart come with an WYSIWYG editor – HTMLarea.The only thing you need to to is to turn on it so that you can use it  in the product edit page.How to turn on the HTMLarea editor from the zen cart backend?

first,log into you zen cart website backend with the admin acct and password,

second, navigate to Configuration — My Store,in this page,find the “HTML Editor” configuration item(usually sencond to the last item)

thrid, edit the “HTML Editor”  , choose the ‘htmlarea’ option and save.

then go back to the product edit page,you will see the htmlarea editor.

Mar 07

linux — install iftop in cent os

iftop is similar as top.top was used to show usage on cpu but iftop show statics on network stream.

 [~]# wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
–2012-09-07 05:01:03–  http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
Resolving www.ex-parrot.com…
Connecting to www.ex-parrot.com||:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 160381 (157K) [application/gzip]
Saving to: `iftop-0.17.tar.gz’

100%[===================================================================================================================>] 160,381      215K/s   in 0.7s

2012-09-07 05:01:04 (215 KB/s) – `iftop-0.17.tar.gz’ saved [160381/160381]

[~]# tar -xvzf iftop-0.17.tar.gz

[~]# cd iftop-0.17

[~/iftop-0.17]# ./configure
checking for library containing gethostbyaddr_r… none required
checking how to call gethostbyaddr_r… 8 args, int return
checking gethostbyaddr_r usability… yes
checking where to find pcap.h… no idea
configure: error: can’t find pcap.h
You’re not going to get very far without libpcap.

[~/iftop-0.17]# yum install libpcap
[~/iftop-0.17]# yum install libpcap-devel.x86_64

Running Transaction
Installing     : libpcap                                                                                                                               1/1

libpcap.i386 14:0.9.4-15.el5

[~/iftop-0.17]# ./configure –with-libpcap=/usr
[~/iftop-0.17]# make


Posted in php