摘要: 在没有懂得RFC1738的时辰,一向认为Url的正则表达式很简单,没想到Url有这么多分类,更没想到一个通俗的http的正则表达式也不是那么简单。以下是我搜到的关于http的正则表达式:1 http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?当然这已经满足大项目组人的需求了,然则若是须要严格的验证的话还是要合适RFC1738了。Url包含Http,Ftp,News,Nntpurl,Telnet,Gopher,Wais,Mailto,File,Prosperurl和Otherurl。呵呵,空话不久不多说了,上代码View Code strin... 阅读全文
posted @ 2012-09-10 13:15 绒花雪冷 阅读(1575) 评论(0) 推荐(0) 编辑
摘要: 1 import java.io.BufferedReader; 2 import java.io.File; 3 import java.io.FileInputStream; 4 import java.io.IOException; 5 import java.io.RandomAccessFile; 6 import java.nio.ByteBuffer; 7 import java.nio.channels.FileChannel; 8 9 public class TestNio { 10 11 12 public static void main(St... 阅读全文
posted @ 2012-08-01 14:01 绒花雪冷 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 1 MySQL: 2 String Driver="com.mysql.jdbc.Driver"; //驱动程序 3 String URL="jdbc:mysql://localhost:3306/db_name"; //连接的URL,db_name为数据库名 4 String Username="username"; //用户名 5 String Password="password"; //密码 6 Class.forName(Driver).new Instance(); 7 Connection con=D 阅读全文
posted @ 2012-06-30 14:26 绒花雪冷 阅读(304) 评论(0) 推荐(0) 编辑
摘要: 1 import java.lang.reflect.InvocationHandler; 2 import java.lang.reflect.InvocationTargetException; 3 import java.lang.reflect.Method; 4 import java.lang.reflect.Proxy; 5 import java.sql.Connection; 6 import java.sql.Statement; 7 8 public class _Connection implements InvocationHandler { 9 pri... 阅读全文
posted @ 2012-06-30 14:24 绒花雪冷 阅读(1064) 评论(0) 推荐(0) 编辑
摘要: 1 import java.sql.Connection; 2 import java.sql.DriverManager; 3 import java.sql.PreparedStatement; 4 import java.sql.ResultSet; 5 import java.sql.ResultSetMetaData; 6 import java.sql.SQLException; 7 import java.util.ArrayList; 8 import java.util.HashMap; 9 import java.util.List; 10 import... 阅读全文
posted @ 2012-06-30 14:20 绒花雪冷 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * 功能描述:拷贝一个目录或者文件到指定路径下,即把源文件拷贝到目标文件路径下 3 * 4 * @param source 5 * 源文件 6 * @param target 7 * 目标文件路径 8 * @return void 9 */10 public static void copy(File source, File target) {11 File tarpath = new File(target, source.... 阅读全文
posted @ 2012-06-30 14:16 绒花雪冷 阅读(770) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * 以字节为单位读取文件,常用于读二进制文件,如图片、声音、影像等文件。 3 */ 4 public static void readFileByBytes(String fileName) { 5 File file = new File(fileName); 6 InputStream in = null; 7 try { 8 System.out.println("以字节为单位读取文件内容,一次读一个字节:"); 9 // 一次读... 阅读全文
posted @ 2012-06-30 14:14 绒花雪冷 阅读(410) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * 向文本文件中写入内容或追加新内容,如果append为true则直接追加新内容,<br> 3 * 如果append为false则覆盖原来的内容<br> 4 * 5 * @param path 文件路径 6 * @param content 追加内容 7 * @param append 是否追加,true:追加 false:替换 8 */ 9 public void writeFile(String path, String content, boolean append) {10 ... 阅读全文
posted @ 2012-06-30 12:01 绒花雪冷 阅读(464) 评论(0) 推荐(0) 编辑
摘要: //alert('test');// Validator = { Require : /.+/, Email : /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, Phone : /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/, Mobile : /^((\(\d{2,3}\))|(\d{3}\-))?13\d{9}$/, Url : /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\? 阅读全文
posted @ 2012-06-25 17:46 绒花雪冷 阅读(119) 评论(0) 推荐(0) 编辑
摘要: <!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 runat="server"> <title>jQuery实现CheckBox全选、全不选</title> < 阅读全文
posted @ 2012-06-25 14:19 绒花雪冷 阅读(193) 评论(0) 推荐(0) 编辑