Saturday, October 17, 2009
Friday, October 16, 2009
php memcache
1. install memcached
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rpm --install rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
Or
http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm --install rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum install --enablerepo=rpmforge memcached
2. download memcache.php
wget http://livebookmark.net/memcachephp/memcachephp.zip
3. start memcache
service memcached restart
/usr/local/bin/memcached -d -u root -m 512
Reference:
http://www.howtoforge.com/php_memcache_centos5.0
http://www.nioxiao.com/php-memcached
http://www.ibm.com/developerworks/cn/opensource/os-php-fastapps3/index.html
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rpm --install rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
Or
http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm --install rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum install --enablerepo=rpmforge memcached
2. download memcache.php
wget http://livebookmark.net/memcachephp/memcachephp.zip
3. start memcache
service memcached restart
/usr/local/bin/memcached -d -u root -m 512
Reference:
http://www.howtoforge.com/php_memcache_centos5.0
http://www.nioxiao.com/php-memcached
http://www.ibm.com/developerworks/cn/opensource/os-php-fastapps3/index.html
Sunday, October 11, 2009
smtp receive mail error
ERROR:
(reason: 553 5.3.5 system config error)
config error: mail loops back to me (MX problem?)
554 5.3.5 Local configuration error
Diagnostic-Code: SMTP; 553 5.3.5 system config error
SOLUTION:
If it is Sendmail that you're using, then you should be able to just edit the /etc/mail/local-host-names file and add your domain names that the MTA should recognize as being its self.
REFERENCE:
http://www.webdeveloper.com/forum/showthread.php?t=173882
open webmail
(reason: 553 5.3.5 system config error)
config error: mail loops back to me (MX problem?)
554 5.3.5 Local configuration error
Diagnostic-Code: SMTP; 553 5.3.5 system config error
SOLUTION:
If it is Sendmail that you're using, then you should be able to just edit the /etc/mail/local-host-names file and add your domain names that the MTA should recognize as being its self.
REFERENCE:
http://www.webdeveloper.com/forum/showthread.php?t=173882
open webmail
Thursday, September 17, 2009
config smtp server using sendmail
service saslauthd restart
service sendmail restart
PHPMailer
http://sourceforge.net/projects/phpmailer/files/
redhat下的sendmail+smtp 的配置
http://www.myfaq.com.cn/2005September/2005-09-13/198608.html
用Sendmail配置你的第一台e-mail服务器
http://www.5dmail.net/html/2004-10-26/20041026133839.htm
Configuring Linux Mail Servers
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch21_:_Configuring_Linux_Mail_Servers
service sendmail restart
PHPMailer
http://sourceforge.net/projects/phpmailer/files/
redhat下的sendmail+smtp 的配置
http://www.myfaq.com.cn/2005September/2005-09-13/198608.html
用Sendmail配置你的第一台e-mail服务器
http://www.5dmail.net/html/2004-10-26/20041026133839.htm
Configuring Linux Mail Servers
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch21_:_Configuring_Linux_Mail_Servers
Sunday, September 13, 2009
setup Chinese Font in Nokia E75
1. get a cer file and "DOSPY SignTool v2.2.9.0627.exe" from http://cer.dospy.com/
2. get FontRouter.LT.for.v9.Build20071109.unsigned.sis
3. use the cer file sign FontRouter get Administrator_Signed_FontRouter.LT.for.v9.Build20071109.sisx
4. setup FontRouter on E75
5. copy Simsun Nina ZL by Loname.ttf to E:/data/fonts
6. restart E75
http://www.mitbbs.com/clubarticle/smartphone/30994727_0.html
http://www.dospy.com/bbs/thread-4550277-1-1.html
2. get FontRouter.LT.for.v9.Build20071109.unsigned.sis
3. use the cer file sign FontRouter get Administrator_Signed_FontRouter.LT.for.v9.Build20071109.sisx
4. setup FontRouter on E75
5. copy Simsun Nina ZL by Loname.ttf to E:/data/fonts
6. restart E75
http://www.mitbbs.com/clubarticle/smartphone/30994727_0.html
http://www.dospy.com/bbs/thread-4550277-1-1.html
Thursday, September 10, 2009
createElement('div').innerHTML
function fnGetId(){
var aa = document.getElementById('aa');
alert(aa.innerHTML);
var bb = document.createElement('div');
bb.innerHTML = '
aa.insertBefore(bb, aa.firstChild);
alert(aa.innerHTML);
}
to easy use element.innerHTML, you should document.createElement('div'), but not document.createElement('p');
var aa = document.getElementById('aa');
alert(aa.innerHTML);
var bb = document.createElement('div');
bb.innerHTML = '
bb
';aa.insertBefore(bb, aa.firstChild);
alert(aa.innerHTML);
}
to easy use element.innerHTML, you should document.createElement('div'), but not document.createElement('p');
Thursday, August 13, 2009
license server of simics
export LM_LICENSE_FILE=/opt/virtutech/simics-3.0.31/licenses/simics.lic
lmgrd &
lmgrd &
Thursday, July 23, 2009
Tuesday, July 21, 2009
coustom sql query on propel
$dbMap = Propel::getDatabaseMap();
$con = Propel::getConnection();
$sql = 'xxx sql query...';
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
return XXXPeer::populateObjects($rs);
$con = Propel::getConnection();
$sql = 'xxx sql query...';
$stmt = $con->prepareStatement($sql);
$rs = $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
return XXXPeer::populateObjects($rs);
Monday, July 13, 2009
get google search result
http://code.google.com/intl/zh-CN/apis/ajaxsearch/documentation/
$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=Paris%20Hilton";
// sendRequest
// note how referer is set manually
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://www.mysite.com/index.html");
$body = curl_exec($ch);
curl_close($ch);
// now, process the JSON string
$json = json_decode($body);
// now have some fun with the results...
Wednesday, July 8, 2009
sort links on wordpress
wp_list_bookmarks($args = '') {
$defaults = array(
'orderby' => 'rating'
Change the orderby parameter in function wp_list_bookmarks.
$defaults = array(
'orderby' => 'rating'
Change the orderby parameter in function wp_list_bookmarks.
Monday, June 15, 2009
Thursday, June 11, 2009
bind & named DNS service
http://zh.linuxvirtualserver.org/node/695
http://hi.baidu.com/it0820/blog/item/d37cb7021b7e677f3812bb8e.html
http://blog.csdn.net/orapeasant/archive/2007/09/26/1801395.aspx
http://hi.baidu.com/it0820/blog/item/d37cb7021b7e677f3812bb8e.html
http://blog.csdn.net/orapeasant/archive/2007/09/26/1801395.aspx
Friday, June 5, 2009
SimFlex changing for Sparc+Linux
/opt/virtutech/flexus-3.0.0/components/DecoupledFeeder/SimicsTracer.cpp
line 389
//DBG_Assert(false);
/opt/virtutech/flexus-3.0.0/core/simics/mai_api.hpp
line 386
//DBG_Assert(false);
/opt/virtutech/flexus-3.0.0/core/simics/sparcmmu.cpp
line 1297
FM_COPY_LIST_FROM_SIMICS
/opt/virtutech/flexus-3.0.0/components/uArch/CoreModel/cycle.cpp
line 1321
//DBG_Assert( getTL() + 1 < 5, ( << theName << " Trap when TL == 5. Processor enters RED_state. Unsupported." ) );
line 389
//DBG_Assert(false);
/opt/virtutech/flexus-3.0.0/core/simics/mai_api.hpp
line 386
//DBG_Assert(false);
/opt/virtutech/flexus-3.0.0/core/simics/sparcmmu.cpp
line 1297
FM_COPY_LIST_FROM_SIMICS
/opt/virtutech/flexus-3.0.0/components/uArch/CoreModel/cycle.cpp
line 1321
//DBG_Assert( getTL() + 1 < 5, ( << theName << " Trap when TL == 5. Processor enters RED_state. Unsupported." ) );
Wednesday, May 20, 2009
host ip file
Windows 95/98/Me c:\windows\hosts
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts
Windows XP Home c:\windows\system32\drivers\etc\hosts
Linux (/etc/hosts)
Tuesday, May 19, 2009
create multiple IP for one net card
ifconfig eth0:0 xx.xx.xx.xx netmask xx.xx.xx.xx
Reference:
http://publish.it168.com/2005/0925/20050925041401.shtml
Reference:
http://publish.it168.com/2005/0925/20050925041401.shtml
Monday, May 18, 2009
create a scsi disk on Simics
1. create a image file
craff --decompress -o mydisk.img mydisk.craff
2. edit machine config file
$scsi_disk2 = (create-std-scsi-disk scsi_id = 2 size = $disk_size)
$scsi_bus.connect $scsi_disk2
@image2 = sim.objects[simenv.scsi_disk2].object_list['sd_image']
@image2.files = [["/mnt/sdb1/simics_image/mydisk.img", simenv.disk_perm, 0, simenv.disk_size]]
4. create partition on new disk
fdisk /dev/sdb
5. format new disk
mkfs.ext3 /dev/sdb1
5. mount new disk
mount /dev/sdb1 /mnt/sdb1
craff --decompress -o mydisk.img mydisk.craff
2. edit machine config file
$scsi_disk2 = (create-std-scsi-disk scsi_id = 2 size = $disk_size)
$scsi_bus.connect $scsi_disk2
@image2 = sim.objects[simenv.scsi_disk2].object_list['sd_image']
@image2.files = [["/mnt/sdb1/simics_image/mydisk.img", simenv.disk_perm, 0, simenv.disk_size]]
4. create partition on new disk
fdisk /dev/sdb
5. format new disk
mkfs.ext3 /dev/sdb1
5. mount new disk
mount /dev/sdb1 /mnt/sdb1
Thursday, May 7, 2009
simics profiling cache miss
./simics -stall targets/sunfire/walnut-common.simics
list-components
list-modules
list-objects
cache_cpu0.add-profiler type = data-read-miss-per-instruction
cache_cpu0.add-profiler type = data-write-miss-per-instruction
c 10000000
r
cache_cpu0.statistics
cache_cpu0_prof_data_read_miss_per_instruction.address-profile-data
http://youngdean.spaces.live.com/blog/cns!C9DCEEC5C7C0B32F!619.entry
http://youngdean.spaces.live.com/blog/cns!C9DCEEC5C7C0B32F!640.entry
http://youngdean.spaces.live.com/blog/cns!C9DCEEC5C7C0B32F!641.entry
list-components
list-modules
list-objects
cache_cpu0.add-profiler type = data-read-miss-per-instruction
cache_cpu0.add-profiler type = data-write-miss-per-instruction
c 10000000
r
cache_cpu0.statistics
cache_cpu0_prof_data_read_miss_per_instruction.address-profile-data
http://youngdean.spaces.live.com/blog/cns!C9DCEEC5C7C0B32F!619.entry
http://youngdean.spaces.live.com/blog/cns!C9DCEEC5C7C0B32F!640.entry
http://youngdean.spaces.live.com/blog/cns!C9DCEEC5C7C0B32F!641.entry
Tuesday, May 5, 2009
submit and update sitemap.xml to Google
http://www.google.com/support/webmasters/bin/answer.py?answer=34609
To resubmit your Sitemap using an HTTP request:
- Issue your request to the following URL:
www.google.com/webmasters/tools/ping?sitemap=sitemap_url
For example, if your Sitemap is located at http://www.example.com/sitemap.gz, your URL will become:
www.google.com/webmasters/tools/ping?sitemap=http://www.example.com/sitemap.gz
- URL encode everything after the /ping?sitemap=:
www.google.com/webmasters/tools/ping?sitemap=http%3A%2F%2Fwww.yoursite.com%2Fsitemap.gz
- Issue the HTTP request using wget, curl, or another mechanism of your choosing.
Thursday, April 30, 2009
complie tpcw java using gij
javac -classpath /root/setup/apache-tomcat-5.5.27/common/lib/servlet-api.jar:/root/setup/tpc-w/src/servlets/ *.java
gij connect mysql using jdbc
please using mysql-connector-java-3.0.17-ga-bin.jar
mysql jdbc driver version 3.1, 5.0, 5.1 all not available.
java -cp .:/root/setup/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga-bin.jar TPCW_Populate
mysql -V
mysql Ver 14.7 Distrib 4.1.12, for unknown-linux-gnu (sparc) using readline 4.3
gij --version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
mysql jdbc driver version 3.1, 5.0, 5.1 all not available.
java -cp .:/root/setup/mysql-connector-java-3.0.17-ga/mysql-connector-java-3.0.17-ga-bin.jar TPCW_Populate
mysql -V
mysql Ver 14.7 Distrib 4.1.12, for unknown-linux-gnu (sparc) using readline 4.3
gij --version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Tuesday, April 28, 2009
setup tomcat under sparc linux
1. install gcc, g++, gcj, gij 4.1.2
../gcc-4.1.2/configure --prefix=/opt/gcc-4.1.2 --program-suffix=4.1.2 --host=sparc-redhat-linux --build=sparc-redhat-linux --target=sparc-redhat-linux
2. install java compat
3. export JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0
4. download apache-tomcat-5.5.27.tar.gz and apache-tomcat-5.5.27-compat.tar.gz
5. vi bin/setclasspath.sh
_RUNJAVA='/opt/gcc-4.1.2/bin/gij4.1.2'
6. ./startup.sh
../gcc-4.1.2/configure --prefix=/opt/gcc-4.1.2 --program-suffix=4.1.2 --host=sparc-redhat-linux --build=sparc-redhat-linux --target=sparc-redhat-linux
2. install java compat
3. export JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0
4. download apache-tomcat-5.5.27.tar.gz and apache-tomcat-5.5.27-compat.tar.gz
5. vi bin/setclasspath.sh
_RUNJAVA='/opt/gcc-4.1.2/bin/gij4.1.2'
6. ./startup.sh
Sunday, April 26, 2009
URL redirect 301 by .htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} ^francetop.net [NC]
RewriteRule ^(.*)$ http://www.francetop.net/$1 [L,R=301]
Reference
http://www.webweaver.nu/html-tips/web-redirection.shtml
Thursday, April 23, 2009
mysql slow queries log
1. config start slow query log
vi my.cnf
[mysqld]
set-variable=long_query_time=1
log-slow-queries=/home/www/log/mysql-log-slow-queries.log
2. restart mysql server
3. setup mysqlsla
yum install perl-DBI perl-DBD-MySQL perl-DBD-Pg
wget http://hackmysql.com/scripts/mysqlsla
4. using mysqlsla parse mysql slow query log
./mysqlsla-2.03/bin/mysqlsla --user xxx --password -lt slow --ex mysql-log-slow-queries.log --socke=/tmp/mysql.sock
./mysqlsla-1.8-DEBUG --user xxx --password --slow mysql-log-slow-queries.log --socke=/tmp/mysql.sock
vi my.cnf
[mysqld]
set-variable=long_query_time=1
log-slow-queries=/home/www/log/mysql-log-slow-queries.log
2. restart mysql server
3. setup mysqlsla
yum install perl-DBI perl-DBD-MySQL perl-DBD-Pg
wget http://hackmysql.com/scripts/mysqlsla
4. using mysqlsla parse mysql slow query log
./mysqlsla-2.03/bin/mysqlsla --user xxx --password -lt slow --ex mysql-log-slow-queries.log --socke=/tmp/mysql.sock
./mysqlsla-1.8-DEBUG --user xxx --password --slow mysql-log-slow-queries.log --socke=/tmp/mysql.sock
web server performance analysis
1. check system load
w
2. check cpu utilization
ps
3. check memory usage and swap disk usage
w
2. check cpu utilization
ps
3. check memory usage and swap disk usage
Monday, April 13, 2009
eAccelerator log
eAccelerator will write many log on apache error_log, link this:
EACCELERATOR hit:"/usr/local/www/xxxx.php"
To avoid this,
add option
eaccelerator.debug="0"
to your server php.ini configure.
Friday, April 10, 2009
HTTP Status Code Definitions
301 Moved Permanently
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Chinese character UTF8 encoding
http://theorem.ca/~mvcorks/cgi-bin/unicode.pl.cgi?start=4E00&end=9FFF
http://www.zhouhaihe.com/tool/UTF-8.htm
http://www.dc9.cn/post/85.html
http://www.zhouhaihe.com/tool/UTF-8.htm
http://www.dc9.cn/post/85.html
Thursday, April 9, 2009
ssh
problem:
ssh_exchange_identification: Connection closed by remote host
Check /etc/hosts.allow and /etc/hosts.deny.
/etc/init.d/sshd restart
/etc/ssh/sshd_config
ssh_exchange_identification: Connection closed by remote host
Check /etc/hosts.allow and /etc/hosts.deny.
/etc/init.d/sshd restart
/etc/ssh/sshd_config
Monday, April 6, 2009
simics usage
- start
continue
- copy file into simics
new-file-cdrom setup.iso
cd0.insert setup
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
- network
list-port-forwarding-setup
connect-real-network-port-in ethernet-link=link0 target-ip=10.10.0.12 target-port=8080 host-port=4880 -tcp
ifconfig eth0 10.10.0.12 netmask 255.255.255.0 broadcast 10.10.0.255
- setup new OS
new-file-cdrom install-sparc64-universal-2008.0.iso
cd0.insert install-sparc64-universal-2008
save-persistent-state install-phase1.state
./simics targets/sunfire/walnut-cd-install2.simics
load-persistent-state install-phase1.state
save-persistent-state install-phase2.state
./simics targets/sunfire/walnut-common.simics
bin/craff walnut-install.disk
send mail in linux server
- send a mail
- start mail service
Sunday, April 5, 2009
forward ssh server's graphic display to client
- on client:
ForwardX11 yes
- test
- Reference:
website seo
http://www.seomoz.org
http://www.seomoz.org/blog/the-beginners-checklist-for-small-business-seo
http://www.seomoz.org/blog/the-beginners-checklist-for-learning-seo
http://www.seomoz.org/tools
http://www.seomoz.org/blog/the-beginners-checklist-for-small-business-seo
http://www.seomoz.org/blog/the-beginners-checklist-for-learning-seo
http://www.seomoz.org/tools
Saturday, April 4, 2009
SVN server configure
0. setup svn
mkdir svn_dir
cd svn_dir
svnadmin create xxx_dir
svn import . file:///xxx_dir/
svnserve -d -r svn_dir
svn co svn://domain/xxx_dir/
1. not allow anonymous access
vi conf/svnserve.conf
anon-access = none
auth-access = write
password-db = passwd
2. not cache password
vi ~/.subversion/config
store-passwords = no
store-auth-creds = no
Reference:
http://www.subversion.org.cn/svnbook/1.4/index.html
http://www.subversion.org.cn/?action-viewnews-itemid-1
mkdir svn_dir
cd svn_dir
svnadmin create xxx_dir
svn import . file:///xxx_dir/
svnserve -d -r svn_dir
svn co svn://domain/xxx_dir/
1. not allow anonymous access
vi conf/svnserve.conf
anon-access = none
auth-access = write
password-db = passwd
2. not cache password
vi ~/.subversion/config
store-passwords = no
store-auth-creds = no
Reference:
http://www.subversion.org.cn/svnbook/1.4/index.html
http://www.subversion.org.cn/?action-viewnews-itemid-1
Thursday, April 2, 2009
setup JDK JRE
http://java.sun.com/javase/6/webnotes/install/jdk/install-linux.html
get a setup file such as jdk-6u12-linux-i586.bin
run it directly
get a setup file such as jdk-6u12-linux-i586.bin
run it directly
character web browser: lynx
get it from http://lynx.isc.org/current/index.html
very cool when you on a console
./configure
make
cp lynx.cfg /usr/local/etc/
cp samples/lynx.lss /usr/local/etc/
./lynx
very cool when you on a console
./configure
make
cp lynx.cfg /usr/local/etc/
cp samples/lynx.lss /usr/local/etc/
./lynx
Monday, March 30, 2009
Friday, March 27, 2009
serve gzip compressed content using apache 2
- enable mod_deflate in httpd.conf
- edit .htaccess file
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/json
Header append Vary Accept-Encoding
- check
http://www.port80software.com/tools/compresscheck.asp
Thursday, March 26, 2009
Thursday, March 19, 2009
setup Postgresql
1. download Postgresql (postgresql-8.3.7.tar.gz) from http://www.postgresql.org/download/
2. ./configure --prefix=
3. gmake
4. gmake install
5. adduser postgres
6. mkdir/data
7. chown postgres/data
8. initdb -D/data
9. export PATH=$PATH:/bin/
2. ./configure --prefix=
3. gmake
4. gmake install
5. adduser postgres
6. mkdir
7. chown postgres
8. initdb -D
9. export PATH=$PATH:
setup axis2
1. download axis2 from http://ws.apache.org/axis2/
2. unzip axis2-std-0.95-bin.zip
3. jar -xvf ../axis2.war
4. export AXIS2_HOME=....
2. unzip axis2-std-0.95-bin.zip
3. jar -xvf ../axis2.war
4. export AXIS2_HOME=....
Geronimo setup
1. download Geronimo (Geronimo 1.0 with Tomcat) from http://geronimo.apache.org/
2. follow the steps in Quick start
3. start the server
java -jar server.jar
then you can see Geronimo's welcome page in http://localhost:8080/
4. mkdir webapps as
5. Deploy an application
java -jar deployer.jar --user system --password manager deploy/HelloWorld.war
6. manage applications
http://localhost:8080/console
default user: system:manager
7. export GERONIMO_HOME=...
2. follow the steps in Quick start
3. start the server
java -jar server.jar
then you can see Geronimo's welcome page in http://localhost:8080/
4. mkdir webapps as
5. Deploy an application
java -jar deployer.jar --user system --password manager deploy
6. manage applications
http://localhost:8080/console
default user: system:manager
7. export GERONIMO_HOME=...
DBT4 setup
1. download DBT4 from http://osdldbt.sourceforge.net/
2. setup Germonimo 1.0
3. setup Axis2 version 0.95
4. setup Postgresql
5. vi scripts/pgsql/pgsql_profile.in
6. autoreconf --install
7. ./configure
8. vi src/Lcg64Rng/build.xml
9. cd src/Lcg64Rng/; ant
10. vi src/data/build.xml
11. cd src/data/; ant
12. vi src/app/build.xml
13. cd src/app/; ant
14. vi src/driver/build.xml
15. cd src/driver/; ant
16. ./scripts/pgsql/build_db.sh -e 1 -g
17. unzip axis2.war
18. cp geronimo-1.0/repository/activemq/jars/activemq-core-3.2.1.jar WEB-INF/lib/
19. cp dbt4-0.5/build/lib/Lcg64Rng.jar WEB-INF/lib/
20. cp postgresql-8.3-604.jdbc4.jar WEB-INF/lib/
21. cp dbt4-0.5/build/lib/Dbt4Service.aar WEB-INF/services/
22. jar cvf ~/axis2.war ./*
23. java -jar deployer.jar --user system --password manager deploy ~/axis2.war
now you can see dbt4 service from http://localhost:8080/axis2
24. vi scripts/myjava
JDBC_DRIVER=........./postgresql-8.3-604.jdbc4.jar
24. ./scripts/run_workload.sh -b 1 -d 1
2. setup Germonimo 1.0
3. setup Axis2 version 0.95
4. setup Postgresql
5. vi scripts/pgsql/pgsql_profile.in
6. autoreconf --install
7. ./configure
8. vi src/Lcg64Rng/build.xml
9. cd src/Lcg64Rng/; ant
10. vi src/data/build.xml
11. cd src/data/; ant
12. vi src/app/build.xml
13. cd src/app/; ant
14. vi src/driver/build.xml
15. cd src/driver/; ant
16. ./scripts/pgsql/build_db.sh -e 1 -g
17. unzip axis2.war
18. cp geronimo-1.0/repository/activemq/jars/activemq-core-3.2.1.jar WEB-INF/lib/
19. cp dbt4-0.5/build/lib/Lcg64Rng.jar WEB-INF/lib/
20. cp postgresql-8.3-604.jdbc4.jar WEB-INF/lib/
21. cp dbt4-0.5/build/lib/Dbt4Service.aar WEB-INF/services/
22. jar cvf ~/axis2.war ./*
23. java -jar deployer.jar --user system --password manager deploy ~/axis2.war
now you can see dbt4 service from http://localhost:8080/axis2
24. vi scripts/myjava
JDBC_DRIVER=........./postgresql-8.3-604.jdbc4.jar
24. ./scripts/run_workload.sh -b 1 -d 1
Monday, March 9, 2009
mysql config
connect number
add to my.cnf mysqld part
max_connections=250
tmp_table_size=67108864
sort_buffer_size=4194288
table_cache=128
mysql
show variables; to query config data for mysql
add to my.cnf mysqld part
max_connections=250
tmp_table_size=67108864
sort_buffer_size=4194288
table_cache=128
mysql
show variables; to query config data for mysql
Labels:
configure,
my.cnf,
mysql,
optimization,
performance
Saturday, March 7, 2009
mysql operation
/usr/bin/mysqladmin -u root password 'new-password'
GRANT ALL ON *.* TO 'myuser'@'somehost' IDENTIFIED BY 'mypass';
GRANT ALL PRIVILEGES ON *.* TO msentissi@"192.168.3.10" identified by
"yourpassword";
GRANT ALL ON *.* TO 'myuser'@'somehost' IDENTIFIED BY 'mypass';
GRANT ALL PRIVILEGES ON *.* TO msentissi@"192.168.3.10" identified by
"yourpassword";
Friday, March 6, 2009
apache code read
httpd.h
struct request_rec
mod_log_config.c
static const char *process_item(request_rec *r, request_rec *orig, log_format_item *item)
log_request_time()
struct request_rec
mod_log_config.c
static const char *process_item(request_rec *r, request_rec *orig, log_format_item *item)
log_request_time()
lxr
/tmp/lxr/bin/genxref /www/lxr/source/httpd-2.2.11
glimpseindex -n -o -H /www/lxr/source/httpd-2.2.11 www/lxr/source/httpd-2.2.11
glimpseindex -n -o -H /www/lxr/source/httpd-2.2.11 www/lxr/source/httpd-2.2.11
Friday, February 27, 2009
website speed up
- page analysis tool
- tutorial
http://www.sitepoint.com/article/web-site-optimization-steps/
http://developer.yahoo.com/performance/rules.html
- SEO
Wednesday, February 25, 2009
msn messager robot
http://flumpcakes.co.uk/php/msn-messenger
http://www.findmysoft.com/scripts/msn_web_messenger_script/
http://www.phpclasses.org/browse/package/1407.html
http://www.findmysoft.com/scripts/msn_web_messenger_script/
http://www.phpclasses.org/browse/package/1407.html
get contact list from email account
http://drupal.org/node/297877
http://forums.pligg.com/modification-tutorials/9637-contact-import-msn-yahoo-gmail-myspace.html
http://www.e-citizen.com/contacts/libs/
http://www.dominican.eventsworldwide.net/include/contactgrabber/contacts/libs/
http://forums.devarticles.com/php-development-48/import-email-addressess-from-yahoo-gmail-hotmail-86529.html
http://www.phphulp.nl/php/print/4/1355/0/scripts/
http://forums.pligg.com/modification-tutorials/9637-contact-import-msn-yahoo-gmail-myspace.html
http://www.e-citizen.com/contacts/libs/
http://www.dominican.eventsworldwide.net/include/contactgrabber/contacts/libs/
http://forums.devarticles.com/php-development-48/import-email-addressess-from-yahoo-gmail-hotmail-86529.html
http://www.phphulp.nl/php/print/4/1355/0/scripts/
Tuesday, February 24, 2009
configure culture in symfony
./apps/frontend/config/settings.yml: default_culture: fr
./apps/frontend/config/i18n.yml: default_culture: en
./apps/frontend/config/factories.yml:# default_culture: %SF_DEFAULT_CULTURE%
./apps/frontend/config/i18n.yml: default_culture: en
./apps/frontend/config/factories.yml:# default_culture: %SF_DEFAULT_CULTURE%
Monday, February 23, 2009
gmail contactor list
setup python
http://code.google.com/support/bin/answer.py?answer=75582
http://code.google.com/apis/contacts/docs/1.0/developers_guide_python.html
http://code.google.com/apis/gdata/articles/php_client_lib.html
http://code.google.com/apis/gdata/samples.html
http://code.google.com/apis/contacts/
http://code.google.com/apis/contacts/docs/2.0/developers_guide_protocol.html
http://code.google.com/support/bin/answer.py?answer=75582
http://code.google.com/apis/contacts/docs/1.0/developers_guide_python.html
http://code.google.com/apis/gdata/articles/php_client_lib.html
http://code.google.com/apis/gdata/samples.html
http://code.google.com/apis/contacts/
http://code.google.com/apis/contacts/docs/2.0/developers_guide_protocol.html
cookie in symfony
http://www.symfony-project.org/cookbook/1_0/en/cookie
http://www.symfony-project.org/book/1_0/06-Inside-the-Controller-Layer
http://us2.php.net/setcookie
http://www.symfony-project.org/book/1_0/06-Inside-the-Controller-Layer
http://us2.php.net/setcookie
Saturday, February 21, 2009
Friday, February 20, 2009
Thursday, February 19, 2009
ssh to remote host without password
ssh-keygen -t dsa
ssh-copy-id -i ~/.ssh/id_dsa.pub user_name@remote_host_name
ssh-copy-id -i ~/.ssh/id_dsa.pub user_name@remote_host_name
Wednesday, February 18, 2009
spin lock perfer same chip core
typedef struct{
int __triger;
volatile int spin;
volatile int flags[800];
volatile int queueLast;
volatile int owner;
volatile int count;
}my_spinlock_t;
int my_spin_init(my_spinlock_t * s, void *);
void my_spin_lock(my_spinlock_t * s);
void my_spin_unlock(my_spinlock_t * s);
void my_spin_dump(my_spinlock_t * s);
#define HAS_LOCK 0
#define MUST_WAIT 1
#define BACKOFF_BASE 100000
inline int g_atomic_int_exchange_and_add (int *atomic, int val)
{
int result;
__asm__ __volatile__ ("lock; xaddl %0,%1"
: "=r" (result), "=m" (*atomic)
: "0" (val), "m" (*atomic));
return result;
}
inline int g_atomic_int_compare_and_exchange (int *atomic, int oldval, int newval)
{
int result;
__asm__ __volatile__ ("lock; cmpxchgl %2, %1"
: "=a" (result), "=m" (*atomic)
: "r" (newval), "m" (*atomic), "0" (oldval));
return result;
}
int my_gettid()
{
int * p = (int*)pthread_self();
return p[18];
}
int my_spin_init(my_spinlock_t * s, void *p)
{
s->spin = HAS_LOCK;
return 0;
}
void my_spin_lock(my_spinlock_t * s)
{
volatile int i;
int b;
int cur_id, my_id = my_gettid();
my_id = my_id%8/2+1;
while( cur_id = g_atomic_int_compare_and_exchange(&s->spin, HAS_LOCK, my_id) ){
b = BACKOFF_BASE;
if(cur_id == my_id) b=0;
while(s->spin != HAS_LOCK)
for(i=b;i;i--);
}
}
void my_spin_unlock(my_spinlock_t * s)
{
s->spin = HAS_LOCK;
}
int __triger;
volatile int spin;
volatile int flags[800];
volatile int queueLast;
volatile int owner;
volatile int count;
}my_spinlock_t;
int my_spin_init(my_spinlock_t * s, void *);
void my_spin_lock(my_spinlock_t * s);
void my_spin_unlock(my_spinlock_t * s);
void my_spin_dump(my_spinlock_t * s);
#define HAS_LOCK 0
#define MUST_WAIT 1
#define BACKOFF_BASE 100000
inline int g_atomic_int_exchange_and_add (int *atomic, int val)
{
int result;
__asm__ __volatile__ ("lock; xaddl %0,%1"
: "=r" (result), "=m" (*atomic)
: "0" (val), "m" (*atomic));
return result;
}
inline int g_atomic_int_compare_and_exchange (int *atomic, int oldval, int newval)
{
int result;
__asm__ __volatile__ ("lock; cmpxchgl %2, %1"
: "=a" (result), "=m" (*atomic)
: "r" (newval), "m" (*atomic), "0" (oldval));
return result;
}
int my_gettid()
{
int * p = (int*)pthread_self();
return p[18];
}
int my_spin_init(my_spinlock_t * s, void *p)
{
s->spin = HAS_LOCK;
return 0;
}
void my_spin_lock(my_spinlock_t * s)
{
volatile int i;
int b;
int cur_id, my_id = my_gettid();
my_id = my_id%8/2+1;
while( cur_id = g_atomic_int_compare_and_exchange(&s->spin, HAS_LOCK, my_id) ){
b = BACKOFF_BASE;
if(cur_id == my_id) b=0;
while(s->spin != HAS_LOCK)
for(i=b;i;i--);
}
}
void my_spin_unlock(my_spinlock_t * s)
{
s->spin = HAS_LOCK;
}
simple spin lock with backoff delay
typedef struct{
volatile int spin;
}my_spinlock_t;
int my_spin_init(my_spinlock_t * s, void *);
void my_spin_lock(my_spinlock_t * s);
void my_spin_unlock(my_spinlock_t * s);
void my_spin_dump(my_spinlock_t * s);
#define HAS_LOCK 0
#define MUST_WAIT 1
#define BACKOFF_BASE 100000
inline int g_atomic_int_exchange_and_add (int *atomic, int val)
{
int result;
__asm__ __volatile__ ("lock; xaddl %0,%1"
: "=r" (result), "=m" (*atomic)
: "0" (val), "m" (*atomic));
return result;
}
inline int g_atomic_int_compare_and_exchange (int *atomic, int oldval, int newval)
{
int result;
__asm__ __volatile__ ("lock; cmpxchgl %2, %1"
: "=a" (result), "=m" (*atomic)
: "r" (newval), "m" (*atomic), "0" (oldval));
return result == oldval;
}
int my_spin_init(my_spinlock_t * s, void *p)
{
s->spin = HAS_LOCK;
return 0;
}
void my_spin_lock(my_spinlock_t * s)
{
volatile int i;
while( !g_atomic_int_compare_and_exchange(&s->spin, HAS_LOCK, MUST_WAIT) ){
for(i=BACKOFF_BASE;i;i--);
}
}
void my_spin_unlock(my_spinlock_t * s)
{
s->spin = HAS_LOCK;
}
void my_spin_lock(my_spinlock_t * s)
{
volatile int i;
while( !g_atomic_int_compare_and_exchange(&s->spin, HAS_LOCK, MUST_WAIT) ){
while(s->spin == MUST_WAIT)
for(i=BACKOFF_BASE;i;i--);
}
}
volatile int spin;
}my_spinlock_t;
int my_spin_init(my_spinlock_t * s, void *);
void my_spin_lock(my_spinlock_t * s);
void my_spin_unlock(my_spinlock_t * s);
void my_spin_dump(my_spinlock_t * s);
#define HAS_LOCK 0
#define MUST_WAIT 1
#define BACKOFF_BASE 100000
inline int g_atomic_int_exchange_and_add (int *atomic, int val)
{
int result;
__asm__ __volatile__ ("lock; xaddl %0,%1"
: "=r" (result), "=m" (*atomic)
: "0" (val), "m" (*atomic));
return result;
}
inline int g_atomic_int_compare_and_exchange (int *atomic, int oldval, int newval)
{
int result;
__asm__ __volatile__ ("lock; cmpxchgl %2, %1"
: "=a" (result), "=m" (*atomic)
: "r" (newval), "m" (*atomic), "0" (oldval));
return result == oldval;
}
int my_spin_init(my_spinlock_t * s, void *p)
{
s->spin = HAS_LOCK;
return 0;
}
void my_spin_lock(my_spinlock_t * s)
{
volatile int i;
while( !g_atomic_int_compare_and_exchange(&s->spin, HAS_LOCK, MUST_WAIT) ){
for(i=BACKOFF_BASE;i;i--);
}
}
void my_spin_unlock(my_spinlock_t * s)
{
s->spin = HAS_LOCK;
}
void my_spin_lock(my_spinlock_t * s)
{
volatile int i;
while( !g_atomic_int_compare_and_exchange(&s->spin, HAS_LOCK, MUST_WAIT) ){
while(s->spin == MUST_WAIT)
for(i=BACKOFF_BASE;i;i--);
}
}
simple spin lock
typedef struct{
int spin;
}my_spinlock_t;
int my_spin_init(my_spinlock_t * s, void *);
void my_spin_lock(my_spinlock_t * s);
void my_spin_unlock(my_spinlock_t * s);
void my_spin_dump(my_spinlock_t * s);
#define HAS_LOCK 0
#define MUST_WAIT 1
inline int g_atomic_int_compare_and_exchange (int *atomic, int oldval, int newval)
{
int result;
__asm__ __volatile__ ("lock; cmpxchgl %2, %1"
: "=a" (result), "=m" (*atomic)
: "r" (newval), "m" (*atomic), "0" (oldval));
return result == oldval;
}
int my_spin_init(my_spinlock_t * s, void *p)
{
s->spin = HAS_LOCK;
return 0;
}
void my_spin_lock(my_spinlock_t * s)
{
while( !g_atomic_int_compare_and_exchange(&s->spin, HAS_LOCK, MUST_WAIT) );
}
void my_spin_unlock(my_spinlock_t * s)
{
s->spin = HAS_LOCK;
}
int spin;
}my_spinlock_t;
int my_spin_init(my_spinlock_t * s, void *);
void my_spin_lock(my_spinlock_t * s);
void my_spin_unlock(my_spinlock_t * s);
void my_spin_dump(my_spinlock_t * s);
#define HAS_LOCK 0
#define MUST_WAIT 1
inline int g_atomic_int_compare_and_exchange (int *atomic, int oldval, int newval)
{
int result;
__asm__ __volatile__ ("lock; cmpxchgl %2, %1"
: "=a" (result), "=m" (*atomic)
: "r" (newval), "m" (*atomic), "0" (oldval));
return result == oldval;
}
int my_spin_init(my_spinlock_t * s, void *p)
{
s->spin = HAS_LOCK;
return 0;
}
void my_spin_lock(my_spinlock_t * s)
{
while( !g_atomic_int_compare_and_exchange(&s->spin, HAS_LOCK, MUST_WAIT) );
}
void my_spin_unlock(my_spinlock_t * s)
{
s->spin = HAS_LOCK;
}
queue-based spin lock
typedef struct{
volatile int flags[80];
volatile int queueLast;
volatile int owner;
}my_spinlock_t;
int my_spin_init(my_spinlock_t * s, void *);
void my_spin_lock(my_spinlock_t * s);
void my_spin_unlock(my_spinlock_t * s);
#define HAS_LOCK 0
#define MUST_WAIT 1
int g_atomic_int_exchange_and_add (int *atomic, int val)
{
int result;
__asm__ __volatile__ ("lock; xaddl %0,%1"
: "=r" (result), "=m" (*atomic)
: "0" (val), "m" (*atomic));
return result;
}
int my_gettid()
{
int * p = (int*)pthread_self();
return p[18];
}
int my_spin_init(my_spinlock_t * s, void *p)
{
int i;
s->flags[0] = HAS_LOCK;
for(i=1;i<8;i++)
s->flags[i*10] = MUST_WAIT;
s->queueLast = 0;
return 0;
}
void my_spin_lock(my_spinlock_t * s)
{
int myPlace, t;
volatile int * p;
myPlace = g_atomic_int_exchange_and_add(&s->queueLast, 1);
//myPlace = my_gettid();
t = myPlace % 8;
p = &s->flags[t*10];
while(*p == MUST_WAIT);
s->flags[t*10] = MUST_WAIT;
s->owner = myPlace;
}
void my_spin_unlock(my_spinlock_t * s)
{
int myPlace = s->owner;
s->flags[((myPlace+1) % 8)*10] = HAS_LOCK;
}
Reference
Thomas E. Anderson, "The Performance of Spin Lock Alternatives for Shared-Memory Multiprocessors", IEEE Transactions on Parallel and Distributed Systems, 1990
volatile int flags[80];
volatile int queueLast;
volatile int owner;
}my_spinlock_t;
int my_spin_init(my_spinlock_t * s, void *);
void my_spin_lock(my_spinlock_t * s);
void my_spin_unlock(my_spinlock_t * s);
#define HAS_LOCK 0
#define MUST_WAIT 1
int g_atomic_int_exchange_and_add (int *atomic, int val)
{
int result;
__asm__ __volatile__ ("lock; xaddl %0,%1"
: "=r" (result), "=m" (*atomic)
: "0" (val), "m" (*atomic));
return result;
}
int my_gettid()
{
int * p = (int*)pthread_self();
return p[18];
}
int my_spin_init(my_spinlock_t * s, void *p)
{
int i;
s->flags[0] = HAS_LOCK;
for(i=1;i<8;i++)
s->flags[i*10] = MUST_WAIT;
s->queueLast = 0;
return 0;
}
void my_spin_lock(my_spinlock_t * s)
{
int myPlace, t;
volatile int * p;
myPlace = g_atomic_int_exchange_and_add(&s->queueLast, 1);
//myPlace = my_gettid();
t = myPlace % 8;
p = &s->flags[t*10];
while(*p == MUST_WAIT);
s->flags[t*10] = MUST_WAIT;
s->owner = myPlace;
}
void my_spin_unlock(my_spinlock_t * s)
{
int myPlace = s->owner;
s->flags[((myPlace+1) % 8)*10] = HAS_LOCK;
}
Reference
Thomas E. Anderson, "The Performance of Spin Lock Alternatives for Shared-Memory Multiprocessors", IEEE Transactions on Parallel and Distributed Systems, 1990
Tuesday, February 17, 2009
atomic operation function in C language
http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html
http://library.gnome.org/devel/glib/2.16/glib-Atomic-Operations.html
http://java.sun.com/javase/6/docs/api/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.html
https://stage.maemo.org/svn/maemo/projects/haf/branches/glib2.0/2.8.6-1osso5/glib/gatomic.c
http://www.sogou.com/labs/report/4-2.pdf
http://library.gnome.org/devel/glib/2.16/glib-Atomic-Operations.html
http://java.sun.com/javase/6/docs/api/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.html
https://stage.maemo.org/svn/maemo/projects/haf/branches/glib2.0/2.8.6-1osso5/glib/gatomic.c
http://www.sogou.com/labs/report/4-2.pdf
Sunday, February 15, 2009
div's position and overlap
<div style="width: 150px; height: 100px; background-color: blue;">
blue
</div>
<div style="width: 100px; height: 150px; background-color: red;">
red
</div>
blue
red
<div style="width: 150px; height: 100px; background-color: blue;position: absolute;">
blue
</div>
<div style="width: 100px; height: 150px; background-color: red; position: relative;">
red
</div>
blue
red
<div style="width: 150px; height: 100px; background-color: blue;position: absolute;z-index:2;">
blue
</div>
<div style="width: 100px; height: 150px; background-color: red; position: relative;z-index:1;">
red
</div>
blue
red
blue
</div>
<div style="width: 100px; height: 150px; background-color: red;">
red
</div>
blue
red
<div style="width: 150px; height: 100px; background-color: blue;position: absolute;">
blue
</div>
<div style="width: 100px; height: 150px; background-color: red; position: relative;">
red
</div>
blue
red
<div style="width: 150px; height: 100px; background-color: blue;position: absolute;z-index:2;">
blue
</div>
<div style="width: 100px; height: 150px; background-color: red; position: relative;z-index:1;">
red
</div>
blue
red
ext js library
Firfox error message: ext is not defined
<link type="text/css" rel="stylesheet" href="/js/ext-2.2/resources/css/ext-all.css"/>
<script type="text/javascript" src="/js/ext-2.2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/js/ext-2.2/ext-all.js"></script>
<link type="text/css" rel="stylesheet" href="/js/ext-2.2/resources/css/ext-all.css"/>
<script type="text/javascript" src="/js/ext-2.2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/js/ext-2.2/ext-all.js"></script>
Thursday, February 12, 2009
Wednesday, February 11, 2009
SQL sample
1. one table join itself
select file.id from history t1, history t2, file where file.id=t1.file_id and t1.id<>t2.id and t1.updated_at=t2.updated_at and t1.ip=t2.ip and t1.file_id<>114 and t2.file_id=114 group by t1.file_id order by count(t1.file_id) desc;
select file.id from history t1, history t2, file where file.id=t1.file_id and t1.id<>t2.id and t1.updated_at=t2.updated_at and t1.ip=t2.ip and t1.file_id<>114 and t2.file_id=114 group by t1.file_id order by count(t1.file_id) desc;
Monday, February 9, 2009
Apache log setting
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common
<virtualhost>
ServerName xxxx
ServerAlias xxxx.com
DocumentRoot /home/www/xxxx.com/web
AddType application/x-httpd-php .php
<directory>
AllowOverride All
Order allow,deny
Allow from all
</directory>
RewriteLog /home/www/xxxx.com/log/xxxx.com_rewrite_log
RewriteLogLevel 3
ErrorLog /home/www/xxxx.com/log/xxxx.com_error_log
CustomLog /home/www/xxxx.com/log/xxxx.com_access_log common
</virtualhost>
Referencehttp://httpd.apache.org/docs/1.3/logs.html
Linux system call
include/asm/unistd_32.h
arch/x86/kernel/syscall_table_32.S
#include <linux/unistd.h>
#define __NR_my_kernel_init 327
//_syscall1(int, my_kernel_init, int, debug);
int my_kernel_init(int debug)
{
return syscall(__NR_my_kernel_init, debug);
}
int main()
{
int ret = my_kernel_init(1);
printf( "%d\n", ret);
return 0;
}
when I using _syscall1(int, my_kernel_init, int, debug), I got an error:
test.c:6: error: expected declaration specifiers or ‘...’ before ‘my_kernel_init’
test.c:6: error: expected declaration specifiers or ‘...’ before ‘debug’
test.c:6: warning: data definition has no type or storage class
Reference:
Linux system call list
Kernel command using Linux system calls, Explore the SCI and add your own calls
arch/x86/kernel/syscall_table_32.S
#include <linux/unistd.h>
#define __NR_my_kernel_init 327
//_syscall1(int, my_kernel_init, int, debug);
int my_kernel_init(int debug)
{
return syscall(__NR_my_kernel_init, debug);
}
int main()
{
int ret = my_kernel_init(1);
printf( "%d\n", ret);
return 0;
}
when I using _syscall1(int, my_kernel_init, int, debug), I got an error:
test.c:6: error: expected declaration specifiers or ‘...’ before ‘my_kernel_init’
test.c:6: error: expected declaration specifiers or ‘...’ before ‘debug’
test.c:6: warning: data definition has no type or storage class
Reference:
Linux system call list
Kernel command using Linux system calls, Explore the SCI and add your own calls
Saturday, February 7, 2009
MySql error
- Can't open file: 'xxxx.MYI' (errno: 13)
OS error code 13: Permission denied
chmod 777 xxxx.MYI
- Repair MySql database table index file
- MySQL said: Documentation
#1114 - The table 'xxxx' is full
- ERROR 1030 (HY000): Got error 127 from storage engine
MySQL error code 127: Record-file is crashed
- repair table xxx USE_FRM;
http://bbs.ylqonline.net/redirect.php?tid=332&goto=lastpost
Thursday, February 5, 2009
set icon for your website
add in head part of page
<link rel="shortcut icon" href="/img/favicon.png">
not only ico file, but also png image work well.
<link rel="shortcut icon" href="/img/favicon.png">
not only ico file, but also png image work well.
set CPU frequency in Linux
- ls /sys/devices/system/cpu/cpu0/
- cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver etc.
scaling_available_frequencies
- modprobe acpi-cpufreq
- cat /proc/cpuinfo | grep 'cpu MHz'
- cpufreq-selector
-c, --cpu CPU Number
-g, --governor Governor
-f, --frequency Frequency in KHz - /usr/sbin/cpuspeed -m 2000000 -M 2000000 -s 7
/etc/init.d/cpuspeed, initialzation script
/usr/sbin/cpuspeed, cpuspeed program
- cpufreq-set
- cpufreq-info
linux networking command
- print route table
- add route table entry
- restart network
Build and using a new glibc
- export LD_LIBRARY_PATH=
- ../glibc-2.5/configure --prefix=/home/xxxx/nptl/install
- make
- make install
- link to new glibc
- modify glibc
glibc-2.5/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h
some nptl function
glibc-2.5/nptl/pthread_mutex_lock.c
glibc-2.5/nptl/sysdeps/i386/pthread_spin_lock.c
cp glibc-2.5/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h install/include/bits/pthreadtypes.h
cp build/nptl/libp* install/lib
rm build/libc.so
Wednesday, February 4, 2009
set meta information for a page in Symfony
$response = $this->getResponse();
$response->setTitle($title);
$response->addMeta('keywords', $kws);
$response->addMeta('description', $desc);
$response->setTitle($title);
$response->addMeta('keywords', $kws);
$response->addMeta('description', $desc);
get thread id
#include
#include
#include
int my_gettid()
{
int * p = (int*)pthread_self();
int pid = getpid();
assert(pid == p[19]);
return p[18];
}
int my_gettid(pthread_t thread)
{
int *p = (int*)thread;
return p[18];
}
void BusyWork(void* t)
{
int tid = my_gettid();
int pid = getpid();
printf("worker tid %d pid %d\n",tid,pid);
}
int main()
{
int tid = my_gettid();
int pid = getpid();
printf("main tid %d pid %d\n",tid,pid);
pthread_t thread;
pthread_create(&thread, NULL, BusyWork, NULL);
pthread_join(thread,NULL);
return 0;
}
#include
#include
int my_gettid()
{
int * p = (int*)pthread_self();
int pid = getpid();
assert(pid == p[19]);
return p[18];
}
int my_gettid(pthread_t thread)
{
int *p = (int*)thread;
return p[18];
}
void BusyWork(void* t)
{
int tid = my_gettid();
int pid = getpid();
printf("worker tid %d pid %d\n",tid,pid);
}
int main()
{
int tid = my_gettid();
int pid = getpid();
printf("main tid %d pid %d\n",tid,pid);
pthread_t thread;
pthread_create(&thread, NULL, BusyWork, NULL);
pthread_join(thread,NULL);
return 0;
}
pthread spin lock in glibc nptl
- The Glibc I using is glibc-2.5, computer architecture is i386
- type definition of pthread_spinlock_t
/* POSIX spinlock data type. */
typedef volatile int pthread_spinlock_t;
- function pthread_spin_lock
- my test of spin lock
#include
#define NUM_THREADS 8
long sum;
pthread_spinlock_t sumlock;
int my_sleep(int i)
{
int j,k,n=0;
for(;i>0;i--)
for(j=0;j<100;j++)
for(k=0;k<100;k++)
n++;
return n;
}
void *BusyWork(void *threadid)
{
int i,k;
long tid = (long)threadid;
for(i=0;i<10;i++){
k = my_sleep(3);
pthread_spin_lock (&sumlock);
printf("%d ", tid);
sum += k;
pthread_spin_unlock (&sumlock);
}
pthread_exit((void *) 0);
}
int main (int argc, char *argv[])
{
pthread_t thread[NUM_THREADS];
int rc, t;
void *status;
pthread_spin_init(&sumlock, NULL);
for(t=0; t
rc = pthread_create(&thread[t], NULL, BusyWork, (void*)t);
if (rc){
return 0;
}
}
for(t=0; t
rc = pthread_join(thread[t], &status);
if (rc){
printf("ERROR; return code from pthread_join() is %d\n", rc);
return 0;
}
}
printf("sum = %ld\n", sum);
pthread_spin_destroy(&sumlock);
pthread_exit(NULL);
}
Bind a thread/process to a CPU core
#include <sched.h>
{
cpu_set_t mask;
__CPU_ZERO(&mask);
__CPU_SET(p, &mask);
sched_setaffinity(0, sizeof(mask), &mask);
}
{
cpu_set_t mask;
__CPU_ZERO(&mask);
__CPU_SET(p, &mask);
sched_setaffinity(tid, sizeof(mask), &mask);
}
Reference
- Bind the invoke thread to a CPU core which id is p
{
cpu_set_t mask;
__CPU_ZERO(&mask);
__CPU_SET(p, &mask);
sched_setaffinity(0, sizeof(mask), &mask);
}
- Bind thread which id is tid to a CPU core p
{
cpu_set_t mask;
__CPU_ZERO(&mask);
__CPU_SET(p, &mask);
sched_setaffinity(tid, sizeof(mask), &mask);
}
Reference
vi command
1. full text replacement
:1,$s/tom/David/g
from first line to last line, replace tom with David
:1,$s/tom/David/g
from first line to last line, replace tom with David
Tuesday, February 3, 2009
Create a Linux module
1. vi simple-lmk.c
2. vi Makefile
obj-m += simple-lkm.o
3. build
#include
/* Defines the license for this LKM */
MODULE_LICENSE("GPL");
/* Init function called on module entry */
int my_module_init( void )
{
printk(KERN_INFO "my_module_init called. Module is now loaded.\n");
return 0;
}
/* Cleanup function called on module exit */
void my_module_cleanup( void )
{
printk(KERN_INFO "my_module_cleanup called. Module is now unloaded.\n");
return;
}
/* Declare entry and exit functions */
module_init( my_module_init );
module_exit( my_module_cleanup );
2. vi Makefile
obj-m += simple-lkm.o
3. build
make -C /usr/src/linux-`uname -r` SUBDIRS=$PWD modules
4. insert module
insmod simple-lkm.ko
5. check module
lsmod
6. check print message
dmesg | tail -5
7. remove module
rmmod simple-lkm
Connect VMware client from Linux host
I setup a Linux virtual machine on a Linux host, using NAT network.
When connect from virtual machine to host, it is successful. But there is a problem from host connect to virtual machine, the error message of ping is:
ping sendmsg operation not permitted
There need set an port mapping of NAT.
In host Linux, edit configure file /etc/vmware/vmnet8/nat/nat.conf
add one line "2222 = 192.168.27.128:22" under [incomingtcp]
192.168.27.128 is IP of virtual machine.
Then reboot
ssh -l root -p 2222 localhost
will telnet to virtual machine from host Linux.
Reference
1. http://www.vmware.com/support/ws55/doc/ws_net_nat_advanced.html
When connect from virtual machine to host, it is successful. But there is a problem from host connect to virtual machine, the error message of ping is:
ping sendmsg operation not permitted
There need set an port mapping of NAT.
In host Linux, edit configure file /etc/vmware/vmnet8/nat/nat.conf
add one line "2222 = 192.168.27.128:22" under [incomingtcp]
192.168.27.128 is IP of virtual machine.
Then reboot
ssh -l root -p 2222 localhost
will telnet to virtual machine from host Linux.
Reference
1. http://www.vmware.com/support/ws55/doc/ws_net_nat_advanced.html
build and install a new Linux kernel
1. Down load a new linux kernel from http://www.kernel.org/
2. cp /boot/config-xxx .config
3. make
4. make modules_install install
5. reboot
2. cp /boot/config-xxx .config
3. make
4. make modules_install install
5. reboot
Subscribe to:
Posts (Atom)