mercredi 23 novembre 2011

【转】JSP 同一个form,不同的按钮提交到不同的jsp 页面进行处理


问题:在一个JSP页面中需要多个提交按钮,每个按钮点击后需要把同一个form提交到不同的页面进行处理
解决:用JS。
<html>
<head>
<title>一个表单、多个提交按钮、提交到多个不同页面</title>
</head>
<script>
function sm1(){
   document.getElementByIdx("form1").action="1.jsp";
   document.getElementByIdx("form1").submit();
}
function sm2(){
   document.getElementByIdx("form1").action="2.jsp";
   document.getElementByIdx("form1").submit();
}
</script>
<body>
<form action="" method="post" id="form1">
 <input name="mytext" type="text" id="mytext" />
 <input name="bt1" type="button" id="bt1" value="提交到1.jsp" onclick="sm1()" />
 <input name="bt2" type="button" id="bt2" value="提交到2.jsp" onclick="sm2()" />
</form>
</body>
</html>

原文地址:http://blog.sina.com.cn/s/blog_60328aa70100di5a.html

dimanche 16 octobre 2011

pdf 记录上次阅读信息


adobe reader :
编辑--------首选项--------文档----------“文档重新打开时恢复上次设置”选项前打勾
每次打开文档都是上次最后阅读的地方!

lundi 19 septembre 2011

两个电脑通过网线相互连接,共享网络


最正确,最完整做法:

将两台机器其中的一台机器作为主机(以后称为A)装上网卡两块,另一台用作客户机(称为B)。将A上其中一块网卡与B的网卡相连,A上另外一块网卡与ADSL modem相连,好了硬件的安装就完成了,下面开始进行软件的配置。
先设置主机A:
点击[开始]--[控制面板]--[网络连接](或者直接在桌面上右键点击网上邻居,在弹出菜单中选择属性即可),右击代表连接ADSL modem的网络连接(网卡1.),选择属性。在常规选项卡中找到tcp/ip协议并双击。将IP设为自动获取,DNS可以自动,也可以设置为当地网通的。相同的操作方法设置连接客户机B的网卡2.,IP应该取192.168.0.1,不要设置网关(有了网关,就变成网桥),主DNS取当地网通的,辅DNS取192.168.0.1。
再来设置客户机B:
客户机IP取192.168.0.2,网关192.168.0.1,DNS与A的网卡2.相同。
    基本配置完成后,现在还不具备B机访问INTERNET的功能,不过两台机器已经可以互相访问了(彼此应该在网上邻居里面找到)。下面在A的网络连接中选择ADSL的拨号连接,右键选择属性,在高级选项卡中可以看到Inertnet连接共享的选项,在“允许其它网络用户通过此计算机的internet连接来连接”前面挑勾,下方的家庭网络连接选择网卡2.的连接,再下面的两个选项大家就根据自己的需要设置吧。设定好后点击确定,等待一会系统此时会进行共享设置。当设置完成后您的两台电脑都应改可以访问internet了。

补充:继上次成功网卡直连,让B电脑上网,发布文库文档之后,先后用了两次B电脑,一次失败,一次成功。说明除了前文档所说之外,还有一些注意事项。
失败这次,因为A电脑在使用中,只确定和《网卡直连……》中确定一致。A电脑首先拨号的,断网,B电脑打开网页,A电脑不自动拨号。
成功这次,首先在A电脑中取消了ADSL连接高级选项中的共享,关闭再打开,然后重新选取共享,并在其下的设置中勾选全部协议。另外,在B电脑中浏览器-工具-ie选项-连接中,将ADSL设置为“从不拨号连接”。然后我是打开B电脑,打开网页,然后A电脑自动拨号,然后两部电脑都能正常上网!

mercredi 3 août 2011

install pgp on Mac OS X

1: Begin by downloading and verifying the GnuPG archives from
<http://www.gnupg.org/>.  Here's what to type:

curl -O ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.11.tar.gz
curl -O ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.11.tar.gz.sig

2: To verify:

gpg --verify gnupg-1.4.11.tar.gz.sig

or, if you don't have an older copy of GnuPG or another OpenPGP program
(NEVER verify the version of GnuPG you download with itself), use the SHA-1
checksums found on the GnuPG Web site and compare with the checksum from:

openssl sha1 gnupg-1.4.11.tar.gz

3: Next, untar GnuPG:

tar -xzf gnupg-1.4.11.tar.gz

And move into the GnuPG directory:

cd gnupg-1.4.11

4: Now you need to set up GnuPG to build on your system.  You do this by
running configure:

./configure

5: Once you have everything configured, it's time to compile GnuPG by running:

make

6: If all tests pass, the only thing left to do is type:

sudo make install

Reference: http://macgpg.sourceforge.net/docs/howto-build-gpg-osx.txt.asc

[FW] Installing GLPK on a Mac


So you want copy-paste instructions to install GLPK on your Macbook? Here are the steps:


  1. Download the latest version of GLPK fromhttp://www.gnu.org/software/glpk/#downloading
  2. Optional: Follow the instructions to verify the download (you might need to get GNU Privacy Guard or gpg for this. You can get it at http://gnupg.org);
    The GLPK distribution tarball can be found on http://ftp.gnu.org/gnu/glpk/ [via http] and ftp://ftp.gnu.org/gnu/glpk/ [via FTP]. It can also be found on one of our FTP mirrors; please use a mirror if possible.
    To make sure that the GLPK distribution tarball you have downloaded is intact you need to download the corresponding .sig file and run a command like this:
    gpg --verify glpk-4.32.tar.gz.sig

    If that command fails because you do not have the required public key, run the following command to import it:
    gpg --keyserver keys.gnupg.net --recv-keys 5981E818

    and then re-run the previous command.
    (if gpg is not installed, refer to: http://hichenwang.blogspot.com/2011/08/install-pgp-on-mac-os-x.html)
  3. Say it’s downloaded to your “Downloads” directory, go there and execute the following commands (using the terminal)
    1.cd ~/Downloads
    2.tar -xzf glpk-4.43.tar.gz
    3../configure --prefix=/usr/local # see note [1]
    4.make
    5.sudo make install
  4. At this point, you should have GLPK installed. Verify it:
    1.which glpsol
    2./usr/local/bin/glpsol
  5. … and try help:
    1.glpsol --help
Now that you are all set-up, read up this excellent introduction using GLPK:http://www.ibm.com/developerworks/linux/library/l-glpk1
Notes:
[1]: HiveLogic article on why using /usr/local is better
[2] If you want MySQL support (or something “extra”) check out the INSTALL file in the package

mardi 26 juillet 2011

Restart Apache in Mac OS X

To restart the Apache webserver service you can run the following command in a Mac OS X Terminal window:

sudo /usr/sbin/apachectl restart

if you have the following error:

/usr/sbin/apachectl: line 73: ulimit: open files: cannot modify limit: Invalid argument


follow the instructions:


Luckily the world is a big place and someone had already fixed the problem.
Just open up /usr/sbin/apachectl and change (around line 64):

ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"

to

ULIMIT_MAX_FILES=""


ref: http://www.justinball.com/2010/11/23/apachectl-stopped-working-after-mac-osx-10-6-5/

jeudi 21 juillet 2011

install wget in mac os x

wget is great command line *nix program for grabbing things from the web, but it doesn’t ship with macs. It’s also not a part of the developer tools package. Here’s the steps I used to build and install wget on my mac.

Grab the wget source code from http://ftp.gnu.org/pub/gnu/wget/wget-1.9.1.tar.gz (or get the latest here) . Open a terminal window and follow along:

tar xzf wget-1.9.1.tar.gz
cd wget-1.9.1
./configure
make
sudo make install
The wget binary should now be in your /usr/local/bin folder. Let’s also put /usr/local/bin in the shell path so we can type wget from the command line rather than the tedious /usr/local/bin/wget when we want to run the program. This is accomplished by editing ~/.bash_profile to add the following line:

PATH=$PATH:/usr/local/bin; export PATH

To get the shell to re-read this file again, type source ~/.bash_profile. Now whenever you start the terminal, /usr/local/bin will be in the path.

The other part of installing wget that needs a tweak is wget’s manual page isn’t found when running man wget from the terminal. To resolve this we need to edit the man configuration file.
 
sudo nano /usr/share/misc/man.conf

Scroll down a bit and below all the other lines beginning with MANPATH, add:
MANPATH /usr/local/man