印象笔记源码分享
- 格式:ppt
- 大小:1.82 MB
- 文档页数:24
01、什么是3G02、android系统简介03、android背景介绍04、android的framewor简介05、两种虚拟机的比较06、sdk的下载以及简介07、创建android模拟器08、ddms简介09、platform-tools的简介及常见adb指令10、android项目的目录结构11、android下apk安装的过程12、常见的adb指令介绍13、创建模拟器遇到的常见错误14、电话拨号器15、点击事件的四种写法16、短信发送器17、相对布局&单位介绍18、现形布局&布局的组合19、表格布局&绝对布局20、帧布局21、测试相关概念22、android下junit测试框架配置23、logcat简介24、保存文件到手机内存25、android下文件访问的权限26、保存文件到SD卡中27、分析setting源代码获取SD卡大小28、_sharePreference入门29、xml文件的序列化30、采用pull解析xml文件31、采用断电调试的方法观察pull解析的的流程32、android下创建一个sqllite数据库33、sql语句实现数据库的增删改查34、系统api实现数据库的增删改查&Sqlite3工具的使用35、数据库的事物36、listView入门37、采用layoutInflater打气筒创建一个view对象38、采用数据适配器ArryAdapter39、常用数据适配器simpleAdapter40、数据适配器总结41、内容提供者简介42、内容提供者的实现43、短信的备份44、插入一条记录到系统短信应用45、内容观察者46、获取系统的联系人信息47、保存联系人到系统通讯录48、读取联系人的一个小细节49、网络图片查看器50、anr产生的原理&如何避免51、android消息机制入门52、网络html查看器53、字符乱码问题的处理54、采用get方式提交数据到服务器55、采用post方式提交数据到服务器56、提交数据到服务器中文乱码问题的处理57、采用httpclient提交数据到服务器58、异步http框架简介&实现原理59、异步http框架提交数据到服务器60、上传文件到服务器61、smartimageview&常见开源代码62、多线程下载的原理63、多线程断点下载的原理64、多线程java代码移植到android65、多线程下载文本页面的更新66、显示意图激活另一个activity67、隐式意图激活另一个activity68、隐式意图的配置69、隐式意图和显示意图的使用场景70、在不同activity之间数据传递71、activity的声明周期72、activity的启动模式73、activity横竖屏切换的声明周期74、开启新的activity获取他的返回值75、请求码和结果码的作用76、利用广播实现ip拨号77、短信窃听器78、自定义广播时间&发送自定义广播&广播接受者优先级79、采用服务执行长期后台操作80、采用服务窃听电话&服务的声明周期81、android进程优先级&为什么使用服务82、绑定方式开启服务&调用服务的方法83、服务的声明周期(混合开启84、采用aidl绑定远程服务85、代码注册广播接受者&利用广播调用服务的办法86、加载大图片到内存87、获取图片exif信息88、从gallery获取图片89、图片画画板90、扒开美女衣服91、图片的缩放92、图片的旋转93、图片的平移&镜面&倒影效果94、图片的合成95、图片的颜色处理96、多媒体播放api简介97、人脸识别98、mediaplayer的生命周期99、soundpoo简介100、sufaceview的生命周期101、播放在线视频102、视频播放器进度的处理103、调用系统照相机拍照和录像104、采用camera拍照105、常见对话框106、notification入门107、菜单108、android下的样式109、android下的主题110、代码编写ui111、html创建ui112、帧动画113、代码创建创建的tween动画114、xml文件定义动画115、传感器简介116、117、杀死进程118、apk的安装119、应用程序的反编译120、动态创建fragment121、用fragment创建一个选项卡122、fragment的向下兼容性123、fragment的生命周期124、fragment之间的通讯125、应用程序国际化04、android的framewor简介Wap:wait and playWireless Makeup Language(WML)精简的html语言Applications:android自带的基本上层应用Aplication framework:应用程序框架Librarics:Linux lernel:05、两种虚拟机的比较编译后文件格式:jvm:.java->.class->.jardalvik vm:.java->.dex->.odex基于的架构:jvm:基于栈的架构dalvik vm:基于寄存器的架构Cpu直接访问寄存器因此dalvik虚拟机的效率比jvm高06、sdk的下载以及简介->获取sdk工具包(sdk:standard develope kits)->ADT(android develop tools,实际上是eclipse的插件)SDK具体内容Android->SDK Plateform:开发时使用到的jar包->Samples for sdk:->ARM EABI V7a System Image:模拟器运行时的镜像->Intel n86 Aton System:模拟器运行时的镜像->MIPS System Image:模拟器运行时的镜像->google APIs:google提供的jar包,可以直接使用google提供的一些API ->source for android SDK:SDK全部的源代码Extrals:->tools:开发的工具->support library:实现高版本的android向下的兼容->google Admed Ads SDK:gongle提供的广告插件->Analyties App Irackiong SDK:应用的用户分析->cloud message:云消息->gongle play service:收费服务->google USB Driver:真实的设备驱动开发时:基于4.0,兼容2.2、2.3.307、创建android模拟器avd:android virture developerVGA:480*640(电视的标准分辨率)QVGA:240*320(四分之一)HVGA:320*480(一半)WVGA:480*800(width)FWVGA:480*854(更宽)08、ddms简介ddms:模拟器不支持中文,因此发送中文会显示不出来09、platform-tools的简介及常见adb指令Android调试桥:内部实现就是socket让两个系统之间实现数据交互->reset adb:模拟器找不到时候可以重启->adb device:列出所有的连接的设备->adb kill-server:杀死adb调试桥->adb start-server 启动adb调试桥dx.bat:将.class文件打包10、android项目的目录结构一:SDK的目录结构->Samples->Api demo:根据API demo(模拟器上面可以看见)的效果可以在sample中看见相应的代码->Source:jar包所有的sdk源代码都在这个文件夹里->SystemImage:系统镜像->temp:下载更新临时存储的文件夹,一般是空的->tools:emulater.ext 不同版本的模拟器二:New Android Application->theme:留给以后作为扩展,现在并没有太大的作用->target SDK:一般选择高版本,因为高版本对下兼容->mark project as a library:一般不选择,意思是将这个项目提供一个jar包供别人使用三:文件夹目录.setting:设置目录assets:资产目录,存放一些文件,这些文件会被原封不动打包到应用程序的apk中bin:gen:自动生成的目录->builderConfig.java:生成的配置信息->R.java:Android 4.1.2->android.jar开发环境,jar包可以在properties中修改,jar包就是SDK011、Android下apk的安装过程一、Android安装过程分析:->setContentView:甚至view的对象,把里面的xml文件加载到->在project中选择build automaticly会自动把文件生成字节码文件,.class $代表的class文件生成的是内部类->dex.bat文件会把.class文件生成.dex文件->apk压缩文件解压内部内容->META-INF:应用程序的签名eclipse的调试签名文件->res:资源文件->classes.dex:class文件->resources.arsc:资源ID映射->android软件安装的过程:->拷贝xxx.apk带/data/app/xxx-1.apk->在/data/data目录下创建一个文件夹,文件夹名称当前应用程序的报名012、常见adb指令前提:->设备连接上电脑而且驱动安装正常,如果安装不正常的话,会有黄色的问号显示;->设备上打开USB调试;指令:->adb device(如果启动发现这个程序没有安装会自动安装)->adb kill-server->adb start-server->adb uninstall <包名>->adb -s emulator-5554 install c:\\users\\administrator\\hello.apk如果有多个设备的话,如果不指定安装的是哪个设备程序会报错->adb push haha.prop /sdcard/haha.txt 将文件移到(360管家,豌豆荚之类的软件他们也是用的adb指令,倘若电脑上装这些软件的话,会因为两个adb指令抢端口号而挂掉)(adb版本之间兼容不是很好,经常报错可以考虑下版本的问题)->adb shell:远程连接到了android的linux终端ls:显示文件夹ps:显示正在运行的程序ping:网络连通性013、创建模拟器遇到的常见错误->路径最好不要有中文:->应用安装不上,或者安装模拟器的时候开启一个新的模拟器:可能是模拟器的资源被占用,模拟器在运行的时候其实占用着硬盘上面的一个文件,这个文件位于工作空间.android/avd/iphone.avd 里面会有镜像文件,当一个模拟器开启起来了,就给你创建一个文件夹.knock的文件夹,代表着这个模拟器被锁定了,如果把模拟器关掉,就没有程序占据这几个镜像资源了,那么这几个程序就会被自动删除。
黑马程序员vue案例源代码摘要:1.黑马程序员Vue案例简介2.Vue.js的简介和特点3.Vue.js在黑马程序员案例中的应用4.黑马程序员Vue案例源代码的概述5.对黑马程序员Vue案例源代码的具体分析6.结论正文:1.黑马程序员Vue案例简介黑马程序员Vue案例是一个基于Vue.js的在线购物网站案例,由黑马程序员教育团队开发。
该案例涵盖了Vue.js的基本概念和技巧,如组件、指令、计算属性、监听器、生命周期等,是一个很好的学习Vue.js的实例。
2.Vue.js的简介和特点Vue.js是一个构建用户界面的渐进式框架。
它易于上手,具有灵活的组件系统和简洁的API。
Vue.js的核心库只关注视图层,使其易于与其他库或现有项目进行集成。
Vue.js的特点包括:声明式渲染、组件化、双向数据绑定、轻量级、易于集成等。
3.Vue.js在黑马程序员案例中的应用在黑马程序员Vue案例中,开发团队充分利用了Vue.js的特点,构建了一个完整的在线购物网站。
案例涵盖了商品列表、商品详情、购物车、订单确认等模块,让学习者能够全面了解Vue.js在实际项目中的应用。
4.黑马程序员Vue案例源代码的概述黑马程序员Vue案例源代码结构清晰,遵循了Vue.js的开发规范。
源代码主要包括以下几个部分:- assets:存放项目所需的静态资源,如图片、样式等。
- components:存放项目的组件,包括页面组件和功能组件。
- router:存放项目的路由配置。
- store:存放项目的状态管理配置。
- App.vue:项目的入口文件,负责整个项目的渲染。
5.对黑马程序员Vue案例源代码的具体分析在源代码中,我们可以看到开发团队对Vue.js的各种技术的熟练运用,如组件化、单页面路由、状态管理等。
组件之间的通信和数据传递也处理得当,使得整个项目易于维护和扩展。
6.结论黑马程序员Vue案例是一个很好的学习Vue.js的项目实例。
项⽬笔记安装虚拟⼯具VMware tools⾸先,在 vmware 菜单栏中选择虚拟机----vmware tools----安装VMware Tools,在弹出的对话框中选择“安装”。
这时,在Ubuntu下会⾃动加载Linux 版的VMware Tools的安装光盘镜像。
你会看到虚拟机的桌⾯上出现了⼀个名为VMware Tools的光盘图标,并且被⾃动打开。
其中包括两个扩展名为.rpm和.tar.gz的⽂件。
.rpm⽂件是给Red Hat准备的,我们只需要.tar.gz的那个。
第⼆,将扩展名为.tar.gz的⽂件拷贝到桌⾯,⿏标右键单击,选择减压到此处第三,执⾏Ubuntu桌⾯左上⾓的Applications——附件——终端第四,具体操作:1.执⾏ sudo su 回车后,输⼊当前⽤户密码,就进⼊root权限。
2.执⾏ cd /home/jgong/vmware-tools-distrib3.执⾏ sudo ./vmware-install.pl(注意空格)4.⼀路回车,直到最后出现“Enjoy——the VMware team”的字样后,VMwareTools终于安装完成了。
第五,执⾏菜单栏---窗⼝---客户机⾃动适应窗⼝安装完成后可能密码不对sudo passwd root重设即可挂载NFS 根⽂件系统1、在linux 主机(ubuntu 10.04)上安装NFS 服务#sudo apt-get install nfs-kernel-server2、在linux 主机(ubuntu 10.04)上建⽴⼀个NFS 共享⽂件夹在/home/jgong/下建⽴⼀个名为nfs_share 的共享⽂件夹注:fusq 是主机⽤户名3、修改linux 主机(ubuntu 10.04)上NFS 配置⽂件(/etc/exports)/home/jgong/nfs_share 192.168.1.128(rw,sync,no_root_squash)/home/jgong/nfs_share 是服务器共享的⽬录192.168.1.128 是评估板的IP4、将光盘中\linux2.6.28\filesystem\urbetter-rootfs-qt-2.2.0.tgz 拷贝⾄linux 主机共享⽬录/home/jgong/nfs_share5、进⼊linux 主机nfs_share ⽬录,解压urbetter-rootfs-qt-2.2.0.tgz# sudo tar xvf urbetter-rootfs-qt-2.2.0.tgz得到根⽂件系统所需⽬录,urbetter-rootfs-qt-2.2.0.tgz 保留在nfs_share ⽬录下不动,后⾯烧写⾄nand flash 会⽤到。
import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;import no.uib.cipr.matrix.DenseMatrix;import no.uib.cipr.matrix.DenseVector;import no.uib.cipr.matrix.Matrices;import no.uib.cipr.matrix.NotConvergedException;public class elm {private DenseMatrix train_set;private DenseMatrix test_set;private int numTrainData;private int numTestData;private DenseMatrix InputWeight;private float TrainingTime;private float TestingTime;private double TrainingAccuracy, TestingAccuracy;private int Elm_Type;private int NumberofHiddenNeurons;private int NumberofOutputNeurons;private int NumberofInputNeurons;private String func;private int []label;private DenseMatrix BiasofHiddenNeurons;private DenseMatrix OutputWeight;private DenseMatrix testP;private DenseMatrix testT;private DenseMatrix Y;private DenseMatrix T;public elm(int elm_type, int numberofHiddenNeurons, String ActivationFunction){Elm_Type = elm_type;NumberofHiddenNeurons = numberofHiddenNeurons;func = ActivationFunction;TrainingTime = 0;TestingTime = 0;TrainingAccuracy= 0;TestingAccuracy = 0;NumberofOutputNeurons = 1;}public elm(){}public DenseMatrix loadmatrix(String filename) throws IOException{BufferedReader reader = new BufferedReader(new FileReader(new File(filename)));String firstlineString = reader.readLine();String []strings = firstlineString.split(" ");int m = Integer.parseInt(strings[0]);int n = Integer.parseInt(strings[1]);if(strings.length > 2)NumberofOutputNeurons = Integer.parseInt(strings[2]);DenseMatrix matrix = new DenseMatrix(m, n);firstlineString = reader.readLine();int i = 0;while (i<m) {String []datatrings = firstlineString.split(" ");for (int j = 0; j < n; j++) {matrix.set(i, j,Double.parseDouble(datatrings[j]));}i++;firstlineString = reader.readLine();}return matrix;}public void train(String TrainingData_File) throws NotConvergedException{try {train_set = loadmatrix(TrainingData_File);} catch (IOException e) {e.printStackTrace();}train();}public void train(double [][]traindata) throws NotConvergedException{//classification require a the number of classtrain_set = new DenseMatrix(traindata);int m = train_set.numRows();if(Elm_Type == 1){double maxtag = traindata[0][0];for (int i = 0; i < m; i++) {if(traindata[i][0] > maxtag)maxtag = traindata[i][0];}NumberofOutputNeurons = (int)maxtag+1;}train();}private void train() throws NotConvergedException{numTrainData = train_set.numRows();NumberofInputNeurons = train_set.numColumns() - 1;InputWeight = (DenseMatrix)Matrices.random(NumberofHiddenNeurons, NumberofInputNeurons);DenseMatrix transT = new DenseMatrix(numTrainData, 1);DenseMatrix transP = new DenseMatrix(numTrainData, NumberofInputNeurons);for (int i = 0; i < numTrainData; i++) {transT.set(i, 0, train_set.get(i, 0));for (int j = 1; j <= NumberofInputNeurons; j++)transP.set(i, j-1, train_set.get(i, j));}T = new DenseMatrix(1,numTrainData);DenseMatrix P = newDenseMatrix(NumberofInputNeurons,numTrainData);transT.transpose(T);transP.transpose(P);if(Elm_Type != 0) //CLASSIFIER{label = new int[NumberofOutputNeurons];for (int i = 0; i < NumberofOutputNeurons; i++) {label[i] = i; }DenseMatrix tempT = newDenseMatrix(NumberofOutputNeurons,numTrainData);tempT.zero();for (int i = 0; i < numTrainData; i++){int j = 0;for (j = 0; j < NumberofOutputNeurons; j++){if (label[j] == T.get(0, i))break;}tempT.set(j, i, 1);}T = newDenseMatrix(NumberofOutputNeurons,numTrainData); //T=temp_T*2-1;for (int i = 0; i < NumberofOutputNeurons; i++){for (int j = 0; j < numTrainData; j++)T.set(i, j, tempT.get(i, j)*2-1);}transT = newDenseMatrix(numTrainData,NumberofOutputNeurons);T.transpose(transT);}long start_time_train = System.currentTimeMillis();BiasofHiddenNeurons = (DenseMatrix)Matrices.random(NumberofHiddenNeurons, 1);DenseMatrix tempH = newDenseMatrix(NumberofHiddenNeurons, numTrainData);InputWeight.mult(P, tempH);//DenseMatrix ind = new DenseMatrix(1, numTrainData);DenseMatrix BiasMatrix = newDenseMatrix(NumberofHiddenNeurons, numTrainData);for (int j = 0; j < numTrainData; j++) {for (int i = 0; i < NumberofHiddenNeurons; i++) {BiasMatrix.set(i, j, BiasofHiddenNeurons.get(i, 0));}}tempH.add(BiasMatrix);DenseMatrix H = new DenseMatrix(NumberofHiddenNeurons, numTrainData);if(func.startsWith("sig")){for (int j = 0; j < NumberofHiddenNeurons; j++) { for (int i = 0; i < numTrainData; i++) {double temp = tempH.get(j, i);temp = 1.0f/ (1 + Math.exp(-temp));H.set(j, i, temp);}}}else if(func.startsWith("sin")){for (int j = 0; j < NumberofHiddenNeurons; j++) { for (int i = 0; i < numTrainData; i++) {double temp = tempH.get(j, i);temp = Math.sin(temp);H.set(j, i, temp);}}}else if(func.startsWith("hardlim")){}else if(func.startsWith("tribas")){}else if(func.startsWith("radbas")){}DenseMatrix Ht = newDenseMatrix(numTrainData,NumberofHiddenNeurons);H.transpose(Ht);Inverse invers = new Inverse(Ht);DenseMatrix pinvHt = invers.getMPInverse();OutputWeight = new DenseMatrix(NumberofHiddenNeurons, NumberofOutputNeurons);pinvHt.mult(transT, OutputWeight);long end_time_train = System.currentTimeMillis();TrainingTime = (end_time_train -start_time_train)* 1.0f/1000;DenseMatrix Yt = newDenseMatrix(numTrainData,NumberofOutputNeurons);Ht.mult(OutputWeight,Yt);Y = new DenseMatrix(NumberofOutputNeurons,numTrainData);Yt.transpose(Y);if(Elm_Type == 0){double MSE = 0;for (int i = 0; i < numTrainData; i++) {MSE += (Yt.get(i, 0) - transT.get(i, 0))*(Yt.get(i, 0) - transT.get(i, 0));}TrainingAccuracy = Math.sqrt(MSE/numTrainData);}else if(Elm_Type == 1){float MissClassificationRate_Training=0;for (int i = 0; i < numTrainData; i++) {double maxtag1 = Y.get(0, i);int tag1 = 0;double maxtag2 = T.get(0, i);int tag2 = 0;for (int j = 1; j < NumberofOutputNeurons; j++) {if(Y.get(j, i) > maxtag1){maxtag1 = Y.get(j, i);tag1 = j;}if(T.get(j, i) > maxtag2){maxtag2 = T.get(j, i);tag2 = j;}}if(tag1 != tag2)MissClassificationRate_Training ++;}TrainingAccuracy = 1 -MissClassificationRate_Training* 1.0f/numTrainData;}}public void test(String TestingData_File){try {test_set = loadmatrix(TestingData_File);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}numTestData = test_set.numRows();DenseMatrix ttestT = new DenseMatrix(numTestData, 1);DenseMatrix ttestP = new DenseMatrix(numTestData, NumberofInputNeurons);for (int i = 0; i < numTestData; i++) {ttestT.set(i, 0, test_set.get(i, 0));for (int j = 1; j <= NumberofInputNeurons; j++)ttestP.set(i, j-1, test_set.get(i, j));}testT = new DenseMatrix(1,numTestData);testP = newDenseMatrix(NumberofInputNeurons,numTestData);ttestT.transpose(testT);ttestP.transpose(testP);long start_time_test = System.currentTimeMillis();DenseMatrix tempH_test = newDenseMatrix(NumberofHiddenNeurons, numTestData);InputWeight.mult(testP, tempH_test);DenseMatrix BiasMatrix2 = newDenseMatrix(NumberofHiddenNeurons, numTestData);for (int j = 0; j < numTestData; j++) {for (int i = 0; i < NumberofHiddenNeurons; i++) {BiasMatrix2.set(i, j, BiasofHiddenNeurons.get(i, 0));}tempH_test.add(BiasMatrix2);DenseMatrix H_test = newDenseMatrix(NumberofHiddenNeurons, numTestData);if(func.startsWith("sig")){for (int j = 0; j < NumberofHiddenNeurons; j++) { for (int i = 0; i < numTestData; i++) {double temp = tempH_test.get(j, i);temp = 1.0f/ (1 + Math.exp(-temp));H_test.set(j, i, temp);}}}else if(func.startsWith("sin")){for (int j = 0; j < NumberofHiddenNeurons; j++) { for (int i = 0; i < numTestData; i++) {double temp = tempH_test.get(j, i);temp = Math.sin(temp);H_test.set(j, i, temp);}}}else if(func.startsWith("hardlim")){}else if(func.startsWith("tribas")){}else if(func.startsWith("radbas")){}DenseMatrix transH_test = newDenseMatrix(numTestData,NumberofHiddenNeurons);H_test.transpose(transH_test);DenseMatrix Yout = newDenseMatrix(numTestData,NumberofOutputNeurons);transH_test.mult(OutputWeight,Yout);DenseMatrix testY = newDenseMatrix(NumberofOutputNeurons,numTestData);Yout.transpose(testY);long end_time_test = System.currentTimeMillis();TestingTime = (end_time_test -start_time_test)* 1.0f/1000;//REGRESSIONif(Elm_Type == 0){double MSE = 0;for (int i = 0; i < numTestData; i++) {MSE += (Yout.get(i, 0) -testT.get(0,i))*(Yout.get(i, 0) - testT.get(0,i));}TestingAccuracy = Math.sqrt(MSE/numTestData);}//CLASSIFIERelse if(Elm_Type == 1){DenseMatrix temptestT = newDenseMatrix(NumberofOutputNeurons,numTestData);for (int i = 0; i < numTestData; i++){int j = 0;for (j = 0; j < NumberofOutputNeurons; j++){if (label[j] == testT.get(0, i))break;}temptestT.set(j, i, 1);}testT = newDenseMatrix(NumberofOutputNeurons,numTestData);for (int i = 0; i < NumberofOutputNeurons; i++){for (int j = 0; j < numTestData; j++)testT.set(i, j, temptestT.get(i, j)*2-1);}float MissClassificationRate_Testing=0;for (int i = 0; i < numTestData; i++) {double maxtag1 = testY.get(0, i);int tag1 = 0;double maxtag2 = testT.get(0, i);int tag2 = 0;for (int j = 1; j < NumberofOutputNeurons; j++) { if(testY.get(j, i) > maxtag1){maxtag1 = testY.get(j, i);tag1 = j;}if(testT.get(j, i) > maxtag2){maxtag2 = testT.get(j, i);tag2 = j;}}if(tag1 != tag2)MissClassificationRate_Testing ++;}TestingAccuracy = 1 -MissClassificationRate_Testing* 1.0f/numTestData;}}public double[] testOut(double[][] inpt){test_set = new DenseMatrix(inpt);return testOut();}public double[] testOut(double[] inpt){test_set = new DenseMatrix(new DenseVector(inpt));return testOut();}//Output numTestData*NumberofOutputNeuronsprivate double[] testOut(){numTestData = test_set.numRows();NumberofInputNeurons = test_set.numColumns()-1;DenseMatrix ttestT = new DenseMatrix(numTestData, 1);DenseMatrix ttestP = new DenseMatrix(numTestData, NumberofInputNeurons);for (int i = 0; i < numTestData; i++) {ttestT.set(i, 0, test_set.get(i, 0));for (int j = 1; j <= NumberofInputNeurons; j++)ttestP.set(i, j-1, test_set.get(i, j));}testT = new DenseMatrix(1,numTestData);testP = newDenseMatrix(NumberofInputNeurons,numTestData);ttestT.transpose(testT);ttestP.transpose(testP);DenseMatrix tempH_test = newDenseMatrix(NumberofHiddenNeurons, numTestData);InputWeight.mult(testP, tempH_test);DenseMatrix BiasMatrix2 = newDenseMatrix(NumberofHiddenNeurons, numTestData);for (int j = 0; j < numTestData; j++) {for (int i = 0; i < NumberofHiddenNeurons; i++) {BiasMatrix2.set(i, j, BiasofHiddenNeurons.get(i, 0));}}tempH_test.add(BiasMatrix2);DenseMatrix H_test = newDenseMatrix(NumberofHiddenNeurons, numTestData);if(func.startsWith("sig")){for (int j = 0; j < NumberofHiddenNeurons; j++) { for (int i = 0; i < numTestData; i++) {double temp = tempH_test.get(j, i);temp = 1.0f/ (1 + Math.exp(-temp));H_test.set(j, i, temp);}}}else if(func.startsWith("sin")){for (int j = 0; j < NumberofHiddenNeurons; j++) { for (int i = 0; i < numTestData; i++) {double temp = tempH_test.get(j, i);temp = Math.sin(temp);H_test.set(j, i, temp);}}}else if(func.startsWith("hardlim")){}else if(func.startsWith("tribas")){}else if(func.startsWith("radbas")){}DenseMatrix transH_test = newDenseMatrix(numTestData,NumberofHiddenNeurons);H_test.transpose(transH_test);DenseMatrix Yout = newDenseMatrix(numTestData,NumberofOutputNeurons);transH_test.mult(OutputWeight,Yout);double[] result = new double[numTestData];if(Elm_Type == 0){for (int i = 0; i < numTestData; i++)result[i] = Yout.get(i, 0);}else if(Elm_Type == 1){for (int i = 0; i < numTestData; i++) {int tagmax = 0;double tagvalue = Yout.get(i, 0);for (int j = 1; j < NumberofOutputNeurons; j++) {if(Yout.get(i, j) > tagvalue){tagvalue = Yout.get(i, j);tagmax = j;}}result[i] = tagmax;}}return result;}public float getTrainingTime() {return TrainingTime;}public double getTrainingAccuracy() {return TrainingAccuracy;public float getTestingTime() {return TestingTime;}public double getTestingAccuracy() {return TestingAccuracy;}public int getNumberofInputNeurons() {return NumberofInputNeurons;}public int getNumberofHiddenNeurons() {return NumberofHiddenNeurons;}public int getNumberofOutputNeurons() {return NumberofOutputNeurons;}public DenseMatrix getInputWeight() {return InputWeight;}public DenseMatrix getBiasofHiddenNeurons() {return BiasofHiddenNeurons;}public DenseMatrix getOutputWeight() {return OutputWeight;}//for predicting a data file based on a trained model.public void testgetoutput(String filename) throws IOException {try {test_set = loadmatrix(filename);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}numTestData = test_set.numRows();NumberofInputNeurons = test_set.numColumns() - 1;double rsum = 0;double []actual = new double[numTestData];double [][]data = newdouble[numTestData][NumberofInputNeurons];for (int i = 0; i < numTestData; i++) {actual[i] = test_set.get(i, 0);for (int j = 0; j < NumberofInputNeurons; j++) data[i][j] = test_set.get(i, j+1);}double[] output = testOut(data);BufferedWriter writer = new BufferedWriter(new FileWriter(new File("Output")));for (int i = 0; i < numTestData; i++) {writer.write(String.valueOf(output[i]));writer.newLine();if(Elm_Type == 0){rsum += (output[i] - actual[i])*(output[i] - actual[i]);}if(Elm_Type == 1){if(output[i] == actual[i])rsum ++;}}writer.flush();writer.close();if(Elm_Type == 0)System.out.println("Regression GetOutPut RMSE: "+Math.sqrt(rsum* 1.0f/numTestData));else if(Elm_Type == 1)System.out.println("Classfy GetOutPut Right:"+rsum*1.0f/numTestData);}}。
黑马程序员_javaweb讲义和笔记资料一、简介黑马程序员是一家专业的IT培训机构,提供全面的编程技术培训服务。
javaweb是其中的一门重要课程,本文为黑马程序员_javaweb讲义和笔记的资料整理。
二、javaweb基础知识1. Java语言概述Java语言的特点和优势,Java开发环境的搭建等。
2. Servlet技术Servlet的基本概念、生命周期、Servlet容器等。
3. JSP技术JSP的基本语法、JSP指令、JSP内置对象等。
4. MVC设计模式MVC设计模式在javaweb开发中的应用和实践。
三、javaweb开发流程1. 需求分析分析项目需求,明确开发目标和功能要求。
2. 数据库设计设计数据库表结构,确定数据存储方式和关系。
3. 技术选型根据项目需求和开发要求,选择合适的技术框架和工具。
4. 编码实现使用Java语言和相关技术进行编码实现。
5. 测试调试运行和调试项目,确保功能的正确性和稳定性。
6. 部署上线将项目部署到服务器上线,提供给用户访问和使用。
四、javaweb开发常用框架和工具1. Spring框架Spring框架的介绍和核心特性,以及在javaweb开发中的应用。
2. SpringMVC框架SpringMVC框架的详细讲解,包括请求映射、数据绑定、视图解析等。
3. MyBatis框架MyBatis框架的使用方法和技巧,以及与数据库的集成。
4. Maven工具Maven的基本使用和配置,常用插件介绍。
五、javaweb开发中的常见问题和解决方案1. 数据库连接异常分析数据库连接异常的原因和解决方法。
2. 页面跳转问题页面跳转的实现方式和常见错误排查。
3. 表单数据验证表单数据验证的常用技术和插件,提高数据输入的准确性和安全性。
4. 性能优化优化javaweb应用的性能,减少响应时间和资源占用。
六、实例项目提供一个实例项目,通过对该项目的讲解和分析,帮助学员理解和掌握javaweb开发的方法和技巧。
java学习心得体会_JAVA实训的心得(通用9篇)java学习_JAVA实训的心得篇11、我感觉学习java应该是循环渐进,有始有终,按部就班,脚踏实地。
java是一门有着阶梯性的一们语言,如果要学习它。
我觉得最好还是按照java的学习体系,先学习什么,在学习什么,只有这样,我们在学习中才会遇到更少的麻烦。
java是一门更倾向于网络的语言。
不要上来就学习JSP,这样不好,因为这没有基础。
在以后的学习中很可能遇到很多的麻烦,这就不好了。
2、信心,恒心,毅力是最重要的。
这是我们必须具备的心理素质。
要是学习这门语言开始的时候很有兴趣,遇到苦难就退缩,这样最终会放弃学习java,没有经历风雨怎么见彩虹。
编程就是有的时候就是那么这么人。
会遇到很多的困惑。
但是一旦你弄懂了,或者是你把问题解决了,你会感到很兴奋,编程的快乐就在此了。
3、多看看一些资料,多多的向高手请教,这样才好。
要学会总结和领会,当然,学习java一个人有一个人的想法,也有自己的独特学习方法。
总之适合自己的就是最好的。
java学习心得体会_JAVA实训的心得篇2从大三开始算,我学习java已经有一年的时间了,不过虽然时间长,但是对于现在的我还是一个初学者,懂不了多少的java初学者。
期间曾迷茫过,曾困惑过,走了不少的弯路,老师布置的试验作业每次都是不会做,每次都是要问同学,这个代码什么意思啊?为什么用这条代码,用别的不行吗?甚至后来根本没耐心问,索性就复制同学的作业交上去。
但是都是各种0分,害的同学也这样,不过他能找老师反驳,而我却没实力。
渐渐的,我认识到这样下去是不行的,我必须改正自己的学习态度和方式。
接下提到的就是我这一年来的java学习心得。
刚一开始学习java时,我就已经学习过C语言,不过C语言学的不是很好,所以开始看到java的时候我很反感,看着源代码,都不知道失什么意思。
看书的时候一看到源代码就头疼,因为根本看不懂。
那段时间根本就是一无所获,在图书馆借了一本书,关java的语法特性,与别的语言相比的优点,什么跨平台,源代码公开,什么write 、 once 、 run 、 anywhere,能说得头头是道,可是一到具体的问题,想写一些具体的东西,问题就都来了,根本不知道该怎么下手。
vscode中使⽤markdownvscode中使⽤markdownvscode 是微软推出⼀款轻量级的⽂本编辑⼯具,类似于sublime,由于其拥有丰富的插件,安装使⽤也⾮常简单,所以深受⼴⼤程序员的喜爱。
markdown 是⼀种可以使⽤普通⽂本编辑器编写的标记语⾔,通过简单的标记语法,它可以使普通⽂本内容具有⼀定的格式。
印象笔记是⼀款具有笔记、写作、⽇程管理等诸多功能为⼀体的强⼤、易⽤型笔记本,拥有⾮常丰富的插件,其中⽐较好⽤的有印象笔记·剪藏,马克飞象,具体如何使⽤,请⾃⾏查阅相关资料。
markdown有许多衍⽣产品,本⽂主要针对⼤家⽐较熟知的印象笔记为例,说明如何在vscode中使⽤markdown语法编辑⽂章,同时将⽂章同步到印象笔记中。
安装配置步骤:1.准备⼯作。
本机已安装vscode、印象笔记或者国际版Evernote,如果没有安装请⾃⾏安装以上软件。
同时,您已经注册了印象笔记或者国际版Evernote 的账号。
2.安装插件。
在vscode中安装EverMonkey,Auto-Open Markdown Preview。
vscode安装插件可以从左侧的⼯具栏中选择Extensions,或者使⽤快捷键Ctrl+Shift+X。
EverMonkey插件的作⽤是将vscode中的⽂件同步到印象笔记或者国际版Evernote。
Auto-Open Markdown Preview插件的作⽤是在vscode中,当你打开*.md格式的⽂件时,⾃动开启预览,⽅便你在编辑的过程中实时的看到结果。
3.EverMonkey配置说明。
EverMonkey插件是本⽂的重点,该插件主要负责将vscode中的⽂章同步到印象笔记。
在vscode中安装完EverMonkey插件后,我们安装官⽅说明,来⼀步⼀步的配置。
a.获取token、noteStoreUrl。
快捷键Ctrl+Shift+P,打开command,输⼊ever token,这⾥我使⽤的是国际版Evernote,所以我选择的是International。
vue php 原生写法ThingsBoard 是一款基于Java 语言开发的开源物联网平台,主要用于物联网设备的接入、数据收集、处理和展示。
下面是对ThingsBoard 源码解析的简要概述:1. 架构概述ThingsBoard 采用了分层架构设计,主要包括以下几个层次:-设备层(Device Layer):设备层主要负责与物联网设备进行通信,收集设备数据。
-数据采集层(Data Collection Layer):数据采集层负责从设备层获取数据,并进行初步处理。
-数据处理层(Data Processing Layer):数据处理层对采集到的数据进行进一步处理,如数据聚合、分析等。
-数据存储层(Data Storage Layer):数据存储层负责将处理后的数据存储到数据库中。
-应用层(Application Layer):应用层提供了丰富的功能,如数据展示、报警、统计等。
-接入层(Access Control Layer):接入层负责处理用户请求,提供安全认证、权限控制等功能。
2. 核心组件ThingsBoard 的核心组件包括以下几个:- SDK:用于设备接入,支持多种通信协议(如MQTT、CoAP 等)。
- Agent:代理组件,负责在设备端收集数据并上传。
- Gateway:网关组件,负责聚合多个设备的数据,并转发给服务器端。
- Server:服务器端主要负责处理设备请求、数据处理、存储和应用逻辑。
- Web UI:Web 用户界面,用于展示数据、提供操作界面等。
3. 数据处理流程ThingsBoard 的数据处理流程如下:-设备层通过SDK 发送数据到Agent。
- Agent 收集数据后,将数据发送到Gateway。
- Gateway 对多个设备的数据进行聚合,然后将数据发送到Server。
- Server 对接收到的数据进行处理,如数据清洗、分析等,并将处理后的数据存储到数据库中。
印象笔记chatgpt指令模板1. 背景介绍随着人工智能技术的不断发展,各种智能助手也逐渐成为人们日常生活和工作的重要辅助工具。
印象笔记作为一款集笔记管理、知识整理和团队协作于一体的应用程序,也开始引入人工智能技术,推出了chatgpt指令模板,以提升用户在笔记管理和使用过程中的便捷性和效率。
2. chatgpt指令模板的定义chatgpt指令模板是印象笔记基于开放本人评台所推出的一种人工智能辅助服务。
通过chatgpt指令模板,用户可以使用自然语言与印象笔记进行交互,轻松地实现笔记的创建、编辑、查找等操作,提高了用户在使用印象笔记的过程中的便捷性和操作效率。
3. chatgpt指令模板的功能特点3.1 自然语言交互:chatgpt指令模板支持自然语言的输入和交互,用户无需学习复杂的指令语法,简单地描述自己的需求即可完成对笔记的操作。
3.2 智能识别:chatgpt指令模板能够智能识别用户的意图和需求,并据此进行相应的操作,减少了用户的操作成本和学习成本。
3.3 多功能操作:chatgpt指令模板支持对笔记的创建、编辑、整理、查找等多种操作,满足了用户在不同场景下的需求。
3.4 学习优化:chatgpt指令模板还能够通过不断学习用户的操作习惯和偏好,从而进行个性化的推荐和建议,提供更加智能化的服务。
4. chatgpt指令模板的使用方法4.1 启用API:用户首先需要在印象笔记的设置界面中启用chatgpt指令模板的API接口,获取相应的访问密钥。
4.2 输入指令:用户可在印象笔记应用中输入相应的chatgpt指令,描述自己的需求和操作意图。
4.3 获取结果:系统会根据用户的输入识别用户的操作需求,并给出相应的操作结果,用户可根据系统的提示进行操作。
5. chatgpt指令模板的应用场景5.1 日常笔记:用户可通过chatgpt指令模板快速创建新的笔记、编辑已有笔记、整理笔记内容等。
5.2 信息查找:用户可通过chatgpt指令模板快速查找所需的笔记信息,提高了工作效率和准确性。
【图书管理系统】【MainPro包】1.系统登录页面public class Login extends Frame {private static final long serialVersionUID = -1758475247807861408L;TextField text_user;TextField text_pass;public Login() {1 this.setTitle("登录");this.setLayout(null);//默认流式布局this.setSize(260, 170);/* 定义标签与文本框*/Label lbUser = new Label("用户名:");text_user = new TextField();Label lbPass = new Label("密码:");text_pass = new TextField();Button btn_ok = new Button("确定");Button btn_cancel = new Button("取消");lbUser.setBounds(40, 53, 60, 20);//x,y,width,heightlbPass.setBounds(40, 83, 60, 20);text_user.setBounds(100, 50, 120, 20);text_pass.setBounds(100, 80, 120, 20);btn_ok.setBounds(45, 120, 80, 25); // 确定按钮btn_cancel.setBounds(135, 120, 80, 25); // 取消按钮/* 添加标签与文本框*/add(lbUser);add(lbPass);add(text_user);add(text_pass);add(btn_ok);add(btn_cancel);setLocationRelativeTo(null); // 使窗体在屏幕上居中放置this.setVisible(true); // 使窗体可见btn_ok.addActionListener((new ActionListener() {public void actionPerformed(ActionEvent e) {btn_okActionPerformed(e);//自定义确定按钮触发的实施过程}}));btn_cancel.addActionListener((new ActionListener() {public void actionPerformed(ActionEvent e) {DbOp.Close(); // 关闭数据库System.exit(0);}}));this.addWindowListener(new WindowAdapter() {/* 关闭窗口*/// 重写windowClosing()方法public void windowClosing(WindowEvent e) {DbOp.Close(); // 关闭数据库System.exit(0);} }); }public void btn_okActionPerformed(ActionEvent e) {String user = text_user.getText();String pass = text_pass.getText();String is_admin;// 如果用户名或密码任一为空,则终止后续操作if (user.equals("")||pass.equals("")) {JOptionPane.showMessageDialog(null, "用户名或密码不能为空!");return;}try {// 核对用户名和密码String sql = "select * from user where username=" + "'" + user + "' and password=" + "'" + pass + "'";ResultSet rs = DbOp.executeQuery(sql);// 如果此用户存在,则记录其状态(否:不是管理员,是:是管理员)if (rs.next()) {is_admin = rs.getString("is_admin");} else {JOptionPane.showMessageDialog(null, "用户名或密码不正确!");return;}GlobalVar.login_user = user; // 记录登录的用户名ShowMain show = new ShowMain(); // 调用主程序// 只有管理员才能使用"基础管理"和"借阅管理"菜单show.setRights(is_admin);// 释放窗体及其全部组件的屏幕资源,即使释放登录窗体dispose(); // 释放当前窗体} catch (SQLException e1) {JOptionPane.showMessageDialog(null, "用户数据库有误!");}}}2.系统首页页面public class ShowMain extends Frame {private static final long serialVersionUID = 5003296786441785470L;MenuBar menuBar;Menu jcwh, jcwh_book, jcwh_reader;//基础维护:图书维护、读者维护Menu jywh, cxgl, xtgl;//借阅维护、查询管理、系统管理MenuItemjcwh_book_add,jcwh_book_update,jcwh_book_delete,jcwh_reader_add,jcwh_reader_update,jcwh_reader_delete;MenuItem jywh_borrow, jywh_back;MenuItem cxgl_book, cxgl_reader;MenuItem xtgl_update_pass, xtgl_exit;public void setRights(String rights) {// 如果不是管理员,则禁止用户维护图书信息和读者信息以及禁止进行借阅管理,即只能查询if (rights.equals("否")) {jywh.setEnabled(false);jcwh.setEnabled(false);}}public ShowMain() {setTitle("图书管理系统");setLayout(new BorderLayout());setSize(640, 480);menuBar = new MenuBar();jcwh = new Menu("基础维护");// 基础维护菜单jcwh_book = new Menu("图书维护");// 图书维护菜单jcwh_book_add = new MenuItem("添加");// 添加图书菜单jcwh_book_update = new MenuItem("修改");// 修改图书菜单jcwh_book_delete = new MenuItem("删除");// 删除图书菜单jcwh_reader = new Menu("读者维护");// 读者维护菜单jcwh_reader_add = new MenuItem("添加读者");// 添加读者菜单jcwh_reader_update = new MenuItem("修改读者");jcwh_reader_delete = new MenuItem("删除读者");jywh = new Menu("借阅管理");jywh_borrow = new MenuItem("借书管理");jywh_back = new MenuItem("还书管理");cxgl = new Menu("查询管理");cxgl_book = new MenuItem("图书查询");cxgl_reader = new MenuItem("读者查询");xtgl = new Menu("系统管理");xtgl_update_pass = new MenuItem("修改密码");xtgl_exit = new MenuItem("退出系统");// 添加图书菜单jcwh_book.add(jcwh_book_add);jcwh_book.add(jcwh_book_update);jcwh_book.add(jcwh_book_delete);jcwh.add(jcwh_book);jcwh_reader.add(jcwh_reader_add);jcwh_reader.add(jcwh_reader_update);jcwh_reader.add(jcwh_reader_delete);jcwh.add(jcwh_reader);jywh.add(jywh_borrow);jywh.add(jywh_back);cxgl.add(cxgl_book);cxgl.add(cxgl_reader);xtgl.add(xtgl_update_pass);xtgl.add(xtgl_exit);menuBar.add(jcwh);menuBar.add(jywh);menuBar.add(cxgl);menuBar.add(xtgl);setMenuBar(menuBar);setLocationRelativeTo(null); // 使窗体在屏幕上居中放置setVisible(true); // 使窗体可见jcwh_book_add.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new BookManeger("save");} });jcwh_book_update.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new BookManeger("update");} });jcwh_book_delete.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new BookManeger("delete");} });jcwh_reader_add.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new ReaderManeger("save");} });jcwh_reader_update.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new ReaderManeger("update");} });jcwh_reader_delete.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new ReaderManeger("delete");} });jywh_borrow.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new Borrow();} });jywh_back.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new Back();} });cxgl_book.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new BookQuery();} });cxgl_reader.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new ReaderQuery();} });xtgl_update_pass.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {new UpdatePassword();} });xtgl_exit.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {DbOp.Close(); // 关闭数据库System.exit(0);}});this.addWindowListener(new WindowAdapter() {/* 关闭窗口*/// 重写windowClosing()方法public void windowClosing(WindowEvent e) {DbOp.Close(); // 关闭数据库System.exit(0);}});}}3.图书管理public class BookManeger extends JFrame {private static final long serialVersionUID = 377287301994613384L;private Label lbbookid_c = new Label("图书编号");private TextField tf_bookid_c = new TextField();private Label lbbookid = new Label("图书编号");private TextField tf_bookid = new TextField();private Label lbbookname = new Label("图书名称");private TextField tf_bookname = new TextField();private Label lbbooktype = new Label("图书类别");private Choice tf_booktype = new Choice();private Label lbauthor = new Label("作者");private TextField tf_author = new TextField();private Label lbtranslator = new Label("译者");private TextField tf_translator = new TextField();private Label lbpublisher = new Label("出版社");private TextField tf_publisher = new TextField();private Label lbpublish_time = new Label("出版时间");private TextField tf_publish_time = new TextField();private Label lbprice = new Label("定价");private TextField tf_price = new TextField();private Label lbstock = new Label("库存数量");private TextField tf_stock = new TextField();private Button queryBtn = new Button("查询");private Button saveBtn = new Button("保存");private Button closeBtn = new Button("关闭");private String optionStr;BookManeger(String str) {optionStr = str;ggFrame(optionStr);saveBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {HashMap<String, Object> map = new HashMap<String, Object>();map.put("bookid", tf_bookid);map.put("bookname", tf_bookname);map.put("booktype", tf_booktype);map.put("author", tf_author);map.put("translator", tf_translator);map.put("publisher", tf_publisher);map.put("publish_time", tf_publish_time);map.put("price", tf_price);map.put("stock", tf_stock);int i ;if(optionStr.equals("delete")){i = Jcwh.btn_delActionPerformed(e, map);}else{i = Jcwh.btn_saveActionPerformed(e, map,optionStr);}if (i == 1) {String showInfo = "";if(optionStr.equals("save")){showInfo = "图书添加成功!";}else if(optionStr.equals("update")){showInfo = "图书修改成功!";}else if(optionStr.equals("delete")){showInfo = "图书删除成功!";}JOptionPane.showMessageDialog(null, showInfo);// 清空全部文本框clearAllTextfield();}}});closeBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {dispose(); // 释放当前窗体}});/* 关闭窗口*/this.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) { // 关闭当前窗口dispose(); // 释放当前窗体}});}private void ggFrame(String str) {setLayout(null);setSize(500, 320);lbbookid.setBounds(50, 40, 50, 20); // 图书编号tf_bookid.setBounds(110, 40, 100, 20);lbbookname.setBounds(240, 40, 50, 20); // 图书名称tf_bookname.setBounds(300, 40, 100, 20);lbbooktype.setBounds(50, 80, 50, 20); // 图书类别tf_booktype.setBounds(110, 80, 100, 20);tf_booktype.add("科技");tf_booktype.add("文学");tf_booktype.add("社科");tf_booktype.add("其他");lbauthor.setBounds(240, 80, 50, 20); // 作者tf_author.setBounds(300, 80, 100, 20);lbtranslator.setBounds(50, 120, 50, 20); // 设置译者tf_translator.setBounds(110, 120, 100, 20);lbpublisher.setBounds(240, 120, 50, 20); // 出版社tf_publisher.setBounds(300, 120, 100, 20);lbpublish_time.setBounds(50, 160, 50, 20); // 出版时间tf_publish_time.setBounds(110, 160, 100, 20);lbprice.setBounds(240, 160, 50, 20); // 定价tf_price.setBounds(300, 160, 100, 20);lbstock.setBounds(50, 200, 50, 20); // 库存数量tf_stock.setBounds(110, 200, 100, 20);saveBtn.setBounds(150, 240, 80, 25); // 保存按钮closeBtn.setBounds(280, 240, 80, 25);// 关闭按钮if(str.equals("save")){setTitle("添加图书");}else if(str.equals("update")){setTitle("修改图书");lbbookid_c.setBounds(100, 10, 50, 20); // 图书编号tf_bookid_c.setBounds(160, 10, 100, 20);tf_bookid.setEditable(false);//修改的图书信息中id不可以修改queryBtn.setBounds(280, 10, 80, 20); // 查询按钮add(lbbookid_c);add(tf_bookid_c);add(queryBtn);queryBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {HashMap<String, Object> map = new HashMap<String, Object>();map.put("bookid", tf_bookid_c);Book book = (Book)Jcwh.btn_queryActionPerformed(e,map).get("book");if(book!=null){tf_bookid.setText(book.getId());tf_bookname.setText(book.getBookname());// 将Choice的选定项设置为其名称等于指定字符串的项tf_booktype.select(book.getBooktype());tf_author.setText(book.getAuthor());tf_translator.setText(book.getTranslator());tf_publisher.setText(book.getPublisher());tf_publish_time.setText(book.getPublish_time().toString());tf_price.setText(String.valueOf(book.getPrice()));tf_stock.setText(String.valueOf(book.getStock()));}}});saveBtn.setLabel("修改");//将按钮显示文字修改成“修改”}else if(str.equals("delete")){setTitle("删除图书");lbbookid_c.setBounds(100, 10, 50, 20); // 图书编号tf_bookid_c.setBounds(160, 10, 100, 20);tf_bookid.setEditable(false);//修改的图书信息中id不可以修改queryBtn.setBounds(280, 10, 80, 20); // 查询按钮add(lbbookid_c);add(tf_bookid_c);add(queryBtn);queryBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {HashMap<String, Object> map = new HashMap<String, Object>();map.put("bookid", tf_bookid_c);Book book = (Book)Jcwh.btn_queryActionPerformed(e,map).get("book");if(book!=null){tf_bookid.setText(book.getId());tf_bookname.setText(book.getBookname());// 将Choice的选定项设置为其名称等于指定字符串的项tf_booktype.select(book.getBooktype());tf_author.setText(book.getAuthor());tf_translator.setText(book.getTranslator());tf_publisher.setText(book.getPublisher());tf_publish_time.setText(book.getPublish_time().toString());tf_price.setText(String.valueOf(book.getPrice()));tf_stock.setText(String.valueOf(book.getStock()));}}});saveBtn.setLabel("删除");//将按钮显示文字修改成“删除”}add(lbbookid);add(tf_bookid);add(lbbookname);add(tf_bookname);add(lbbooktype);add(tf_booktype);add(lbauthor);add(tf_author);add(lbtranslator);add(tf_translator);add(lbpublisher);add(tf_publisher);add(lbpublish_time);add(tf_publish_time);add(lbprice);add(tf_price);add(lbstock);add(tf_stock);add(saveBtn);add(closeBtn);setLocationRelativeTo(null); // 使窗体在屏幕上居中放置setVisible(true); // 使窗体可见}private void clearAllTextfield() {tf_bookid.setText("");tf_bookname.setText("");tf_author.setText("");tf_translator.setText("");tf_publisher.setText("");tf_publish_time.setText("");tf_price.setText("");tf_stock.setText("");}}4.读者管理public class ReaderManeger extends JFrame {private static final long serialVersionUID = -2399939451497711745L;Label lbreaderid_c = new Label("读者编号");TextField tf_readerid_c = new TextField();Label lbreaderid = new Label("读者编号");TextField tf_readerid = new TextField();Label lbreadername = new Label("读者姓名");TextField tf_readername = new TextField();Label lbreadertype = new Label("读者类别");Choice tf_readertype = new Choice();Label lbsex = new Label("性别");Choice tf_sex = new Choice();Label lbmax_num = new Label("可借数量");TextField tf_max_num = new TextField();Label lbdays_num = new Label("可借天数");TextField tf_days_num = new TextField();Button queryBtn = new Button("查询");Button saveBtn = new Button("保存");Button closeBtn = new Button("关闭");private String optionStr;//保存、修改、删除ReaderManeger(String str){optionStr = str;ggFrame(optionStr);saveBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {HashMap<String, Object> map = new HashMap<String, Object>();map.put("readerid", tf_readerid);map.put("readername", tf_readername);map.put("readertype", tf_readertype);map.put("sex", tf_sex);map.put("days_num", tf_days_num);map.put("max_num", tf_max_num);int i ;if(optionStr.equals("delete")){i = Jcwh.btn_delReaderActionPerformed(e, map);}else{i = Jcwh.btn_saveReaderActionPerformed(e,map,optionStr);}if (i == 1) {String showInfo = "";if(optionStr.equals("save")){showInfo = "读者添加成功!";}else if(optionStr.equals("update")){showInfo = "读者修改成功!";}else if(optionStr.equals("delete")){showInfo = "读者删除成功!";}JOptionPane.showMessageDialog(null, showInfo);// 清空全部文本框clearAllTextfield();}}});closeBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {dispose(); // 释放当前窗体}});this.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) { // 关闭当前窗口dispose(); // 释放当前窗体}});}private void ggFrame(String str) {setLayout(null);setTitle("添加读者信息");setSize(500, 230);lbreaderid.setBounds(50, 50, 50, 20);tf_readerid.setBounds(110, 50, 100, 20);lbreadername.setBounds(240, 50, 50, 20);tf_readername.setBounds(300, 50, 100, 20);lbreadertype.setBounds(50, 80, 50, 20);tf_readertype.setBounds(110, 80, 100, 20);tf_readertype.add("教师");tf_readertype.add("学生");tf_readertype.add("职工");lbsex.setBounds(240, 80, 50, 20);tf_sex.setBounds(300, 80, 100, 20);tf_sex.add("男");tf_sex.add("女");lbmax_num.setBounds(50, 110, 50, 20);tf_max_num.setBounds(110, 110, 100, 20);lbdays_num.setBounds(240, 110, 50, 20);tf_days_num.setBounds(300, 110, 100, 20);saveBtn.setBounds(150, 150, 80, 25);closeBtn.setBounds(280, 150, 80, 25);if(str.equals("save")){setTitle("添加读者");}else if(str.equals("update")){setTitle("修改读者");lbreaderid_c.setBounds(100, 10, 50, 20);tf_readerid_c.setBounds(160, 10, 100, 20);tf_readerid.setEditable(false);queryBtn.setBounds(280, 10, 80, 20);add(lbreaderid_c);add(tf_readerid_c);add(queryBtn);queryBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {HashMap<String, Object> map = new HashMap<String, Object>();map.put("readerid", tf_readerid_c);Reader reader = (Reader)Jcwh.btn_queryReaderActionPerformed(e,map).get("reader");if(reader!=null){tf_readerid.setText(reader.getId());tf_readername.setText(reader.getReadername());tf_readertype.select(reader.getReadertype());tf_sex.select(reader.getSex());tf_days_num.setText(String.valueOf(reader.getDays_num()));tf_max_num.setText(String.valueOf(reader.getMax_num()));}}});saveBtn.setLabel("修改");//将按钮显示文字修改成“修改”}else if(str.equals("delete")){setTitle("删除图书");lbreaderid_c.setBounds(100, 10, 50, 20);tf_readerid_c.setBounds(160, 10, 100, 20);tf_readerid.setEditable(false);queryBtn.setBounds(280, 10, 80, 20);add(lbreaderid_c);add(tf_readerid_c);add(queryBtn);queryBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {HashMap<String, Object> map = new HashMap<String, Object>();map.put("readerid", tf_readerid_c);Reader reader = (Reader)Jcwh.btn_queryReaderActionPerformed(e,map).get("reader");if(reader!=null){tf_readerid.setText(reader.getId());tf_readername.setText(reader.getReadername());tf_readertype.select(reader.getReadertype());tf_sex.select(reader.getSex());tf_days_num.setText(String.valueOf(reader.getDays_num()));tf_max_num.setText(String.valueOf(reader.getMax_num()));}}});saveBtn.setLabel("删除");//将按钮显示文字修改成“删除”}add(lbreaderid);add(lbreadername);add(lbreadertype);add(lbsex);add(lbmax_num);add(lbdays_num);add(tf_readerid);add(tf_readername);add(tf_max_num);add(tf_days_num);add(tf_readertype);add(tf_sex);add(saveBtn);add(closeBtn);setLocationRelativeTo(null);setVisible(true);}private void clearAllTextfield() {tf_readerid.setText("");tf_readername.setText("");tf_max_num.setText("");tf_days_num.setText("");}public static void main(String[] args) {ReaderManeger r = new ReaderManeger("update");}}5.借书public class Borrow extends Frame {private static final long serialVersionUID = -1036076990599464079L;String SepLine = "-------------------------------------------------";Label lbbookid = new Label("图书编号");Label lbreaderid = new Label("读者编号");TextField tf_bookid = new TextField();TextField tf_readerid = new TextField();Button queryBtn = new Button("查询");Label lbbookinfo = new Label(SepLine + "图书信息" + SepLine); Label lbbookname = new Label("图书名称:");Label tf_bookname = new Label("xx");Label lbauthor = new Label("作者:");Label tf_author = new Label("xx");Label lbpublisher = new Label("出版社:");Label tf_publisher = new Label("xx");Label lbpublish_time = new Label("出版时间:");Label tf_publish_time = new Label("xx");Label lbprice = new Label("定价:");Label tf_price = new Label("xx");Label lbstock = new Label("库存数量:");Label tf_stock = new Label("xx");Label lbreaderinfo = new Label(SepLine + "读者信息" + SepLine); Label lbreadername = new Label("读者姓名:");Label tf_readername = new Label("xx");Label lbreadertype = new Label("读者类型:");Label tf_readertype = new Label("xx");Label lbmax_num = new Label("最大可借数:");Label tf_max_num = new Label("xx");Label lbdays_num = new Label("最大可借天数:");Label tf_days_num = new Label("xx");Label lbborrowinfo = new Label(SepLine + "借阅信息" + SepLine); Label lbborrowednum = new Label("该读者已借图书数量:"); Label tf_borrowednum = new Label("xx");Label lbif_borrow = new Label("该读者是否可借所选图书:"); Label tf_if_borrow = new Label("xx");Label lbborrow_date = new Label("借阅日期:");Label tf_borrow_date = new Label("xx");Button borrowBtn = new Button("借出");Button closeBtn = new Button("关闭");public Borrow() {setLayout(null);setTitle("借阅图书");setSize(500, 420);this.setForeground(Color.BLACK); // 设置前景色为黑色lbbookid.setBounds(30, 40, 50, 25); // 图书编号tf_bookid.setBounds(90, 40, 90, 20);lbreaderid.setBounds(200, 40, 50, 25); // 读者编号tf_readerid.setBounds(260, 40, 90, 20);queryBtn.setBounds(370, 40, 80, 25); // 查询按钮lbbookinfo.setBounds(30, 70, 440, 25); // 图书信息提示条lbbookname.setBounds(30, 100, 60, 25); // 图书名称tf_bookname.setBounds(90, 100, 200, 25);lbauthor.setBounds(310, 100, 60, 25); // 作者tf_author.setBounds(370, 100, 90, 25);lbpublisher.setBounds(30, 125, 60, 25); // 出版社tf_publisher.setBounds(90, 125, 200, 25);lbpublish_time.setBounds(310, 125, 60, 25); // 出版时间tf_publish_time.setBounds(370, 125, 90, 25);lbprice.setBounds(30, 150, 60, 25); // 定价tf_price.setBounds(90, 150, 200, 25);lbstock.setBounds(310, 150, 60, 25); // 库存数量tf_stock.setBounds(370, 150, 90, 25);lbreaderinfo.setBounds(30, 180, 440, 25); // 读者信息提示条lbreadername.setBounds(30, 205, 60, 25); // 读者姓名tf_readername.setBounds(90, 205, 90, 25);lbreadertype.setBounds(310, 205, 60, 25); // 读者类型tf_readertype.setBounds(370, 205, 90, 25);lbmax_num.setBounds(30, 230, 75, 25); // 最大可借数tf_max_num.setBounds(105, 230, 90, 25);lbdays_num.setBounds(310, 230, 85, 25); // 最大可借天数tf_days_num.setBounds(395, 230, 70, 25);lbborrowinfo.setBounds(30, 260, 440, 25); // 借阅信息提示条lbborrowednum.setBounds(30, 285, 120, 25);// 已借图书数量tf_borrowednum.setBounds(150, 285, 50, 25);lbif_borrow.setBounds(30, 310, 145, 25); // 是否可借tf_if_borrow.setBounds(175, 310, 50, 25);lbborrow_date.setBounds(30, 335, 60, 25);// 借书日期tf_borrow_date.setBounds(90, 335, 100, 25);borrowBtn.setBounds(160, 365, 80, 25);// 借出按钮borrowBtn.setEnabled(false); // 开始时禁用借出按钮closeBtn.setBounds(260, 365, 80, 25);// 关闭按钮queryBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) { btn_querywActionPerformed(e); } }); borrowBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) { btn_borrowActionPerformed(e); } });closeBtn.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) { setForeground(Color.BLACK); dispose(); } }); this.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {setForeground(Color.BLACK); // 设置前景色为黑色dispose(); // 关闭窗体}});add(lbbookid);add(lbreaderid);add(queryBtn);add(lbbookinfo);add(lbbookname);add(lbauthor);add(lbpublisher);add(lbpublish_time);add(lbprice);add(lbstock);add(lbreaderinfo);add(lbreadername);add(lbreadertype);add(lbmax_num);add(lbdays_num);add(lbborrowinfo);add(lbborrowednum);add(lbif_borrow);add(lbborrow_date);add(borrowBtn);add(closeBtn);setLocationRelativeTo(null); // 使窗体在屏幕上居中放置setVisible(true); // 使窗体可见setForeground(Color.RED); // 设置前景色为红色add(tf_bookid);add(tf_readerid);add(tf_bookname);add(tf_author);add(tf_publisher);add(tf_publish_time);add(tf_price);add(tf_stock);add(tf_readername);add(tf_readertype);add(tf_max_num);add(tf_days_num);add(tf_borrowednum);add(tf_if_borrow);add(tf_borrow_date);}// 图书和读者查询private void btn_querywActionPerformed(ActionEvent e) {String bookid = tf_bookid.getText();String readerid = tf_readerid.getText();// 如果图书编号或读者编号两者均为空,或者有一个为空,则返回if (bookid.equals("") || readerid.equals("")) {JOptionPane.showMessageDialog(null, "图书编号和读者编号均不能为空!");init(); // 重新初始化各参数并禁止借出按钮return;}// 按编号查询图书,结果存入book对象中Book book = BookSelect.SelectBookById(bookid);if (book != null) { // 如果查询到结果,将其显示在各文本框中tf_bookname.setText(book.getBookname());tf_author.setText(book.getAuthor());tf_publisher.setText(book.getPublisher());tf_publish_time.setText(book.getPublish_time().toString());tf_price.setText(String.valueOf((book.getPrice())));tf_stock.setText(String.valueOf(book.getStock()));} else {JOptionPane.showMessageDialog(null, "图书编号有误,查无此书!");init(); // 重新初始化各参数并禁止借出按钮return;}if (book.getStock() == 0) {JOptionPane.showMessageDialog(null, "图书已无库存,无法借阅!");init(); // 重新初始化各参数并禁止借出按钮return;}// 按编号查询读者,结果存入reader对象中Reader reader = ReaderSelect.selectReaderById(readerid);// 如果查询到结果,将其显示在各文本框中if (reader != null) {tf_readername.setText(reader.getReadername());tf_readertype.setText(reader.getReadertype());tf_max_num.setText(String.valueOf(reader.getMax_num()));tf_days_num.setText(String.valueOf(reader.getDays_num()));} else {JOptionPane.showMessageDialog(null, "读者编号有误,查无此人!");init(); // 重新初始化各参数并禁止借出按钮return;}// 查询指定读者是否已借过指定图书且未归还if (IfBorrowBack.findbook(bookid, readerid)) {JOptionPane.showMessageDialog(null, "该读者已借阅所选图书,且未归还!");init(); // 重新初始化各参数并禁止借出按钮return;}// 统计读者所借图书数量int borrowednum = statborrowednum(readerid);tf_borrowednum.setText(String.valueOf(borrowednum));// 如果读者已借图书尚未超出其允许最大借书量,则允许其继续借阅所选图书if (borrowednum < reader.getMax_num()) {tf_if_borrow.setText("是");// 创建一个简单日期格式对象,注意:MM一定要用大写SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");// 创建日期变量,其内容为当前日期Date currentdate = new Date();// 将日期按指定格式输出String borrowdate = sdf.format(currentdate);tf_borrow_date.setText(borrowdate);borrowBtn.setEnabled(true); // 使借出按钮有效} else {JOptionPane.showMessageDialog(null, "该读者借书过多,无法继续借阅!");init(); // 重新初始化各参数并禁止借出按钮return;}}// 填写借出图书记录private void btn_borrowActionPerformed(ActionEvent e) {String sql;String bookid = tf_bookid.getText();String readerid = tf_readerid.getText();String borrowdate = tf_borrow_date.getText();// 为borrow表增加借书记录sql = "insert into borrow (book_id,reader_id,"+ "borrow_date,if_back) values('" + bookid + "','" + readerid + "','" + borrowdate + "','否')";。