
2007年12月5日
摘要: 做為程序員,從感性角度講評(píng)一下7年里我使用過(guò)的9款機(jī)械鍵盤(pán),確實(shí)更有特色,這種特殊的觸聽(tīng)體驗(yàn)非常美妙!
閱讀全文
posted @
2021-03-30 15:45 我愛(ài)佳娃 閱讀(398) |
評(píng)論 (0) |
編輯 收藏
搬了個(gè)家,想通過(guò)A410點(diǎn)播imac上下載的電影,通過(guò)系統(tǒng)自帶共享samba怎么都不成功。
想到是13年買(mǎi)的A410,應(yīng)該升級(jí)一下,可官網(wǎng)都沒(méi)了,最后搜索到這個(gè)16年的最新固件:
https://drivers.softpedia.com/get/DVD-BluRay-Media-Players/Cloud-Media/Cloud-Media-Popcorn-Hour-A-410-Media-Player-Firmware-050816061625POP425802.shtml通過(guò)USB順利更新了一把。
再查看mac可以開(kāi)nfs,方法如下:
sudo vi /etc/exports
加入:
/ -sec=sys
/Users /Users/popeye /Users/popeye/movies -ro -mapall=popeye:staff -alldirs
檢查配置:
sudo nfsd checkexports
重啟:
sudo nfsd restart
這里要注意movies目錄是我重新建立的755權(quán)限,不要用系統(tǒng)原來(lái)的目錄,不然總是訪問(wèn)不了。
再到A410里網(wǎng)絡(luò)瀏覽里就能找到了。
posted @
2020-01-19 21:43 我愛(ài)佳娃 閱讀(702) |
評(píng)論 (0) |
編輯 收藏
http://mathias-kettner.de/checkmk_livestatus.html下載并解壓最新的包:
check_mk-1.2.1i3.tar.gz
再解壓其中的到livestatus目錄:
livestatus.tar.gz
進(jìn)入:livestatus/src
再:make clean livestatus.o
會(huì)發(fā)現(xiàn)一堆錯(cuò)誤,根據(jù)編譯NDO的選項(xiàng):
ndoutils-1.4b7/src:
make clean ndomod-3x.o
gcc -fno-common -g -O2 -DHAVE_CONFIG_H -D BUILD_NAGIOS_3X -o ndomod-3x.o ndomod.c io.o utils.o -bundle -flat_namespace -undefined suppress -lz
在最后的編譯選項(xiàng)里添上:
-flat_namespace -undefined suppress -lz
就可以編譯出:
livestatus.o
--------------------------
livecheck編不過(guò),報(bào)找不到n_short:
ip_icmp.h:92: error: expected specifier-qualifier-list before ‘n_short’
vi ./check_icmp.c
把這個(gè)調(diào)整到INCLUDE序列的最后即可:
#include "/usr/include/netinet/ip_icmp.h"
posted @
2012-12-21 07:00 我愛(ài)佳娃 閱讀(1556) |
評(píng)論 (0) |
編輯 收藏
摘要:
場(chǎng)景
想要用到的場(chǎng)景:用戶(hù)訪問(wèn)WEB服務(wù),WEB訪問(wèn)非WEB服務(wù)1,服務(wù)1又再訪問(wèn)2、3,合并計(jì)算后,把數(shù)據(jù)返回給WEB及前端用戶(hù)。想讓訪問(wèn)鏈上的所有服務(wù)都能得到認(rèn)證和鑒權(quán),認(rèn)為本次請(qǐng)求確實(shí)是來(lái)自用戶(hù)的。所以想到用CAS,讓用戶(hù)在一點(diǎn)登錄,所有服務(wù)都到此處認(rèn)證和鑒權(quán)。
閱讀全文
posted @
2012-12-01 10:43 我愛(ài)佳娃 閱讀(9805) |
評(píng)論 (3) |
編輯 收藏
This tutorial will walk you through how to configure SSL (https://localhost:8443 access) on Tomcat in 5 minutes.

For this tutorial you will need:
- Java SDK (used version 6 for this tutorial)
- Tomcat (used version 7 for this tutorial)
The set up consists in 3 basic steps:
- Create a keystore file using Java
- Configure Tomcat to use the keystore
- Test it
- (Bonus ) Configure your app to work with SSL (access through https://localhost:8443/yourApp)
1 – Creating a Keystore file using Java
Fisrt, open the terminal on your computer and type:
Windows:
cd %JAVA_HOME%/bin
Linux or Mac OS:
cd $JAVA_HOME/bin
The $JAVA_HOME on Mac is located on “/System/Library/Frameworks/JavaVM.framework/Versions/{your java version}/Home/”
You will change the current directory to the directory Java is installed on your computer. Inside the Java Home directory, cd to the bin folder. Inside the bin folder there is a file named keytool. This guy is responsible for generating the keystore file for us.
Next, type on the terminal:
keytool -genkey -alias tomcat -keyalg RSA
When you type the command above, it will ask you some questions. First, it will ask you to create a password (My password is “password“):
loiane:bin loiane$ keytool -genkey -alias tomcat -keyalg RSA Enter keystore password: password Re-enter new password: password What is your first and last name? [Unknown]: Loiane Groner What is the name of your organizational unit? [Unknown]: home What is the name of your organization? [Unknown]: home What is the name of your City or Locality? [Unknown]: Sao Paulo What is the name of your State or Province? [Unknown]: SP What is the two-letter country code for this unit? [Unknown]: BR Is CN=Loiane Groner, OU=home, O=home, L=Sao Paulo, ST=SP, C=BR correct? [no]: yes Enter key password for (RETURN if same as keystore password): password Re-enter new password: password
It will create a .keystore file on your user home directory. On Windows, it will be on: C:\Documents and Settings\[username]; on Mac it will be on /Users/[username] and on Linux will be on /home/[username].
2 – Configuring Tomcat for using the keystore file – SSL config
Open your Tomcat installation directory and open the conf folder. Inside this folder, you will find the server.xml file. Open it.
Find the following declaration:
<!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> -->
Uncomment it and modify it to look like the following:
Connector SSLEnabled="true" acceptCount="100" clientAuth="false" disableUploadTimeout="true" enableLookups="false" maxThreads="25" port="8443" keystoreFile="/Users/loiane/.keystore" keystorePass="password" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" sslProtocol="TLS" />
Note we add the keystoreFile, keystorePass and changed the protocol declarations.
3 – Let’s test it!
Start tomcat service and try to access https://localhost:8443. You will see Tomcat’s local home page.
Note if you try to access the default 8080 port it will be working too: http://localhost:8080
4 – BONUS - Configuring your app to work with SSL (access through https://localhost:8443/yourApp)
To force your web application to work with SSL, you simply need to add the following code to your web.xml file (before web-app tag ends):
<security-constraint> <web-resource-collection> <web-resource-name>securedapp</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
The url pattern is set to /* so any page/resource from your application is secure (it can be only accessed with https). The transport-guarantee tag is set to CONFIDENTIAL to make sure your app will work on SSL.
If you want to turn off the SSL, you don’t need to delete the code above from web.xml, simply changeCONFIDENTIAL to NONE.
Reference: http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html (this tutorial is a little confusing, that is why I decided to write another one my own).
Happy Coding!
posted @
2012-11-12 23:17 我愛(ài)佳娃 閱讀(3179) |
評(píng)論 (0) |
編輯 收藏
EXTJS和D3都很強(qiáng)大,不解釋了,把D3繪的圖直接放到一個(gè)EXT的TAB里,直接上圖上代碼:

代碼中的D3例子來(lái)自:
https://github.com/mbostock/d3/wiki/Force-Layout
可用于繪制拓?fù)浣Y(jié)構(gòu)圖.
Ext.define('EB.view.content.SingleView', {
extend : 'Ext.panel.Panel',
alias : 'widget.singleview',
layout : 'fit',
title : 'single view',
initComponent : function() {
this.callParent(arguments);
},
onRender : function() {
var me = this;
me.doc = Ext.getDoc();
me.callParent(arguments);
me.drawMap();
},
drawMap : function() {
var width = 960, height = 500
var target = d3.select("#" + this.id+"-body");
var svg = target.append("svg").attr("width", width).attr("height",
height);
var force = d3.layout.force().gravity(.05).distance(100).charge(-100)
.size([width, height]);
// get from: https://github.com/mbostock/d3/wiki/Force-Layout
// example: force-directed images and labels
d3.json("graph.json", function(json) {
force.nodes(json.nodes).links(json.links).start();
var link = svg.selectAll(".link").data(json.links).enter()
.append("line").attr("class", "link");
var node = svg.selectAll(".node").data(json.nodes).enter()
.append("g").attr("class", "node").call(force.drag);
node.append("image").attr("xlink:href",
"https://github.com/favicon.ico").attr("x", -8).attr("y",
-8).attr("width", 16).attr("height", 16);
node.append("text").attr("dx", 12).attr("dy", ".35em").text(
function(d) {
return d.name
});
force.on("tick", function() {
link.attr("x1", function(d) {
return d.source.x;
}).attr("y1", function(d) {
return d.source.y;
}).attr("x2", function(d) {
return d.target.x;
}).attr("y2", function(d) {
return d.target.y;
});
node.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
});
});
}
});
posted @
2012-09-27 07:38 我愛(ài)佳娃 閱讀(4475) |
評(píng)論 (0) |
編輯 收藏
到這里下載最新PKG:
http://www.mysql.com/downloads/
下來(lái)后先裝:mysql-5.5.27-osx10.6-x86_64.pkg
它是裝到/usr/local/mysql,到此目錄運(yùn)行下:
./scripts/mysql_install_db --user mysql
通過(guò)這個(gè)啟動(dòng):
./bin/mysqld_safe
排錯(cuò):
看下上面的LOG提示.
Can't find file: './mysql/host.frm' :一般是沒(méi)權(quán)限,把DATA目錄刪除,再用上面命令建一次
unknow option:把/etc/my.cnf刪除掉,里面有新版本不認(rèn)識(shí)的上一版本遺留配置
說(shuō)mysql.sock找不到,這個(gè)版本是在/tmp/目錄下哦!
再把剩下兩個(gè)包裝了,就可以通過(guò)配置面板啟動(dòng)了:
MySQL.prefPane
MySQLStartupItem.pkg
下次升級(jí)可能要給下/usr/local/mysql/data目錄的權(quán)限
posted @
2012-08-05 16:43 我愛(ài)佳娃 閱讀(2640) |
評(píng)論 (0) |
編輯 收藏
摘要: 非常淺顯易懂的PERL編碼說(shuō)明.
一目了然PERL編碼,注意是轉(zhuǎn)的
閱讀全文
posted @
2011-10-09 08:04 我愛(ài)佳娃 閱讀(3222) |
評(píng)論 (0) |
編輯 收藏
下面以MAC為例,如果是LINUX需要把DYLD發(fā)為L(zhǎng)D
把下面代碼加到代碼開(kāi)頭,它就可以自啟動(dòng)了,不需要再EXPORT或者-I
BEGIN {
#需要加到LOADPATH的路徑
my $need = '/usr/local/nagios/pkg/ebase/';
push @INC, $need;
if ( $^O !~ /MSWin32/ ) {
my $ld = $ENV{DYLD_LIBRARY_PATH};
if ( !$ld ) {
$ENV{DYLD_LIBRARY_PATH} = $need;
}
elsif ( $ld !~ m#(^|:)\Q$need\E(:|$)# ) {
$ENV{DYLD_LIBRARY_PATH} .= ':' . $need;
}
else {
$need = "";
}
if ($need) {
exec 'env', $^X, $0, @ARGV;
}
}
}
@import url(http://www.tkk7.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
posted @
2011-10-03 21:37 我愛(ài)佳娃 閱讀(1765) |
評(píng)論 (0) |
編輯 收藏
限制用戶(hù)在自己目錄下載文件:
建立nagiosdnld
指向軟鏈接:/usr/local/nagios/dnld -> /Users/nagiosdnld/dnld
編輯/etc/sshd_config
Match User nagiosdnld
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
ChrootDirectory /Users/nagiosdnld
重啟下服務(wù):
launchctl stop org.openbsd.ssh-agent
launchctl start org.openbsd.ssh-agent
@import url(http://www.tkk7.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
posted @
2011-10-03 03:15 我愛(ài)佳娃 閱讀(1809) |
評(píng)論 (0) |
編輯 收藏
摘要: iostat 輸出解析
1. /proc/partitions
對(duì)于kernel 2.4, iostat 的數(shù)據(jù)的主要來(lái)源是 /proc/partitions,而對(duì)于kernel 2.6, 數(shù)據(jù)主要來(lái)自/proc/diskstats或者/sys/block/[block-device-name]/stat。
先看看 /proc/partitions 中有些什么。
# cat /proc/partitions
major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
閱讀全文
posted @
2011-09-17 11:37 我愛(ài)佳娃 閱讀(1646) |
評(píng)論 (0) |
編輯 收藏
@import url(http://www.tkk7.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
@import url(http://www.tkk7.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
編譯:
修改Makefile.PL:
$archname="universal64-macosx";
去除生成的makefile中所有-arch i386 -Werror
make all
最后把所有可執(zhí)行文件拷到同一目錄,再用
export DYLD_LIBRARY_PATH=/tmp/test
即可直接運(yùn)行:
eb:tmp$ ls ./test/
Sigar.bundle cpu_info.pl
Sigar.pm libsigar-universal64-macosx.dylib
eb:tmp popeyecai$ perl -I./test ./test/cpu_info.pl
2 total CPUs..
Vendor........Intel
Model.........Macmini4,1
Mhz...........2660
Cache size....3072
Vendor........Intel
Model.........Macmini4,1
Mhz...........2660
Cache size....3072
posted @
2011-09-10 10:45 我愛(ài)佳娃 閱讀(852) |
評(píng)論 (0) |
編輯 收藏
摘要: Stl 刪除元素注意事項(xiàng) STL中的容器按存儲(chǔ)方式分為兩類(lèi),一類(lèi)是按以數(shù)組形式存儲(chǔ)的容器(如:vector 、deque);另一類(lèi)是以不連續(xù)的節(jié)點(diǎn)形式存儲(chǔ)的容器(如:list、set、map)。在使用erase方法來(lái)刪除元素時(shí),需要注意一些問(wèn)題。 在使用 list、set 或 m...
閱讀全文
posted @
2011-07-18 17:02 我愛(ài)佳娃 閱讀(1485) |
評(píng)論 (0) |
編輯 收藏
目的:
限制用戶(hù)在特定目錄(不能看到上級(jí)或者根目錄)
只能執(zhí)行scp或者sftp拷貝特別目錄下的文件
不能SSH登陸,其它命令不能執(zhí)行
機(jī)制:
SSH登陸成功后,scponly會(huì)接管SHELL,并CHROOT到特別目錄,讓用戶(hù)“以為”這個(gè)目錄就是根目錄
它只會(huì)響應(yīng)SFTP和SCP命令
只影響配置SHELL為SCPONLY的用戶(hù),其它用戶(hù)不受影響
MAC下安裝:
LINUX下安裝SCPONLY非常簡(jiǎn)單,不多說(shuō),特說(shuō)下MAC的
GOOGLE一下scponly,下載解壓后編譯安裝:
./configure --enable-chrooted-binary --enable-rsync-compat --enable-scp-compat --enable-sftp-logging-compat --with-sftp-server=/usr/libexec/sftp-server
make clean all
sudo make install
會(huì)安裝好:/usr/local/sbin/scponlyc
用workgroup manager建立下載用戶(hù),比方說(shuō)是dnld,并配置其login shell到上述路徑
因?yàn)镃HROOT后執(zhí)行的命令都以用戶(hù)目錄/Users/dnld做為根目錄,所以要把scponly用到的scp和sftp-server兩個(gè)可執(zhí)行文件和信賴(lài)庫(kù)拷到其下。以ROOT用戶(hù)登錄,且CD至/Users/dnld,執(zhí)行以下腳本就會(huì)把這件事做好:
perl ./printlib.pl /usr/bin/scp
perl ./printlib.pl /usr/libexec/sftp-server
我寫(xiě)的腳本源碼,自動(dòng)搜索信賴(lài)關(guān)系,并在當(dāng)前目錄建立目錄結(jié)構(gòu):
#!/bin/perl
%result=();
$result{$ARGV[0]}=1;
sub addlib{
@a = `otool -L \"$_[0]\"`;
#print @a;
for $i (@a){
if ($i =~/\s*([a-z|A-Z|\.|0-9|\/|\+|\-]*)\s*/){
#print "$1\n";
$result{$1}=1;
}
}
}
$before = 1;
$after = 0;
while ($before != $after){
$before = scalar keys %result;
for $i (keys %result){
addlib($i);
}
$after = scalar keys %result;
print "before $before, after $after\n";
}
for $i (keys %result){
#print "$i\n";
if ($i =~ /(.*)\/([~\/]*)/){
system ("mkdir -p \.$1");
system ("cp $i \.$1/");
}
}
調(diào)試:
加大LOG級(jí)別:
cat 7 /usr/local/scponly/etc/scponly/debuglevel
從其它機(jī)器或者本機(jī)用dnld用戶(hù)來(lái)拷貝文件,看登陸LOG:
tail -f /var/log/*
dstruss類(lèi)似strace來(lái)看進(jìn)程在做什么
直接到SCPONLY里加LOG,這個(gè)最直接了。
posted @
2011-07-13 02:25 我愛(ài)佳娃 閱讀(786) |
評(píng)論 (0) |
編輯 收藏
brew install openssl安裝完SSL庫(kù)后,
Update the configure file for Mac OS X compatibility
- vim ./configure
- on line 6673 change the text to read
- if test -f “$dir/libssl.dylib”; then
這個(gè)是用BREW裝的SSL,貌似MAC下是64位的,這個(gè)還用不了:
./configure --enable-command-args --with-ssl-inc=/usr/local/Cellar/openssl/0.9.8r/include --with-ssl-lib=/usr/local/Cellar/openssl/0.9.8r/lib
只能用MAC自帶的成功了:
./configure --enable-command-args --with-ssl-inc=/Developer/SDKs/MacOSX10.6.sdk/usr/inclue/openssl --with-ssl-lib=/Developer/SDKs/MacOSX10.6.sdk/usr/lib
posted @
2011-06-03 21:29 我愛(ài)佳娃 閱讀(390) |
評(píng)論 (0) |
編輯 收藏
創(chuàng)建如下文件和內(nèi)容:/etc/yum.repos.d/dag.repo
運(yùn)行:yum install rrdtool
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1
posted @
2011-02-03 21:38 我愛(ài)佳娃 閱讀(1615) |
評(píng)論 (2) |
編輯 收藏
要SSH和系統(tǒng)兩邊都配置對(duì)才行,其實(shí)也很簡(jiǎn)單:
用命令:
dpkg-reconfigure locales
進(jìn)去后只選擇zh_CN.UTF-8,并設(shè)置成默認(rèn)字符集。
再到/root/.bashrc里加上:
export LC_ALL=zh_CN.UTF-8
SSH客戶(hù)端使用UTF-8字符集,如SECURECRT就在SESSION
OPTIONS->APPERANCE->CHARACTER ENCODING里選擇UTF-8
posted @
2010-05-08 09:58 我愛(ài)佳娃 閱讀(1463) |
評(píng)論 (0) |
編輯 收藏
一、設(shè)置YUM源
cd /etc/yum.repos.d/
wget http://centos.ustc.edu.cn/CentOS-Base.repo.5
mv CentOS-Base.repo.5 CentOS-Base.repo
因?yàn)槟J(rèn)的配置文件中服務(wù)器地址用的版本號(hào)是變量$releasever,所以需要將其替換為實(shí)際的版本號(hào),否則是無(wú)法連接到服務(wù)器的,當(dāng)前CentOS
最新版是5.3,所以我們修改CentOS-Base.repo
vi CentOS-Base.repo
在vi編輯器中進(jìn)行全文件替換
:%s/$releasever/5.3/
二、安裝
1:安裝apache
yum install httpd httpd-devel
2:安裝mysql
yum install mysql mysql-server mysql-devel
3:安裝php
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
4:?jiǎn)?dòng)apache
測(cè)試php
建立以下文件/var/www/html/test.php
編輯其內(nèi)容
// test.php
<?php
phpinfo();
?>
5:測(cè)試
在瀏覽器中輸入:http://IP/test.php
看是否顯示PHP的信息
6:設(shè)置開(kāi)機(jī)啟動(dòng)
chkconfig httpd on
posted @
2010-04-20 09:56 我愛(ài)佳娃 閱讀(2245) |
評(píng)論 (0) |
編輯 收藏
安裝SAMBA后,配置下面SHARE:
[popeye]
path = /
valid users = root
read only = no
public = yes
writable = yes
發(fā)現(xiàn)可以瀏覽目錄,但不可寫(xiě),查了下是SELINUX在作怪,把它禁用即可:
先實(shí)時(shí)停止它:
setenforce 0
改配置:
vi /etc/sysconfig/selinux
修改成:
SELINUX=disabled
posted @
2010-04-07 14:36 我愛(ài)佳娃 閱讀(2302) |
評(píng)論 (0) |
編輯 收藏
摘要: 經(jīng)過(guò)一段時(shí)間知識(shí)積累后,你可能想在自己的網(wǎng)站建立一個(gè)WIKI。WIKI有專(zhuān)用的格式和標(biāo)記,習(xí)慣了用M$的WORD,在它們之間轉(zhuǎn)換會(huì)相當(dāng)痛苦。
這里介紹了從各種格式文檔向WIKI轉(zhuǎn)化的辦法:點(diǎn)這里。
閱讀全文
posted @
2010-03-27 12:15 我愛(ài)佳娃 閱讀(5211) |
評(píng)論 (2) |
編輯 收藏
摘要: 講了SED的用法,特別是換行c\命令,以及多行替換。
閱讀全文
posted @
2009-09-01 10:12 我愛(ài)佳娃 閱讀(3972) |
評(píng)論 (1) |
編輯 收藏
這里有個(gè)帖子論證HIBERNATE在批量插入時(shí)性能下降,以及一些解決方式。
其核心在于批量插入時(shí),積攢一定量后就寫(xiě)庫(kù),并清除SESSION里的第一級(jí)緩存,以免后續(xù)插入操作受緩存查找而影響效率:
if ( j % batchNum2 == 0 ) {//執(zhí)行物理批量插入
session.flush();
session.clear();
}
基于JPA的事務(wù)操作,SESSION不可見(jiàn),此時(shí),需要直接調(diào)用EntityManager的flush和clear。
但EntityManager也是被封裝入JpaDaoSupport,實(shí)際的EntityManager對(duì)象也不容易取得。
此時(shí)可以用其JpaTemplate成員的execute方法來(lái)實(shí)現(xiàn)這兩個(gè)操作:
getJpaTemplate().execute(new JpaCallback() {
public Object doInJpa(EntityManager em) throws PersistenceException {
em.flush();
em.clear();
return null;
}
}, true);
在我這里測(cè)試結(jié)果:
沒(méi)有定期調(diào)用以上方法時(shí),插入50個(gè)記錄要2秒,并且隨著記錄增多,時(shí)間越來(lái)越長(zhǎng)。
每插入50個(gè)調(diào)用以上方法后,插入50個(gè)記錄小于300毫秒,且不隨記錄個(gè)數(shù)線性增長(zhǎng)。
posted @
2009-07-16 21:20 我愛(ài)佳娃 閱讀(6713) |
評(píng)論 (0) |
編輯 收藏
Linux 運(yùn)行的時(shí)候,是如何管理共享庫(kù)(*.so)的?在 Linux 下面,共享庫(kù)的尋找和加載是由 /lib/ld.so 實(shí)現(xiàn)的。 ld.so 在標(biāo)準(zhǔn)路經(jīng)(/lib, /usr/lib) 中尋找應(yīng)用程序用到的共享庫(kù)。
但是,如果需要用到的共享庫(kù)在非標(biāo)準(zhǔn)路經(jīng),ld.so 怎么找到它呢?
目前,Linux 通用的做法是將非標(biāo)準(zhǔn)路經(jīng)加入 /etc/ld.so.conf,然后運(yùn)行 ldconfig 生成 /etc/ld.so.cache。 ld.so 加載共享庫(kù)的時(shí)候,會(huì)從 ld.so.cache 查找。
傳統(tǒng)上, Linux 的先輩 Unix 還有一個(gè)環(huán)境變量 -
LD_LIBRARY_PATH 來(lái)處理非標(biāo)準(zhǔn)路經(jīng)的共享庫(kù)。ld.so 加載共享庫(kù)的時(shí)候,也會(huì)查找這個(gè)變量所設(shè)置的路經(jīng)。但是,有不少聲音主張要避免使用
LD_LIBRARY_PATH 變量,尤其是作為全局變量。這些聲音是:
*
LD_LIBRARY_PATH is not the answer -
http://prefetch.net/articles/linkers.badldlibrary.html
* Why
LD_LIBRARY_PATH is bad -
http://xahlee.org/UnixResource_dir/_/ldpath.html
*
LD_LIBRARY_PATH - just say no -
http://blogs.sun.com/rie/date/20040710
解決這一問(wèn)題的另一方法是在編譯的時(shí)候通過(guò) -R<path> 選項(xiàng)指定 run-time path。
posted @
2009-06-11 09:52 我愛(ài)佳娃 閱讀(834) |
評(píng)論 (0) |
編輯 收藏
摘要: 今天搞了一天,JAVA調(diào)用一個(gè)PERL程序,得不得就退不出,千試萬(wàn)試,LOG精細(xì)到逐行,知道在哪停住了,但打死不知道為什么。
后來(lái)吃個(gè)飯都放棄了,居然又找到答案,要沒(méi)看到它,那真以為里面有鬼了。
閱讀全文
posted @
2009-05-15 21:04 我愛(ài)佳娃 閱讀(14243) |
評(píng)論 (4) |
編輯 收藏
如需要,設(shè)置PROXY:
export http_proxy=http://127.0.0.1:3128
啟動(dòng),然后設(shè)置MIRROR,直接安裝:
perl -MCPAN -e shell
cpan> o conf urllist set http://www.perl87.cn/CPAN/
cpan> install JSON
posted @
2009-05-12 16:31 我愛(ài)佳娃 閱讀(1197) |
評(píng)論 (0) |
編輯 收藏
方法1:采用String的split,驗(yàn)證代碼如下:
import java.util.Arrays;
public class TestSplit {
public static void main(String[] args) {
String orignString = new String("5,8,7,4,3,9,1");
String[] testString = orignString.split(",");
int[] test = { 0, 0, 0, 0, 0, 0, 0 };
//String to int
for (int i = 0; i < testString.length; i++) {
test[i] = Integer.parseInt(testString[i]);
}
//sort
Arrays.sort(test);
//asc sort
for (int j = 0; j < test.length; j++) {
System.out.println(test[j]);
}
System.out.println("next ");
// desc
for (int i = (test.length - 1); i >= 0; i--) {
System.out.println(test[i]);
}
}
}
方法2:采用StringTokenizer
import java.util.Arrays;
import java.util.StringTokenizer;
public class SplitStringTest {
public static void main(String[] args) {
String s = new String("5,8,7,4,3,9,1");
int length = s.length();
//split s with ","
StringTokenizer commaToker = new StringTokenizer(s, ",");
String[] result = new String[commaToker.countTokens()];
int k = 0;
while (commaToker.hasMoreTokens()) {
result[k] = commaToker.nextToken();
k++;
}
int[] a = new int[result.length];
for (int i = 0; i < result.length; i++) {
a[i] = Integer.parseInt(result[i]);
}
//sort
Arrays.sort(a);
//asc sort
for (int j = 0; j < result.length; j++) {
System.out.println(a[j]);
}
}
}
posted @
2009-04-24 13:07 我愛(ài)佳娃 閱讀(490) |
評(píng)論 (0) |
編輯 收藏
摘要: mysqldump 是采用SQL級(jí)別的備份機(jī)制,它將數(shù)據(jù)表導(dǎo)成 SQL 腳本文件,在不同的 MySQL 版本之間升級(jí)時(shí)相對(duì)比較合適,這也是最常用的備份方法。
閱讀全文
posted @
2009-03-29 17:02 我愛(ài)佳娃 閱讀(2526) |
評(píng)論 (0) |
編輯 收藏
摘要: 在EXT里如果定義類(lèi)和擴(kuò)展類(lèi)
閱讀全文
posted @
2009-03-03 15:57 我愛(ài)佳娃 閱讀(1077) |
評(píng)論 (1) |
編輯 收藏
update user set password = password ('xxxx') where user = "root";
grant all privileges on *.* to root@'%' identified by 'xxxx';
其它參數(shù)的例子:
grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by '123';
給來(lái)自10.163.225.87的用戶(hù)joe分配可對(duì)數(shù)據(jù)庫(kù)vtdc的employee表進(jìn)行select,insert,update,delete,create,drop等操作的權(quán)限,并設(shè)定口令為123。
要重啟一次MYSQL才能使本地用戶(hù)密碼生效:
/usr/local/mysql/support-files/mysql.server restart
posted @
2009-02-12 14:31 我愛(ài)佳娃 閱讀(1655) |
評(píng)論 (0) |
編輯 收藏
由于EXTJS是用XMLHTTP來(lái)LOAD的,所以在本地會(huì)看到一直LOADING的畫(huà)面。應(yīng)該把它放到一個(gè)WEB服務(wù)器上,以HTTPD為例:
編輯文件:
/etc/httpd/conf.d/extjs.conf
內(nèi)容如下:
Alias /extjs "/point/to/real/dir/ext/"
<Directory "/point/to/real/dir/ext/">
Options Indexes
AllowOverride AuthConfig Options
Order allow,deny
Allow from all
</Directory>
重啟httpd:
service httpd restart
這樣訪問(wèn)http://hostip/extjs/docs/index.html就能在本地看EXTJS的文檔了。
注,經(jīng)下面同學(xué)回復(fù),有不用架設(shè)服務(wù)器的辦法,我搜了一下,供大家參考,本人未嘗試:
http://www.tkk7.com/mengyuan760/archive/2008/04/21/194510.html
posted @
2009-02-05 11:52 我愛(ài)佳娃 閱讀(2446) |
評(píng)論 (2) |
編輯 收藏
繼這篇?jiǎng)游餀C(jī)搭建起來(lái)后:
自己DIY了一個(gè)低功耗基于ADSL的JAVA J2EE服務(wù)器
又有新功能加入:
摘要: 以前家里動(dòng)物機(jī)長(zhǎng)開(kāi)著只是下載電影,公司封了淘寶和MSN,現(xiàn)在又可以用它從公司上網(wǎng)了。
可以使用如下模式上網(wǎng):
APP <=> HTTP TUNNEL <=> SERVER
HTTP TUNNEL有一個(gè)客戶(hù)端,它可以起一個(gè)SOCKS本地代理來(lái)接收APP數(shù)據(jù),然后打包發(fā)送到運(yùn)行在家里的HTTP TUNNEL服務(wù)端,由這個(gè)服務(wù)端程序通過(guò)ADSL出到公網(wǎng)即可。
閱讀全文
posted @
2008-12-03 17:55 我愛(ài)佳娃 閱讀(1823) |
評(píng)論 (0) |
編輯 收藏
摘要: 摘要:
本文從介紹基礎(chǔ)概念入手,探討了在C/C++中對(duì)日期和時(shí)間操作所用到的數(shù)據(jù)結(jié)構(gòu)和函數(shù),并對(duì)計(jì)時(shí)、時(shí)間的獲取、時(shí)間的計(jì)算和顯示格式等方面進(jìn)行了闡述。本文還通過(guò)大量的實(shí)例向你展示了time.h頭文件中聲明的各種函數(shù)和數(shù)據(jù)結(jié)構(gòu)的詳細(xì)使用方法。
關(guān)鍵字:UTC(世界標(biāo)準(zhǔn)時(shí)間),Calendar Time(日歷時(shí)間),epoch(時(shí)間點(diǎn)),clock tick(時(shí)鐘計(jì)時(shí)單元)
閱讀全文
posted @
2008-11-28 09:57 我愛(ài)佳娃 閱讀(15636) |
評(píng)論 (0) |
編輯 收藏
摘要: 當(dāng)ManyToMany或者M(jìn)anyToOne定義時(shí),JoinTable中referencedColumnName指向的是非主鍵(non PK columns),將 報(bào)ClassCastException。這里有個(gè)簡(jiǎn)單解決辦法。
閱讀全文
posted @
2008-10-27 17:30 我愛(ài)佳娃 閱讀(4016) |
評(píng)論 (1) |
編輯 收藏
摘要: RRD插入值的計(jì)算方式
閱讀全文
posted @
2008-09-17 21:15 我愛(ài)佳娃 閱讀(765) |
評(píng)論 (0) |
編輯 收藏
摘要: linux通過(guò)ntlm上網(wǎng)/vmware的image管理/yum更新系統(tǒng)
閱讀全文
posted @
2008-09-08 09:57 我愛(ài)佳娃 閱讀(1600) |
評(píng)論 (0) |
編輯 收藏
Ways to include code/library from another file (eval, do, require
and use)
1) do $file is like eval `cat $file`, except the former:
1.1: searches @INC.
1.2: bequeaths an *unrelated* lexical scope on the eval'ed code.
2) require $file is like do $file, except the former:
2.1: checks for redundant loading, slipping already loaded files.
2.2: raises an exception on failure to find, compile, or execute $file.
3) require Module is like require "Module.pm", except the former:
3.1: translates each "::" into your system's directory separator.
3.2: primes the parser to disambiguate class Module as an indirect object.
4) use Module is like require Module, except the former:
4.1: loads the module at compile time, not run-time.
4.2: imports symbols and semantics from that package to the current one.
eval除了可以形成動(dòng)態(tài)CODE外,還可以做異常捕捉:
eval {
...
};
if ($@) {
errorHandler($@);
}
$@在無(wú)異常時(shí)是NULL,否則是異常原因
posted @
2008-08-12 10:42 我愛(ài)佳娃 閱讀(446) |
評(píng)論 (0) |
編輯 收藏
摘要: PERL開(kāi)源打包程序PAR和PP(類(lèi)似于商業(yè)程序的perl2exe/perlapp)
閱讀全文
posted @
2008-08-11 21:13 我愛(ài)佳娃 閱讀(598) |
評(píng)論 (0) |
編輯 收藏
摘要: 在多至上萬(wàn)臺(tái)主機(jī)的系統(tǒng)中,集中定義配置,然后自動(dòng)應(yīng)用到所有主機(jī)。
閱讀全文
posted @
2008-07-28 11:12 我愛(ài)佳娃 閱讀(562) |
評(píng)論 (0) |
編輯 收藏
如下圖所示位置設(shè)置不掃描迅雷網(wǎng)絡(luò)通信即可:

posted @
2008-06-28 08:11 我愛(ài)佳娃 閱讀(3048) |
評(píng)論 (6) |
編輯 收藏
摘要: 相信很多人都有過(guò)這樣的經(jīng)驗(yàn),改一個(gè)東西可能就幾分鐘,但找到在哪改、會(huì)影響到什么地方,卻要花半小時(shí)。有了這個(gè)工具,讓我們?cè)诜浅4蟮捻?xiàng)目里,在文件和代碼的海洋里能馬上找到所要關(guān)注的部分。有的人說(shuō),我有CTRL+SHIFT+T,可是你能記住幾年前一個(gè)項(xiàng)目里的類(lèi)名嗎?而查閱文字描述的任務(wù)卻要容易得多。
Mylyn的項(xiàng)目領(lǐng)隊(duì)這樣說(shuō)道:這個(gè)新名字是向“髓磷脂”物質(zhì)致敬,該物質(zhì)通過(guò)使神經(jīng)元更有效的傳導(dǎo)電流來(lái)促進(jìn)你的思考。我們已經(jīng)聽(tīng)到使用者聲稱(chēng),Mylyn工具將他們的效率提高到了他們覺(jué)得正在以思考的速度編碼的地步。減少阻礙我們生產(chǎn)力的UI摩擦就是Mylyn項(xiàng)目全部的內(nèi)容。
此文是我之Mylyn初體驗(yàn),不搞大而全,而只把我覺(jué)得這個(gè)工具最爽、最KILLER的功能介紹出來(lái)。
閱讀全文
posted @
2008-06-15 13:02 我愛(ài)佳娃 閱讀(45464) |
評(píng)論 (7) |
編輯 收藏
摘要: # Select location bar: Ctrl/Cmd+L or Alt+D
# Select search bar: Ctrl/Cmd+K
閱讀全文
posted @
2008-06-02 12:56 我愛(ài)佳娃 閱讀(1979) |
評(píng)論 (0) |
編輯 收藏
摘要: ECLIPSE的快捷鍵非常多,如果只挑3個(gè),我就選擇它們:
1
Alt + /
自動(dòng)完成
2
Ctrl + O
Quick Outline:函數(shù)列表,可以定制這個(gè)窗口
3
Ctrl+K (加SHIFT是向上)
向下查找選中的字符串
閱讀全文
posted @
2008-06-01 16:31 我愛(ài)佳娃 閱讀(1476) |
評(píng)論 (0) |
編輯 收藏
摘要: FF是深受廣大程序員喜愛(ài),不是因?yàn)樗目欤且驗(yàn)镕IREBUG1.2版本(點(diǎn)這里)這個(gè)宇宙無(wú)敵插件,調(diào)試JS程序變成了一片小蛋糕。
最后,要說(shuō)一下FF的幾個(gè)小技巧
閱讀全文
posted @
2008-05-30 13:43 我愛(ài)佳娃 閱讀(3873) |
評(píng)論 (2) |
編輯 收藏
摘要: ASSERT是在調(diào)試與測(cè)試環(huán)境,讓程序員和測(cè)試者及時(shí)發(fā)現(xiàn)運(yùn)行時(shí)錯(cuò)誤的極簡(jiǎn)極佳之方法。
它的語(yǔ)法因?yàn)楹?jiǎn)單所以美麗。
有的文章攻擊ASSERT(點(diǎn)這里),是混淆了其使用目的的結(jié)果。
閱讀全文
posted @
2008-05-30 11:54 我愛(ài)佳娃 閱讀(2082) |
評(píng)論 (3) |
編輯 收藏
命令行:
C:\Program Files\Rational\ClearCase\bin>clearfsimport -recurse -nsetevent d:\temp\cli D:\prj\pcrf\PCFFACN\web\
SNAPVIEW時(shí),要把需加入的文件放到一臨時(shí)目錄,不能直接在SNAPVIEW對(duì)應(yīng)的目錄加入。
另外,要把需要加入的目錄先行加入到CC,如上面的cli目錄
posted @
2008-05-26 18:10 我愛(ài)佳娃 閱讀(555) |
評(píng)論 (0) |
編輯 收藏
摘要: 回調(diào)函數(shù)是相當(dāng)有用,它的意義不僅可以讓調(diào)用者控制調(diào)用函數(shù)的執(zhí)行,還可以有效的將“算法”與“數(shù)據(jù)”分離,將涉及數(shù)據(jù)的部分放入回調(diào)接口(inner class)中,算法就會(huì)相對(duì)獨(dú)立。下面是一個(gè)示例。
閱讀全文
posted @
2008-05-16 19:19 我愛(ài)佳娃 閱讀(2644) |
評(píng)論 (3) |
編輯 收藏
摘要: 平時(shí)編程中經(jīng)常遇到將多項(xiàng)內(nèi)容放入字串,然后再一一解析出來(lái)的情況,常常是這樣的字串操作不勝其煩。
我們可以使用JSON這一標(biāo)準(zhǔn)格式來(lái)組織內(nèi)容到字符串,然后現(xiàn)成的類(lèi)庫(kù)來(lái)進(jìn)行解析,準(zhǔn)確而清晰。
閱讀全文
posted @
2008-05-10 12:15 我愛(ài)佳娃 閱讀(7110) |
評(píng)論 (4) |
編輯 收藏
摘要: 描述在WEB瀏覽器端的代碼架構(gòu),主要講得是有哪些功能點(diǎn),JS代碼結(jié)構(gòu)如何劃分。
閱讀全文
posted @
2008-03-09 16:52 我愛(ài)佳娃 閱讀(1609) |
評(píng)論 (0) |
編輯 收藏
摘要: 當(dāng)我們寫(xiě)好SERVICE層的MANAGER方法后,就已經(jīng)完成業(yè)務(wù)邏輯,可以用DWR從BROWSER直接調(diào)用,不必要再寫(xiě)一個(gè)“緩沖層”,這樣的好處是避免了今后對(duì)SERVICE層的多處同時(shí)改動(dòng)。
閱讀全文
posted @
2008-03-03 20:59 我愛(ài)佳娃 閱讀(4773) |
評(píng)論 (1) |
編輯 收藏
摘要: 有時(shí)候,在SPRING中兩個(gè)類(lèi)互相含有對(duì)方的聲明,一般情況這是不允許并且極可能是有錯(cuò)誤的。
但有時(shí)候這正是我們想要的,考慮這種情況:
閱讀全文
posted @
2008-02-24 10:13 我愛(ài)佳娃 閱讀(38415) |
評(píng)論 (11) |
編輯 收藏
摘要: ACTIVEPERL在LINUX下的安裝以及PERL2EXE的使用
閱讀全文
posted @
2008-02-20 12:40 我愛(ài)佳娃 閱讀(3127) |
評(píng)論 (0) |
編輯 收藏
摘要:
閱讀全文
posted @
2008-02-03 15:06 我愛(ài)佳娃 閱讀(531) |
評(píng)論 (0) |
編輯 收藏
摘要: JPA標(biāo)準(zhǔn)+HIBERNATE實(shí)現(xiàn)+SPINRG揉和
搭建MAVEN2的內(nèi)網(wǎng)服務(wù)器:設(shè)置一個(gè)目錄在WEB服務(wù)上可以訪問(wèn)
MYSQL可以被外部機(jī)器連接
cannot connect to VM錯(cuò)誤
閱讀全文
posted @
2008-01-28 23:08 我愛(ài)佳娃 閱讀(6417) |
評(píng)論 (1) |
編輯 收藏
摘要: “編程的核心是數(shù)據(jù)結(jié)構(gòu),而不是算法”,“編程的本質(zhì)是控制復(fù)雜度”,“過(guò)早的優(yōu)化是萬(wàn)惡之源”,“寧花機(jī)器一分,不花程序員一秒”。這些UNIX的設(shè)計(jì)哲學(xué),非常值得體味。
閱讀全文
posted @
2007-12-05 17:52 我愛(ài)佳娃 閱讀(3995) |
評(píng)論 (12) |
編輯 收藏
摘要: 用PERL編寫(xiě)SOAP服務(wù)是相當(dāng)方便的,但是如果用其它語(yǔ)言來(lái)訪問(wèn)它,卻不容易,下面介紹一種不需要WSDL描述就能訪問(wèn)它的方法。
閱讀全文
posted @
2007-12-05 12:00 我愛(ài)佳娃 閱讀(3095) |
評(píng)論 (0) |
編輯 收藏