摘要:<!DOCTYPE html PUBLIC "-//W3C//DTDXHTML 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=utf
阅读全文
摘要:下面是在JAVA中与MySQL建立连接的一个模块:package com.han; import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException; /** * SQL connection module * @author HAN * */
public class Conn { Connection con;//Declare a Connection object String driver="com.mysql.jdbc.Driver";// the My
阅读全文
摘要:STLmapMap是一种关联容器,它的内部组织形式是一颗红黑树(非严格意义上的平衡二叉树),根据key值快速查找记录时间复杂度为log(N),它具有自动排序功能,所以它里面的元素都是按关键值有序的。它用的比较频繁,所以介绍一下它的用法。使用map必须包含头文件#include<map>1.map的构造map对象是模板类,需要关键字和存储对象两个模板参数:map<string,string>mapstudent;2.在map中搜索 在不插入元素的情况下,如果你想检查某个元素是否存在,可以使用find()成员函数。find()有两个重载的版本:iteratorfind(co
阅读全文
摘要:package com.han; public class HanTest { public static void main(String[] args){ if(args==null){ throw new NullPointerException("The input is \"null\""); }else if((args.length!=1&&args.length!=2)){ Throwable cause=new Throwable("You have to input 1 or 2 String argumen
阅读全文
摘要:Java 向上转型后不能使用子类中的新方法,对于使用被重写的方法名时还是用重写后的方法体(即子类中的方法体)。Java 向下转型运行时会报错(注意并不是int与char之间的转换)。但是问题的关键是编译时不会报错! 详见具体运行实例:package com.han; public class Test { int[] a; int b=10; public Test(){ int[] a={8,9}; try{ System.out.println(a[0]); }catch(ArrayIndexOutOfBoundsException e){ String s...
阅读全文
摘要:1、测试文档库(Doclib1、Doclib2):增加一栏“测试栏1”。2、新建“可视化web部件项目”,添加“解决方案资源管理器”里边选中项目右键“添加”-“新建项”-"事件接收器“如图操作,选择”列表项事件“和”文档库“集相应处理事件实现代码:using System;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using Microsoft.Sha
阅读全文
摘要:别了那一年,你是否还记得,第一天我们兄弟们的狂欢。别了那一年,你是否还记得,我们开始了憧憬和宣言。别了那一年,你是否还记得,我们不再只穿梭于教室之间。别了那一年,你是否还记得,我们睡到八点前却遗忘了早餐。别了那一年,你是否还记得,我们可以细数每科老师的笑点。别了那一年,你是否还记得,我享受着课余时间。别了那一年,你是否还记得,时间流逝,我们为找工作而心烦。别了那一年,你是否还记得,我们开始了新的人生起点......眨一眼,那一年己永远成了那一年。让天南海北的兄弟们再聚狂欢已成了一种奢盼。
阅读全文
摘要:曾经走过那段时光的寂寞也曾挥霍偷闲中的消磨因为有你心湖泛不起半丝涟漪偶尔想起青涩甜蜜的回忆渐渐明晰人生的阅历细细读取只是绚烂乐章中的插曲......
阅读全文
摘要:SharePoint2010沙盒解决方案基础开发——关于TreeView树形控件读取列表数据(树形导航)的webpart开发及问题1、实现效果如下:点击各个节点进入相应的链接2、测试列表:3、创建解决方案及webpart,代码如下所示using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint
阅读全文
摘要:com.han.WeatherThis is a UDP network program. The following presents a multicast datagram program, which is actually a new technology. The multicast datagram socket class is useful for sending and receiving IP multicast packets. A MulticastSocket is a (UDP) DatagramSocket, with additional capabiliti
阅读全文
摘要:先看java代码:import java.io.File;import javax.imageio.ImageIO;import java.awt.Image;import java.awt.geom.AffineTransform;import java.awt.image.AffineTransformOp;import java.awt.image.BufferedImage;try{String fileName = "D:\\soft\\Tomcat 6.0\\webapps\\XXX\\upload\\images\\me.jpg";File f = new F
阅读全文
摘要:<%@ page contentType="text/html; charset=gb2312"%><%@ page import="com.jspsmart.upload.*"%><%@ page import="java.util.Calendar,java.io.File"%><%request.setCharacterEncoding("gb2312");try{SmartUpload su = new SmartUpload(); /// 上传文件组件long f
阅读全文
摘要:有时看程序运行瓶颈,需要对某一个方法监测其运行的时间,可以用结束时间来减去开始时间来解决,当然,要取毫秒Java取毫秒:Date d = new Date();SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS");String str=sdf.format(d);也可以用:Date dt= new Date();
Long time= dt.getTime();//这就是距离1970年1月1日0点0分0秒的毫秒数
System.out.println(System.currentTimeMil
阅读全文
摘要:1.JS读JSON书写AJAX的时候,经常需要解析从服务器返回的一串字符串,这里简单介绍服务器返回字符的两种格式,及JS对它们的解析方法。JSON即JS对象标记(JavaScript Object Notation),是一种以JS声明对象的方式组合的一串字符串。JS可以按以下方式定义对象:var obj ={ id: 2, name: 'n'};alert(obj.name);这样就定义了对象 obj, 它有两个公共属性id和name,可以用 obj.id 的方式直接访问其属性值。从服务器获取数据时往往不止一个对象,这就需要用到对象数组,JS中对象数组可以用 [] 来定义,如下
阅读全文
摘要:Java中没有goto语句,却有可以实现跳转功能的语句。分别是break语句,continue语句,return语句,和try catch finally语句。其中finally语句无论遇到哪种跳转,总终都会执行。这几种跳转方式可以配合使用,所以java也就不需要goto语句了。此外,Java还有break label语句。注: goto语句就像Matlab中的global变量一样,能尽量少用就少用,不建议使用。是成为被未来语言取消的趋势的语句。因为它们太容易造成混乱,不止是使编译器在编译时效率低下,而且造成算法程序结构混乱,极不容易阅读,修改和维护。
阅读全文
摘要:今天改一个bug,是一个很奇怪的bug:在页面中的一个OCX控件还显示实时的图片,四个显示框中,选择其中一个,则在页面的其他位置会显示出这个图片对应的详细信息。开始用的ajax来填充这段div:<div id="right"> </div><script type="text/javascript" for="NamegOCX" event="GetSN(SN)"> try{GeDetail(SN); //获取过车信息出入对应详情}catch(err){//none}</s
阅读全文
摘要:1. href与Action的区别href只能get参数,action能get参数又能post参数href一般用于单个连接,可以带参数(URL重写),是采用get方式请求的,在地址栏中可以看到所有的参数;action一样用于表单的提交(如:注册)等,他可以提交大量和比较复杂的参数,可通过post和get两种方式提交。如果选择post方式 则在地址栏中看不到提交的信息。简单讲:单独连接到某个地址,用href;提交和注册信息,用action2. get和post的区别Form中的get和post方法,在数据传输过程中分别对应了HTTP协议中的GET和POST方法。二者主要区别如下:1、Get是用.
阅读全文
摘要:插入排序 是一种对原有序列排序的方法,逐步使原序列的有序序列增长折半插入排序 是在寻找 当前元素的位置时采取了折半查找的方法#include"stdio.h"
#include"stdlib.h" typedef struct SqList{ int * elem; int length; int MaxSize;
}SqList; void CreatList(SqList &L)
{ L.elem=(int *)malloc(100 * sizeof(int)); if(!L.elem) exit(0); else { L.length =
阅读全文
摘要:Java heap space一直是困扰我们的一个问题。像Matlab就可以一次性读取5000*5000的数据到一个矩阵matrix中。然而Java确不行。我遇到实验室处理一个“合并5000左右txt文档到一个txt文件中”的问题,相同的算法用Matlab就不会出现内存不足的问题,而JAVA则会报出:java.lang.OutOfMemoryError: Java heap space。从这里可以判断的说Matlab是为处理大型数据而设计(It is conceived for),所以其执行代码时对内存启动了自动的分配与管理。因为我的5000左右txt文档大约有180M,显而易见,同时读到内存
阅读全文
摘要:It shows that we can list all the files in a specified folder, if it exists.package com.han; import java.io.File; /** * It shows that we can list all the files in a specified folder, if it exists. * @author han * */
public class ListFiles { public static void main(String[] args) { // TODO ...
阅读全文
摘要:How to input your personal data from the default command interface.It used the System.in.read, contrast to the System.out.print.package com.han; import java.io.*;
/** * How to input your personal data from the default command interface. * <p> * It used the System.in.read, contrast to the Syste
阅读全文
摘要:Creation of a file if it does not exist; Deletion of a file if it already exists.package com.han; import java.io.File; /** * Creation of a file if it does not exist; * Deletion of a file if it already exists. * @author han * */
public class FileTest { public static void main(String[] args) ...
阅读全文
摘要:This example shows the drawing of an icon using the Icon interface for the JLable component.package com.han;
import java.awt.*;
import javax.swing.*; /** * This example shows the drawing of an icon using the Icon interface * for the JLable component. * @author han * */
public class DrawIcon i...
阅读全文
摘要:This program demonstrates the creation of a JDialog from a super-window. The created dialog is on the mode "Modal".package com.han; import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import javax.swing.*; /** * This program demonstrates the creation
阅读全文
摘要:this 关键字用在构造方法中。package com.han; /** * this 关键字用在构造方法中。 * @author han * */
public class ThisUse { public ThisUse() { this("this调用无参构造方法之前先调用有参构造方法"); //it is equivalent to : new ThisUse("this调用无参构造方法之前先调用有参构造方法"); System.out.println("this调用无参构造方法"); } public ThisUse(Str
阅读全文
摘要:首先创建一个Emp类,再将几个Emp对象添加到Map集合中。 Emp的id作为Map的键,并将id为“005”的对象从集合中删除。package com.han; import java.util.*; /** * 首先创建一个Emp类,再将几个Emp对象添加到Map集合中。 * Emp的id作为Map的键,并将id为“005”的对象从集合中删除。 * @author han * */
public class MapApps { @SuppressWarnings({ "unchecked", "rawtypes" }) public static v
阅读全文
摘要:分别向Set集合和List集合中添加"A","a","c","C","a"5个元素, 观察重复的a值能否在List或者Set中成功添加。package com.han; import java.util.*; /** * 分别向Set集合和List集合中添加"A","a","c","C","a"5个元素, * 观察重复的a值能否在List或者Set中成功添加。 * @author han * */
阅读全文
摘要:将1~100之间的所有正整数存放在一个List集合中, 并将集合中索引位置是10的对象从集合中移除。package com.han; import java.util.*; /** * 将1~100之间的所有正整数存放在一个List集合中, * 并将集合中索引位置是10的对象从集合中移除。 * @author han * */
public class ListApps { @SuppressWarnings("unchecked") public static void main(String[] args) { @SuppressWarnings("rawty
阅读全文