July 2006 Archives

一些资料

| No Comments | No TrackBacks

开源网站:

http://www.open-open.com 中文版

http://java-source.net/ 英文版

Wiring Your Web Application with Open Source Java http://www.onjava.com/pub/a/onjava/2004/04/07/wiringwebapps.html

一个开源的RSS浏览器  http://www.rssowl.org/

JAAS 与 ACL

| No Comments | No TrackBacks

Java相关文档资源

| No Comments | No TrackBacks

Portal

| No Comments | No TrackBacks

Open source projects

http://jportlet.sourceforge.net/
http://jakarta.apache.org/jetspeed/site/index.html
http://www.liferay.com/home/index.jsp
http://basicportal.com/
http://www.jahia.org/
http://jporta.sourceforge.net/
http://jakarta.apache.org/pluto

Commercial products
BEA WebLogic Portal - http://edocs.bea.com/wlp/docs81/javadoc/com/bea/portal/model/Portlet.html
IBM Websphere Portal - http://www.software.ibm.com/wsdd/zones/portal/
Oracle Portal Developer Kit - http://portalstudio.oracle.com/

其它:
PSML - http://jakarta.apache.org/jetspeed/site/psml.html
Apache Software Foundation: Jakarta JetSpeed 1.3
JetSpeed home page: http://jakarta.apache.org/jetspeed/site/index.html
JetSpeed Portlet API: http://cvs.apache.org/viewcvs/jakarta-jetspeed/proposals/portletAPI/
BEA: Web Logic Portal 4.0 http://www.bea.com/products/weblogic/portal/index.shtml
IBM: WebSphere Portal 2.1 http://www-4.ibm.com/software/webservers/portal/
iPlanet: iPlanet Portal Server 3.0 http://www.iplanet.com/products/iplanet_portal/home_portal.html
Oracle: Oracle 9i Portal http://www.oracle.com/ip/deploy/ias/portal/index.html
Apache Software Foundation: Jakarta JetSpeed 1.3
JetSpeed home page: http://jakarta.apache.org/jetspeed/site/index.html
JetSpeed Portlet API: http://cvs.apache.org/viewcvs/jakarta-jetspeed/proposals/portletAPI/
BEA: Web Logic Portal 4.0 http://www.bea.com/products/weblogic/portal/index.shtml
IBM: WebSphere Portal 2.1 http://www-4.ibm.com/software/webservers/portal/
iPlanet: iPlanet Portal Server 3.0 http://www.iplanet.com/products/iplanet_portal/home_portal.html
Oracle: Oracle 9i Portal http://www.oracle.com/ip/deploy/ias/portal/index.html
SAP Portal: http://www.iviewstudio.com
Epicentric portal: http://www.epicentric.com/solutions/products/efs/

Struts + Spring + Hibernate 框架资源

| No Comments | No TrackBacks

1.here
先来一个..Spring对于Hibernate的支持
Data Access with the Spring Framework(Hibernate)


2.史上最简单的Hibernate入门简介
在这篇文章将不涉及Eclipse, log4j, Struts, Tomcat, XDoclet,和JBoss。本文的目的是演示一下Hibernate的安装过程以及最基本的功能,从而给初学者一个低得不能再低的入门门槛

3.Spring+Hibernate+Struts技术的一个分页程序

AppFuseQuickStart


AppFuse作者Matt Raible 的BLog


一亩三分地里的appfuse - 怎么样开始学习 springframework

60 seconds to Spring



无需容器的对象关系映射--用 Hibernate 和 Spring 开发事务持久层

Struts+Sprint+hibernate 构建web应用

Spring 1.0.1 版本已经把这个插件加到了spring 核心中

插件网站首页

Struts Spring Plugin


Spring Live Blog 的相关描述
Struts Plugin for Spring in Spring's CVS

Linux学习和提高优秀书籍下载

| No Comments | No TrackBacks

Linux学习和提高优秀书籍下载(转自chinaunix)
资料整理:小文论坛( http://www.wonyen.net/bbs/mboard.asp


Linux学习和提高优秀书籍下载(第一辑)   
Linux入门

1、《Linux从入门到精通》
http://www.gouhuo.com/study/linuxbook.zip

2、 Linux 系统安全与优化中文版
这本书的英文版“Get Acquainted with Linux Security and Optimization System”(简称LinuxSOS)是Linux文档计划(Linux Document Project)中比较新的一本指南。这本书不是Linux的入门书籍,读这本书需要有Linux或者Unix的背景知识。如果你已经安装过Linux而且能够使用一些简单的Unix命令,那么这本书会对你有很大的帮助。
http://www.linuxaid.com.cn/download/training/linuxsos-cn.pdf

3、Linux安装与配置简明手册 13-Aug-2002 16:14 20M
http://cpss.zz.ha.cn/study/linux/Linux%b0%b2%d7%b0%d3%eb%c5%e4%d6%c3%bc%f2%c3%f7%ca%d6%b2%e1.zip

4、Linux编程白皮书.zip 13-Aug-2002 16:14 16M
http://cpss.zz.ha.cn/study/linux/Linux%b1%e0%b3%cc%b0%d7%c6%a4%ca%e9.zip

5、Linux网站建设技术指南 13-Aug-2002 16:14 9.2M
http://cpss.zz.ha.cn/study/linux/Linux%cd%f8%d5%be%bd%a8%c9%e8%bc%bc%ca%f5%d6%b8%c4%cf.zip

6、Linux系统分析与高级编程 13-Aug-2002 16:14 11M
http://cpss.zz.ha.cn/study/linux/Linux%cf%b5%cd%b3%b7%d6%ce%f6%d3%eb%b8%df%bc%b6%b1%e0%b3%cc%bc%bc%ca%f5.zip

7、Linux系统管理白皮书.zip 13-Aug-2002 16:14 6.8M
http://cpss.zz.ha.cn/study/linux/Linux%cf%b5%cd%b3%b9%dc%c0%ed%b0%d7%c6%a4%ca%e9.zip

8、Linux应用程序开发指南 13-Aug-2002 16:14 9.1M
http://cpss.zz.ha.cn/study/linux/Linux%d3%a6%d3%c3%b3%cc%d0%f2%bf%aa%b7%a2%d6%b8%c4%cf%a3%ba%ca%b9%d3%c3Gtk+%20Gnome%bf%e2.zip

9、Linux 24学时教程.zip 13-Aug-2002 16:14 34M
http://cpss.zz.ha.cn/study/linux/Linux%2024%d1%a7%ca%b1%bd%cc%b3%cc.zip

10、Red Hat Linux 6大全.zip 13-Aug-2002 16:15 33M
http://cpss.zz.ha.cn/study/linux/Red%20Hat%20Linux%206%b4%f3%c8%ab.zip

11、Red Hat Linux 6管理工具 13-Aug-2002 16:15 13M
http://cpss.zz.ha.cn/study/linux/Red%20Hat%20Linux%206%b9%dc%c0%ed%b9%a4%be%df.zip

12、http://www.linuxsir.org/pdf/ebook1.rar
http://www.linuxsir.org/pdf/ebook2.rar
具体文章如下:
基础建设讨论专版:
Linux管理员手册
linux入门教程
linux指令大全

红旗版区的:
红旗桌面4正式版最新使用方法和问题解答100例

Linux shell进阶应用与shell编程
命令大集合
TCSH shell 编程
Bourne Shell及shell编程
Linux Shell简介
脚本精华欣赏
使用 Bash shell 脚本进行功能测试

Linux 发行版SuSE专题
SuSE 解决方案

13、Debian的中文FAQ 600k pdf
http://linuxdoc.51.net/download/Debian_cn_FAQ.pdf

14、Linux Kernel 核心手册(中文)552k zip
http://linuxdoc.51.net/download/Linux_Kernel_cn.zip

15、Linux + Solaris 48k pdf
http://linuxdoc.51.net/download/LinuxSolaris.pdf

16、Linux SOS 1.1 1.3M pdf
http://linuxdoc.51.net/download/linuxsos-11.pdf

17、SuSE官方汉化手册 1.4M pdf
http://linuxdoc.51.net/download/suse_guanfang_hanhua.pdf

18、Linux Kernel 1.3M pdf
http://linuxdoc.51.net/download/linux_kernel.pdf

19、Linux程序员指南 337k zip
http://linuxdoc.51.net/download/linux_program.zip

20、Linux高级技巧集 72k zip
http://linuxdoc.51.net/download/linux_gaoji_jiqiao.zip

 

Linux学习和提高优秀书籍下载(第二辑)
Linux系统管理

21、Setting up a Local Area Network (EN)上载:5/9/2002
http://www.joyfire.net/compress/rh-lan.pdf

22、linux for mainframe (EN)上载:5/9/2002
http://www.joyfire.net/compress/linux4mainframe.zip

23、Linux Consultants Guide (EN)上载:1/9/2002
http://www.joyfire.net/compress/Consultants-Guide.html.tar.gz

24、LPI认证复习资料1 2 3 4 5 6 7 8上载:13/7/2002
http://www.joyfire.net/compress/l-lpi1.zip
http://www.joyfire.net/compress/l-lpi2.zip
http://www.joyfire.net/compress/l-lpi3.zip
http://www.joyfire.net/compress/l-lpi4.zip
http://www.joyfire.net/compress/l-lpi5.zip
http://www.joyfire.net/compress/l-lpi6.zip
http://www.joyfire.net/compress/l-lpi7.zip
http://www.joyfire.net/compress/l-lpi8.zip

25、Red Hat Network Basic User Reference Guide (EN)上载:13/7/2002
http://www.joyfire.net/compress/rhn-basic-urg-en-3.3.tgz

26、Red Hat Network Enterprise User Reference Guide (EN)上载:13/7/2002
http://www.joyfire.net/compress/rhn-enterprise-urg-en-1.1.tgz

27、Linux FAQ 在线浏览 上载:11/6/2002
http://www.joyfire.net/compress/Linux-FAQ.html.tar.gz
http://www.joyfire.net/Linux-FAQ/index.html

28、Linux系统分析与高级编程技术上载:4/5/2002
http://www.joyfire.net/compress/linux_advanced_technology.zip

29、RedHat Linux网络管理工具上载:4/5/2002
http://www.joyfire.net/compress/RadHat_Linux_Network_Management_Tools_CN.zip

30、Linux管理指南上载:4/5/2002
http://www.joyfire.net/compress/Linux_Management_CN.zip

31、GNU Linux 高级网络应用服务指南上载:4/5/2002
http://www.joyfire.net/compress/GNU_linux_advanced_network_Guide.zip
l
32、inux环境数据库管理员手册上载:4/5/2002
http://www.joyfire.net/compress/Linuxdb.zip

33、Complete Linux Command Reference (EN)上载:4/5/2002
http://www.joyfire.net/compress/Complete_Linux_Command_Reference.zip

34、Bugzilla-Guide (EN) 上载:20/4/2002
http://www.joyfire.net/compress/Bugzilla-Guide.html.tar.gz

35、linuxcookbook (EN) 在线浏览 上载:20/4/2002
http://www.joyfire.net/compress/linuxcookbook-1.2.html.tar.gz
http://www.joyfire.net/linuxcookbook/index.html

36、Linux HOWTO (EN)(9.8M) 在线浏览 中文版和miniHOWTO (EN) 中文版上载:13/3/2002
http://www.joyfire.net/compress/Linux-html-HOWTOs.tar.gz
http://www.joyfire.net/HOWTO/HOWTO-INDEX/howtos.html
http://www.joyfire.net/compress/newhowto_cn.zip
http://www.joyfire.net/compress/Linux-mini-html-HOWTOs-20020420.tar.gz
http://www.joyfire.net/compress/minihow_cn.zip

37、Advanced Bash-Scripting Guide(EN) 在线浏览 上载:11/3/2002
http://www.joyfire.net/compress/abs-guide.html.tar.gz
http://www.joyfire.net/abs-guid/index.html

38、Securing and Optimizing Linux RedHat Edition -A Hands on Guide(EN) 在线浏览 上载:11/3/2002
http://www.joyfire.net/compress/Securing-Optimizing-Linux-RH-Edition-v1.3.html.tar.gz
http://www.joyfire.net/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/index.html

39、CVS Best Practices(EN) 在线浏览 上载:11/3/2002
http://www.joyfire.net/compress/CVS-BestPractices.html.tar.gz
http://www.joyfire.net/CVS-BestPractices/index.html

40、The Linux System Administrators' Guide(EN) 在线浏览 中文版上载:1/1/2002。
http://www.joyfire.net/compress/sag.html.tar.gz
http://www.joyfire.net/sag/index.html
http://www.joyfire.net/compress/Linuxsys.zip

41、The Linux Network Administrator's Guide, 2e (EN) 在线浏览 上载:1/1/2002
http://www.joyfire.net/compress/nag-2.0.html.tar.gz
http://www.joyfire.net/nag2/index.html

42、Linux System Administration Made Easy (EN) 在线浏览 上载:1/1/2002
http://www.joyfire.net/compress/lame.html.tar.gz
http://www.joyfire.net/lame/index.html

43、AKA讲座(a link)上载:1/1/2002
http://bj.aka.org.cn/Lectures/index.html

44、ORACLE for linux install handbook (EN)上载:1/1/2002
http://www.joyfire.net/compress/installguide_linux102.pdf

45、Redhat 7.2 install handbook (EN)上载:1/1/2002
http://www.joyfire.net/compress/rhl-ig-x86-en-72.tgz

 


Linux学习和提高优秀书籍下载(第三辑)   
Linux代码编写

1、POSIX threads explained(EN)上载:5/9/2002
http://www.joyfire.net/compress/linuxthreads.zip

2、Emacspeak User's Guide (EN)上载:1/9/2002
http://www.joyfire.net/compress/espk-ug.html.tar.gz

3、MICO文档 (EN)上载:1/9/2002
http://www.joyfire.net/compress/mico-doc-html.tar.gz

4、GNU Autotools Guide (EN)上载:13/7/2002
http://www.joyfire.net/compress/autobook-1.3.tar.gz

5、Linux Threads FAQ 在线浏览 上载:11/6/2002
http://www.joyfire.net/compress/Threads-FAQ-html.tar.gz
http://www.joyfire.net/Threads-FAQ/index.html

6、Linux系统分析与高级编程技术上载:4/5/2002
http://www.joyfire.net/compress/linux_advanced_technology.zip

7、ELF文件格式 (EN)上载:10/5/2002
http://www.joyfire.net/compress/elf.pdf

8、Bugzilla-Guide (EN) 在线浏览 上载:20/4/2002
http://www.joyfire.net/compress/Bugzilla-Guide.html.tar.gz

9、The Linux Programmer's Guide (EN) 在线浏览 上载:11/3/2002
http://www.joyfire.net/compress/lpg.html.tar.gz
http://www.joyfire.net/lpg/index.html

10、CVS Best Practices(EN) 在线浏览 上载:11/3/2002
http://www.joyfire.net/compress/CVS-BestPractices.html.tar.gz
http://www.joyfire.net/CVS-BestPractices/index.html

11、Advanced Bash-Scripting Guide(EN) 在线浏览 上载:11/3/2002
http://www.joyfire.net/compress/abs-guide.html.tar.gz
http://www.joyfire.net/abs-guid/index.html

12、Linux设备驱动程序(CH)(Linux Device Drivers): 在线浏览 上载:1/3/2002
http://www.joyfire.net/lsdp/index.htm

13、The Linux Kernel Module Programming Guide (EN) 在线浏览 中文版上载:1/1/2002
http://www.joyfire.net/compress/lkmpg.html.tar.gz
http://www.joyfire.net/lkmpg/index.html
http://www.joyfire.net/compress/lkmpg_cn.rtf.zip

14、AKA讲座(a link)上载:1/1/2002
http://bj.aka.org.cn/Lectures/index.html

 


Linux学习和提高优秀书籍下载(第四辑)   
内核分析

1、netxiong linux内核分析笔记上载:28/7/2003
http://www.joyfire.net/compress/netxiong-linux.zip

2、CML2 Language and Tools Description(EN)上载:12/ 7/2003
http://www.joyfire.net/compress/cml2.pdf

3、Z8530 Programming Guide(EN)上载:11/ 7/2003
http://www.joyfire.net/compress/z8530book.pdf

4、Synchronous PPP and Cisco HDLC Programming Guide(EN)上载:11/ 7/2003
http://www.joyfire.net/compress/wanbook.pdf

5、Video4Linux Programming(EN)上载:11/ 7/2003
http://www.joyfire.net/compress/videobook.pdf

6、The Linux 2.4 Parallel Port Subsystem(EN)上载:11/ 7/2003
http://www.joyfire.net/compress/parportbook.pdf

7、MCA Driver Programming Interface(EN)上载:11/ 7/2003
http://www.joyfire.net/compress/mcabook.pdf

8、The Linux Kernel API(EN)上载:9/ 7/2003
http://www.joyfire.net/compress/kernel-api.pdf

9、Unreliable Guide To Hacking The Linux Kernel(EN)上载:9/ 7/2003
http://www.joyfire.net/compress/kernel-hacking.pdf

10、Unreliable Guide To Locking(EN)上载:9/ 7/2003
http://www.joyfire.net/compress/kernel-locking.pdf

11、OSDesign上载:18/3/2003
http://www.joyfire.net/compress/OSDesign-0.0.6.1.zip

12、Linux Kernel 2.4 Internals(EN)上载:18/3/2003
http://www.joyfire.net/compress/lki.html.tar.gz

13、Compiling the linux kernel(EN)上载:5/9/2002
http://www.joyfire.net/compress/compile_kernel.pdf

14、OSKit项目源代码、论文和文档上载:13/7/2002
http://www.joyfire.net/compress/oskit-20020317.tar.gz
http://www.joyfire.net/compress/oskit-papers.zip
http://www.joyfire.net/compress/oskit.html.tar.gz

15、GNU Autotools Guide (EN)上载:13/7/2002
http://www.joyfire.net/compress/autobook-1.3.tar.gz

16、Compile linux kernel (EN)上载:12/7/2002
http://www.joyfire.net/compress/compilekernel.zip

17、Intel体系结构参考手册 (EN)和Intel体系结构手册 (EN)上载:16/5/2002
http://www.joyfire.net/compress/Architecture_Reference.pdf
http://www.joyfire.net/compress/Architecture.pdf

18、IA32体系结构设计手册卷一 (EN)上载:16/5/2002
http://www.joyfire.net/compress/IA32-1.pdf

19、IA32体系结构设计手册卷二 (EN)上载:16/5/2002
http://www.joyfire.net/compress/IA32-2.pdf

20、IA32体系结构设计手册卷三 (EN)上载:16/6/2002
http://www.joyfire.net/compress/IA32-3.pdf

21、ELF文件格式 (EN)上载:10/5/2002
http://www.joyfire.net/compress/elf.pdf

22、Linux系统分析与高级编程技术上载:4/5/2002
http://www.joyfire.net/compress/linux_advanced_technology.zip

23、The Linux Kernel (EN) 在线浏览 中文版上载:10/3/2002。
http://www.joyfire.net/compress/tlk.html.tar.gz
http://www.joyfire.net/tlk/tlk.html
http://www.joyfire.net/compress/Linux_Kernel_CN.zip

24、Linux From Scratch (EN) 在线浏览 上载:10/3/2002。
http://www.joyfire.net/compress/LFS-3.1.html.tar.gz
http://www.joyfire.net/lfs/index.html

25、Linux设备驱动程序(CH)(Linux Device Drivers): 在线浏览 上载:1/3/2002

http://www.joyfire.net/lsdp/index.htm

26、华中理工大学98级研究生linux系统分析报告上载:10/2/2002。
http://www.joyfire.net/compress/98_tar.tar.gz

27、华中理工大学96级本科生linux系统分析报告上载:10/2/2002。
http://www.joyfire.net/compress/96_tar.tar.gz

28、The Linux Kernel Module Programming Guide (EN) 在线浏览 中文版上载:1/1/2002
http://www.joyfire.net/compress/lkmpg.html.tar.gz
http://www.joyfire.net/lkmpg/index.html
http://www.joyfire.net/compress/lkmpg_cn.rtf.zip

29、The Linux Kernel Hackers' Guide (EN) 在线浏览 上载:1/1/2002
http://www.joyfire.net/compress/khg.html.tar.gz
http://www.joyfire.net/khg/index.html

30、AKA讲座(a link)上载:1/1/2002。
http://bj.aka.org.cn/Lectures/index.html

ajax.js

/**
 * ajax无刷新二级联动下拉菜单(省市联动)
 *
 * @author      arcow <arcow@126.com>
 * @version     1.0
 * @lastupdate  2005-12-29
 *
 */
var http_request = false;
 function send_request(url,method) {//初始化、指定处理函数、发送请求的函数
  http_request = false;
  //开始初始化XMLHttpRequest对象
  if(window.XMLHttpRequest) { //Mozilla 浏览器
   http_request = new XMLHttpRequest();
   if (http_request.overrideMimeType) {//设置MiME类别
    http_request.overrideMimeType('text/xml');
   }
  }
  else if (window.ActiveXObject) { // IE浏览器
   try {
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
    try {
     http_request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
   }
  }
  if (!http_request) { // 异常,创建对象实例失败
   window.alert("不能创建XMLHttpRequest对象实例.");
   return false;
  }
  switch(method){
  case 1: http_request.onreadystatechange = processRequest1;break;//选择操作函数
  case 2: http_request.onreadystatechange = processRequest2;break;
  case 3: http_request.onreadystatechange = processRequest3;break;
  }
  // 确定发送请求的方式和URL以及是否同步执行下段代码
  http_request.open("GET", url, true);
  http_request.send(null);
 }
 // 处理返回信息的函数
    function processRequest1() {//操作函数1,调入省
        if (http_request.readyState == 4) { // 判断对象状态
            if (http_request.status == 200) { // 信息已经成功返回,开始处理信息
  document.getElementById("statusTxt").innerHTML="";
  addOptionGroup("province",http_request.responseText);
            } else { //页面不正常
                alert("您所请求的页面有异常。");
            }
        }else {//只要未读取完成
    document.getElementById("statusTxt").innerHTML="正则读取数据中……";
  }
    }
 
 function processRequest2() {//操作函数2,调入市
        if (http_request.readyState == 4) { // 判断对象状态
            if (http_request.status == 200) { // 信息已经成功返回,开始处理信息
  document.getElementById("statusTxt").innerHTML="";
  addOptionGroup("city",http_request.responseText);
            } else { //页面不正常
                alert("您所请求的页面有异常。");
            }
        }else {//只要未读取完成
    document.getElementById("statusTxt").innerHTML="正则读取数据中……";
  }
    }

    function processRequest3() {//操作函数3,输入省市
        if (http_request.readyState == 4) { // 判断对象状态
            if (http_request.status == 200) { // 信息已经成功返回,开始处理信息
         document.getElementById("statusTxt").innerHTML="";
         document.getElementById("district").value=http_request.responseText;
            } else { //页面不正常
                alert("您所请求的页面有异常。");
            }
        }else {//只要未读取完成
    document.getElementById("statusTxt").innerHTML="正则读取数据中……";
  }
    }

 function loadProvince() {//载入省
  send_request("select.server.php?action=province",1);//服务端处理程序,操作函数
 }
 
 function loadCity() {//载入市
     document.getElementById("district").value="";//清空文本框
     send_request("select.server.php?action=city&id="+document.getElementById("province").value,2);
 }
 
 function inputDistrict() {//向文本框输入选定的省市
     send_request("select.server.php?action=district&id="+document.getElementById("province").value+"&id1="+document.getElementById("city").value,3);
 
 }

addOption.js


 function addOption(objSelectNow,txt,val)
 {
  /// 使用W3C标准语法为SELECT添加Option
  var objOption = document.createElement("OPTION");
  objOption.text= txt;
  objOption.value=val;
  objSelectNow.options.add(objOption);
 }
 function addOptionGroup(selectId,optGroupString)
 {
  var optGroup = optGroupString.split(",");

  var objSelect = document.getElementsByTagName("SELECT");
  var objSelectNow = objSelect[selectId];
  objSelectNow.length = 1;
     /// 成组添加Options
  for (i=1; i<optGroup.length; i++)
  {
   addOption(objSelectNow, optGroup[i], i);
  }
 }
 
服务端处理程序select.server.php
 

<?php

Header("Content-type:text/html;charset=GBK");//加入头,防止乱码
$referUrl=$_SERVER['HTTP_REFERER'];//取得上一页面地址
$referHost=$_SERVER['HTTP_HOST'];//取得当前主机名
$referFile=explode("/",$referUrl);//取得上一前面的主机名$referFile[2]
if($referFile[2]!=$referHost)//如果上一页面与本服务端程序不在同一主机则禁止执行
{
exit();
}

$aryTree = file("china.txt");//加载数据文件
foreach($aryTree as $key=>$value)
 {
   $province[$key]=explode(",",trim($value));
   $city[$key]=trim($value);
 }
 
$action=$_GET["action"];
if($action=="province"||$action=="")
{//action为province时进行以下操作,输出省
$provinceStr="";
for($i=0;$i<count($province);++$i)
 {
   $provinceStr.=$province[$i][0].",";
 }
$pattern=",$";
$provinceStr=ereg_replace($pattern,"",$provinceStr);
echo $provinceStr;
}else if($action=="city"){//否则为province时输出市
$id=$_GET["id"];
echo $city[$id];
}else if($action=="district"){//否则为district,输出省市
$id=$_GET["id"];
$id1=$_GET["id1"];
echo $province[$id][0].$province[$id][$id1];
}else{//否则报错
echo "程序出错";
exit();
}
?>

前台显示页面demo.htm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ajax无刷新二级联动下拉菜单(省市联动)演示V1.0</title>
</head>
<script language="javascript" src="js/ajax.js">//加载ajax框架</script>
<script language="javascript" src="js/addOption.js">//加载对select进行操作的函数</script>

<body onload=javascript:loadProvince();>

<select name="province" id="province" onchange="javascript:loadCity();">
<option value="0" selected="selected">请选择</option>
</select>

<select name="city" id="city" onchange="javascript:inputDistrict();">
<option value="0" selected="selected">请选择</option>
</select>

<input type="text" name="district" id="district" readonly="" />
<div id=statusTxt></div>
</body>
</html>


数据文件china.txt

请选择,请选择
北京,东城,西城,崇文,宣武,朝阳,丰台,石景山,海淀,门头沟,房山,通州,顺义,昌平,大兴,平谷,怀柔,密云,延庆
上海,黄浦,卢湾,徐汇,长宁,静安,普陀,闸北,虹口,杨浦,闵行,宝山,嘉定,浦东,金山,松江,青浦,南汇,奉贤,崇明
天津,和平,东丽,河东,西青,河西,津南,南开,北辰,河北,武清,红挢,塘沽,汉沽,大港,宁河,静海,宝坻,蓟县
重庆,万州,涪陵,渝中,大渡口,江北,沙坪坝,九龙坡,南岸,北碚,万盛,双挢,渝北,巴南,黔江,长寿,綦江,潼南,铜梁,大足,荣昌,壁山,梁平,城口,丰都,垫江,武隆,忠县,开县,云阳,奉节,巫山,巫溪,石柱,秀山,酉阳,彭水,江津,合川,永川,南川
河北,石家庄,邯郸,邢台,保定,张家口,承德,廊坊,唐山,秦皇岛,沧州,衡水
山西,太原,大同,阳泉,长治,晋城,朔州,吕梁,忻州,晋中,临汾,运城
内蒙古,呼和浩特,包头,乌海,赤峰,呼伦贝尔盟,阿拉善盟,哲里木盟,兴安盟,乌兰察布盟,锡林郭勒盟,巴彦淖尔盟,鄂市
辽宁,沈阳,大连,鞍山,抚顺,本溪,丹东,锦州,营口,阜新,辽阳,盘锦,铁岭,朝阳,葫芦岛
吉林,长春,吉林,四平,辽源,通化,白山,松原,白城,延边
黑龙江,哈尔滨,齐齐哈尔,牡丹江,佳木斯,大庆,绥化,鹤岗,鸡西,黑河,双鸭山,伊春,七台河,大兴安岭
江苏,南京,镇江,苏州,南通,扬州,盐城,徐州,连云港,常州,无锡,宿迁,泰州,淮安
浙江,杭州,宁波,温州,嘉兴,湖州,绍兴,金华,衢州,舟山,台州,丽水
安徽,合肥,芜湖,蚌埠,马鞍山,淮北,铜陵,安庆,黄山,滁州,宿州,池州,淮南,巢湖,阜阳,六安,宣城,亳州
福建,福州,厦门,莆田,三明,泉州,漳州,南平,龙岩,宁德
江西,南昌市,景德镇,九江,鹰潭,萍乡,新馀,赣州,吉安,宜春,抚州,上饶
山东,济南,青岛,淄博,枣庄,东营,烟台,潍坊,济宁,泰安,威海,日照,莱芜,临沂,德州,聊城,滨州,菏泽
河南,郑州,开封,洛阳,平顶山,安阳,鹤壁,新乡,焦作,濮阳,许昌,漯河,三门峡,南阳,商丘,信阳,周口,驻马店,济源
湖北,武汉,鄂州,宜昌,荆州,襄樊,黄石,荆门,黄冈,十堰,恩施,潜江,天门,仙桃,随州,咸宁,孝感
湖南,长沙,常德,株洲,湘潭,衡阳,岳阳,邵阳,益阳,娄底,怀化,郴州,永州,湘西,张家界
广东,广州,深圳,珠海,汕头,东莞,中山,佛山,韶关,江门,湛江,茂名,肇庆,惠州,梅州,汕尾,河源,阳江,清远,潮州,揭阳,云浮
广西,南宁,柳州,桂林,梧州,北海,防城港,钦州,贵港,玉林,南宁地区,柳州地区,贺州,百色,河池
海南,海口,三亚
四川,成都,绵阳,德阳,自贡,攀枝花,广元,内江,乐山,南充,宜宾,广安,达川,雅安,眉山,甘孜,凉山,泸州
贵州,贵阳,六盘水,遵义,安顺,铜仁,黔西南,毕节,黔东南,黔南
云南,昆明,大理,曲靖,玉溪,昭通,楚雄,红河,文山,思茅,西双版纳,保山,德宏,丽江,怒江,迪庆,临沧
西藏,拉萨,日喀则,山南,林芝,昌都,阿里,那曲
陕西,西安,宝鸡,咸阳,铜川,渭南,延安,榆林,汉中,安康,商洛
甘肃,兰州,嘉峪关,金昌,白银,天水,酒泉,张掖,武威,定西,陇南,平凉,庆阳,临夏,甘南
宁夏,银川,石嘴山,吴忠,固原
青海,西宁,海东,海南,海北,黄南,玉树,果洛,海西
新疆,乌鲁木齐,石河子,克拉玛依,伊犁,巴音郭勒,昌吉,克孜勒苏柯尔克孜,博尔塔拉,吐鲁番,哈密,喀什,和田,阿克苏
香港,香港
澳门,澳门
台湾,台北,高雄,台中,台南,屏东,南投,云林,新竹,彰化,苗栗,嘉义,花莲,桃园,宜兰,基隆,台东,金门,马祖,澎湖
其它,北美洲,南美洲,亚洲,非洲,欧洲,大洋洲

红尘自有痴情者

| No Comments | No TrackBacks

红尘自有痴情者
莫笑痴情太痴狂
若非一番寒澈骨
那得梅花扑鼻香
问世间情为何物
只教人生死相许
看人间多少故事
最消魂梅花三弄
梅花一弄断人肠
梅花二弄费思量
梅花三弄风波起
云烟深处水茫茫

夏新A869

| No Comments | No TrackBacks

/////         vector.h头文件        /////

义向量及其基本运算     /////


/////////////////////////////////////////

#include<math.h>
#define MAXLENGTH 10

//向量定义
typedef struct{             
    int tag;                //行列向量标志。行向量为0,列向量为1。
    int dimension;          //向量的维数
    double elem[MAXLENGTH];    //向量的元素
}vector;

vector vecCreat(int tag, int n){
//建立维数为n的向量
    vector x;
    x.tag=tag;
    x.dimension=n;
    for(int i=0;i<n;++i){
        cout<<"请输入第"<<i+1<<"分量:";
        cin>>x.elem[i];
    }
    return x;
}

double vecMultiply(vector a, vector b){
//行向量与列向量乘法运算
    if((a.tag!=b.tag)&&(a.dimension==b.dimension)){//相乘条件
        double c=0;
        for(int i=0;i<a.dimension;++i)
            c+=a.elem[i]*b.elem[i];
        return c;
    }
}

vector vecAdd(vector a, vector b){
//向量加法运算
    if((a.tag==b.tag)&&(a.dimension==b.dimension)){//相加条件
        vector c;
        c.dimension=a.dimension;
        c.tag=a.tag;
        for(int i=0;i<c.dimension;++i)
            c.elem[i]=a.elem[i]+b.elem[i];
        return c;
    }
}

vector vecConvert(vector a){
//向量转置
    if(a.tag==0)a.tag=1;
    if(a.tag==1)a.tag=0;
    return a;
}

double vecMole(vector a){
//求向量模
    double sum=0;
    for(int i=0;i<a.dimension;++i)
        sum+=a.elem[i]*a.elem[i];
    sum=sqrt(sum);    
    return sum;
}

vector numMultiply(double n,vector a){
//数乘向量
    for(int i=0;i<a.dimension;++i)
        a.elem[i]=n*a.elem[i];
    return a;
}

void showPoint(vector x, double f){
//显示点,解.
    cout<<"--- x=(";
    for(int i=0;i<x.dimension;++i){
        cout<<x.elem[i];
        if(i!=x.dimension-1)cout<<",";
    }
    cout<<") --- f(x)="<<f<<endl;
    cout<<endl;    
}
/////////////////////////////////////////////////////////
////////////// function.h头文件 /////////////////////////
//////// 函数及其导数的设置均在此文件完成////////////////
/////////////////////////////////////////////////////////
// * 无 约 束 问 题 *                                  //
// 目标函数--在vecFun(vector vx)中修改,x1改成x[1]      //
//              x2改成x[2],依此类推...                 //
/////////////////////////////////////////////////////////

#include <iostream.h>
#include "vector.h"
#define SIZE 10
#define MAX 1e300

double min(double a, double b){
//求两个数最小
    return a<b?a:b;
}

double max(double a, double b){
//求两个数最大
    return a>b?a:b;
}

vector vecGrad(double (*pf)(vector x),vector pointx){
//求解向量的梯度
//采用理查德外推算法计算函数pf在pointx点的梯度grad;
    vector grad;
    grad.tag=1; grad.dimension=pointx.dimension;//初始化偏导向量
    vector tempPnt1,tempPnt2;           //临时向量
    double h=1e-3;
    for(int i=0;i<pointx.dimension;++i){
        tempPnt1=tempPnt2=pointx;
        tempPnt1.elem[i]+=0.5*h;
        tempPnt2.elem[i]-=0.5*h;
        grad.elem[i]=(4*(pf(tempPnt1)-pf(tempPnt2)))/(3*h);
        tempPnt1.elem[i]+=0.5*h;
        tempPnt2.elem[i]-=0.5*h;
        grad.elem[i]-=(pf(tempPnt1)-pf(tempPnt2))/(6*h);
    }
    return grad;
}

double vecFun(vector vx){
//最优目标多元函数
    double x[SIZE];
    for(int i=0;i<vx.dimension;++i)
        x[i+1]=vx.elem[i];
    //----------约束目标函数--------------
    //return x[1]*x[1]+x[2]*x[2];
    //----------无约束正定函数--------------
    //return x[1]*x[1]+4*x[2]*x[2]+9*x[3]*x[3]-2*x[1]+18*x[3];//例一
    //----------无约束非二次函数--------------
    //return (1-x[1])*(1-x[1])+(1-x[4])*(1-x[4])+(x[1]*x[1]-x[2])*(x[1]*x[1]-x
[2])+(x[2]*x[2]-x[3])*(x[2]*x[2]-x[3])+(x[3]*x[3]-x[4])*(x[3]*x[3]-x[4]);//例二

}

double vecFun_Si(vector vx){
//不等式约束函数
    double x[SIZE];
    for(int i=0;i<vx.dimension;++i)
        x[i+1]=vx.elem[i];
    return x[1]+1;//不等式约束函数
}

double vecFun_Hi(vector vx){
//等式约束函数
    double x[SIZE];
    for(int i=0;i<vx.dimension;++i)
        x[i+1]=vx.elem[i];
    return x[1]+x[2]-2;//等式约束函数
}

double vecFun_S(vector x,double v,double l,double u){
//约束问题转化为无约束问题的增广目标函数F(x,v,l,u)
    double sum1=0,sum2=0,sum3=0;//分别定义三项的和
    //sum1
    double temp=max(0,v-2*u*vecFun_Si(x));
    sum1=(temp*temp-v*v)/(4*u);
    //sum2
    sum2=l*vecFun_Hi(x);
    //sum3
    sum3=u*vecFun_Hi(x)*vecFun_Hi(x);    
    //F(x,v,l,u)=f(x)+sum1-sum2+sum3
    return vecFun(x)+sum1-sum2+sum3;
}

vector vecFunD_S(vector x,double v,double l,double u){//利用重载函数实现目标函
数F(x,v,l,u)的导数
//约束问题转化为无约束问题的增广目标函数F(x,v,l,u)的导函数
    vector sum1,sum2,sum3;//分别定义三项导数的和
    //sum1
    sum1.dimension=x.dimension;    sum1.tag=1;
    sum2.dimension=x.dimension;    sum2.tag=1;
    sum3.dimension=x.dimension;    sum3.tag=1;
    double temp=max(0,v-2*u*vecFun_Si(x));
    if(temp==0){
        for(int i=0;i<sum1.dimension;++i)
            sum1.elem[i]=0;
    }
    else{
        sum1=numMultiply(-(v-2*u*vecFun_Si(x)),vecGrad(vecFun_Si,x));
    }
    //-sum2
    sum2=numMultiply(-l,vecGrad(vecFun_Hi,x));
    //sum3
    sum3=numMultiply(2*u*vecFun_Hi(x),vecGrad(vecFun_Hi,x));    
    //F=f(x)+sum1-sum2+sum3
    return vecAdd(vecAdd(vecGrad(vecFun,x),sum1),vecAdd(sum2,sum3));
}
///////////////////////////////////////////////////
/////            nonrestrict.h头文件          /////
/////  包含无约束问题的求解函数: 直线搜索     /////
/////         共轭梯度法,H终止准则            /////
///////////////////////////////////////////////////
#include "restrict.h"

vector lineSearch(vector x, vector p ,double t){
//从点x沿直线p方向对目标函数f(x)作直线搜索得到极小点x2,t为初始步长。
    vector x2;
    double l=0.1,n=0.4;         //条件1和2的参数  
    double a=0,b=MAX;           //区间 
    double f1=0,f2=0,g1=0,g2=0;
    int i=0;                    //迭代次数
    do{
        if(f2-f1>l*t*g1){b=t;t=(a+b)/2;}         //改变b,t循环
        do{
            if(g2<n*g1){a=t;t=min((a+b)/2,2*a);} //改变a,t循环
            f1=vecFun(x);                                   //f1=f(x)
            g1=vecMultiply(vecConvert(vecGrad(vecFun,x)),p);//g1=∨f(x)*p
            x2=vecAdd(numMultiply(t,p),x);                  //x2=x+t*p
            if(i++ && vecFun(x2)==f2){return x2;}           //【直线搜索进入无
限跌代,则此次跌代结束。返回当前最优点】
            f2=vecFun(x2);                                  //f2=f(x2)
            g2=vecMultiply(vecConvert(vecGrad(vecFun,x2)),p);      //g2=∨f(x2
)*p    
            //cout<<"("<<x2.elem[0]<<","<<x2.elem[1]<<","<<x2.elem[2]<<","<<x2
.elem[3]<<");"; //输出本次结果
            //cout<<"t="<<t<<";";
            //cout<<"f(x)="<<f2<<endl;
        }
        while(g2<n*g1);      //不满足条件ii,则改变a,t循环
    }
    while(f2-f1>l*t*g1);     //不满足条件i,则改变b,t循环
    return x2;
}

int Himmulblau(vector x0, vector x1, double f0, double f1){
//H终止准则.给定Xk,Xk+1,Fk,Fk+1,判断Xk+1是否是极小点.返回1是极小,否则返回0
    double c1,c2,c3;//定义并初始化终止限
    c1=c2=10e-5;
    c3=