下文代码中,除了指定rootlogger输出到控制台和文件logdemo.log中之外,还定义了一个指定目的的子logger,令其日志输出到logdemo2.log文件中,同时它不继承rootlogger的输出特性。来源:http://blog.csdn.net/dongzi87/article/details/8292865 ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2521浏览 1974个赞
子线程循环10次,接着主线程循环100次,接着回到子线程循环10次,接着再回到主线程循环100次,如此循环50次package com.jb.liang;public class TraditionalThread3 { /** * 互斥,上锁都是放在待操作的资源的类的内部方法中,而不是线程代码中 * @author jiall * 子……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1328浏览 2627个赞
java PDF文件解析成Stringboolean sort = false;// 是否排序int startPage = 1;// 开始提取页数int endPage = Integer.MAX_VALUE;// 结束提取页数Writer output = null;// 文件输入流,生成文本文件PDDocument document = ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1439浏览 252个赞
java非递归检索文件夹下所有文件DateFormat df = DateFormat.getDateTimeInstance();LinkedList<File> folders = new LinkedList<File>();LinkedList<File> filelists = new LinkedLi……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1707浏览 1218个赞
Java对json是否合法进行格式校验/** * 用于校验一个字符串是否是合法的JSON格式 * */import java.text.CharacterIterator;import java.text.StringCharacterIterator;public class JsonValidator { private Ch……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1703浏览 2107个赞
java对properties文件进行解析,在用java自带的properties类进行properties文件解析的时候,输出的时候很可能出现乱码问题,在开始的时候我也是找不到问题,查出了之后,贴出来跟大家分享。作者:xulong1516519package properties;import java.io.File;import java.i……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1689浏览 1298个赞
Java DOC 转换给 PDF 格式文档import java.io.File;import java.net.ConnectException;import java.util.Date;import com.artofsolving.jodconverter.DocumentConverter;import com.artofsolvin……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2780浏览 1026个赞
可以用于有向图和无向图。用负数表示该有向路不通。在EditPlus上写的,所以就一个.java文件。package Test;import java.util.TreeMap;import java.util.ArrayList;import java.io.BufferedReader;import java.io.InputStreamRe……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2625浏览 2622个赞
Java读写二进制文件import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; impor……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1539浏览 808个赞
Java查找目录下的及子目录下的指定扩展名的文件package FileDemo;import java.io.BufferedWriter;import java.io.File;import java.io.FileWriter;import java.io.FilenameFilter;import java.io.IOExceptio……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1740浏览 504个赞
java操作XML中的占位符 有时XML的某些内容是待定的,对于这些内容可以在XML文件中使用占位符<people> <person id="001"> <name>$name</name> ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2472浏览 339个赞
java在web端直接输出Excel实现下载public String excelDomnload() throws Exception{ try{ /* String path = GlobalKeys.getFunctionConfig("user_attach_save","/opt/tmp/&qu……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1468浏览 1624个赞
Java实现的字符型进度条package com.gondi.util;/** * 显示进度条(参数:当前点、结束点、进度条长度) * example: * System.out.println(ProgressBar.showBarByPoint(30, 100, 20)); * result: * [-----> ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1239浏览 1585个赞
Java读取Html文本解析email地址的代码代码来自:http://blog.csdn.net/javaalpha/article/details/8332587package com.alpha.test;import java.io.BufferedReader;import java.io.File;import java.io.File……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1222浏览 2879个赞
Java获取系统当前时间的方法并指定格式/** * 返回当前日期时间字符串<br> * 默认格式:yyyy-mm-dd hh:mm:ss * * @return String 返回当前字符串型日期时间 */ public static String getCurrentTime() { String return……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2608浏览 2462个赞
创建ZIP和JAR文件import java.util.zip.*;import java.io.*;public class ZipIt {public static void main(String args[]) throws IOException {if (args.length < 2) {System.err.prin……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1293浏览 642个赞
java发送邮件import javax.mail.*;import javax.mail.internet.*;import java.util.*;public void postMail( String recipients[ ], String subject, String message , String from) throws……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1166浏览 352个赞
发送代数据的HTTP 请求import java.io.BufferedReader;import java.io.InputStreamReader;import java.net.URL;public class Main {public static void main(String[] args) {try {URL my_ur……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2268浏览 1083个赞
把 Array 转换成 Mapimport java.util.Map;import org.apache.commons.lang.ArrayUtils;public class Main {public static void main(String[] args) {String[ ][ ] countries = { { &quo……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1553浏览 125个赞
Java正则表达式提取 Email 地址import java.util.regex.Matcher;import java.util.regex.Pattern;import java.io.BufferedReader;import java.io.File;import java.io.FileReader;import java.io……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2141浏览 1563个赞
Java中,通常有两种遍历HashMap的方法,大家可以参考一下:转自:http://blog.csdn.net/newcnzz/article/details/8434631import java.util.*; public class MapTest { static HashMap<String, Integer> ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2825浏览 2181个赞
Java中创建与启动线程(Threading)的代码演示转自:http://java.chinaitlab.com/line/373702.htmlpublic class MyThread_1 extends Thread{public void run(){//some code }} ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2932浏览 268个赞
Java实现简单的鼠标划线import javax.swing.JFrame;import javax.swing.JPanel;import java.awt.Graphics;import java.awt.event.MouseListener;import java.awt.event.MouseMotionListener;impo……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2560浏览 1081个赞
java实现的二分查找法static public int search(int [] array, int target){ int high = array.length, low = -1, probe; while (high - low > 1) { probe = (low + high) &……继续阅读 » 水墨上仙 4年前 (2021-04-07) 3095浏览 2028个赞
java代码将时间从sourceTZ时区转换成targetTZ时区/* * Converts time from sourceTZ TimeZone to destTZ TimeZone. * * @return converted time, or the original time, in case the datetime c……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1788浏览 592个赞
Java运行时获得参数类型class A<T> { Class<T> specializedClass; public A() { this.specializedClass = (Class<T>) ((ParameterizedType) this.getClass() ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1665浏览 1896个赞
Java创建二叉树并遍历的代码来源:http://blog.csdn.net/yhhazr/article/details/7944089public class BinaryTree { private Node root; /** * * 内部节点类 * @author yhh */ private class Node……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2217浏览 2562个赞
解析class的工具类package com.google.reflect;import java.lang.reflect.Field;import java.lang.reflect.Method;import java.lang.reflect.Modifier;import java.lang.reflect.Proxy;impo……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1704浏览 1008个赞
java 文件夹操作import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.ni……继续阅读 » 水墨上仙 4年前 (2021-04-07) 3154浏览 911个赞
java生成pdf package com.hundsun.gildata.irp.core.action;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import com.hundsun.gildata.irp.common.……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1634浏览 1458个赞
Java模拟队列的出队和进队 package com.stackANDqueue;import java.io.DataInputStream;import java.io.IOException;/* * 循环队列的入队和出队 */public class Queue { static int MAX = 20; static ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2814浏览 2502个赞
—–初试阿里云平台——目录—–初试阿里云平台——一、什么是阿里云平台与阿里云Serverless技术二、日常部署三、个人心得一、什么是阿里云平台与阿里云Serverless技术云开发平台是面向开发者打造的一站式、全云端的开发平台,打开浏览器就可以开发、调试、上线,……继续阅读 » Thomas_one 4年前 (2021-04-07) 1881浏览 0评论2724个赞
JS代码时间格式与时间戳的相互转换 一.时间转换时间戳function transdate(endTime){var date=new Date();date.setFullYear(endTime.substring(0,4));date.setMonth(endTime……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2177浏览 730个赞
JavaScript添加到收藏夹和设置为主页的代码,网站上经常用到的两个功能// JavaScript Document// 加入收藏 < a onclick="AddFavorite(window.location,document.title)" >加入收藏< /a>function AddFav……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2124浏览 2936个赞
JavaScript SHA512加密算法详细代码/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-512, as defined * in FIPS 180-2 * Version 2.2 Copyright Anonymous Contributor, Pau……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1321浏览 1487个赞
JavaScript SHA-256加密算法详细代码/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined * in FIPS 180-2 * Version 2.2 Copyright Angel Marin, Paul Johnsto……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1680浏览 2414个赞
JavaScript SHA1加密算法实现详细代码/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined * in FIPS 180-1 * Version 2.2 Copyright Paul Johnston 2000 - 2009. ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2980浏览 2573个赞
当鼠标在图片上方时,图片停止漂浮,点击关闭按钮可隐藏图片,代码简单,直接插入网页更换成自己的漂浮图片就可以使用。<body><div id="float" style=" position:absolute; z-index:3"><img id="img1"……继续阅读 » 水墨上仙 4年前 (2021-04-07) 3001浏览 2458个赞
JavaScript检测浏览器cookie是否已经启动,代码稍显复杂,通过写入一个测试cookie判断cookie是否已经启动var dt = new Date(); dt.setSeconds(dt.getSeconds() + 60); document.cookie = "cookietest=1; expires=" +……继续阅读 » 水墨上仙 4年前 (2021-04-07) 3131浏览 2149个赞
在一个网页中同时调用jQuery和prototype会产生冲突,主要是$全局变量冲突,下面这段代码有效的解决了这个问题一定要先引入prototype.js 再引入jquery.js,先后顺序不可错<script src="prototype.js"></script><script src=&quo……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2615浏览 947个赞
要从列表框同时删除多个项目,我们不能从上到下的删除,因为上面的项目每删除一个,下面的项目的索引号就会变化,所以只能从下向上删除,这样就不会出现索引号乱变的问题了。 html代码<table><tr> <td align="cent……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2907浏览 201个赞
JavaScript里字符串不能直接换行书写,需要使用 \ 符号进行换行,其实这一点非常不方便,不过目前也没有好的办法。var multiStr = "This is the first line \ This is the second line \ This is more... \ http://www.75271.com ……继续阅读 » 水墨上仙 4年前 (2021-04-07) 2262浏览 2497个赞
这段代码演示了jQuery通过closest选择器上一级的元素,然后修改其text()内容<!DOCTYPE html><html><head> <meta http-equiv="content-type" content="text/html; charset=UTF……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1724浏览 2210个赞
如果jquery要选择的元素id中带有点符号,在选择时需要在点前面加上两个反斜杠,如:$(“#address\\.street”).text(“Enter this field”);<!DOCTYPE html><html><head> <meta h……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1537浏览 608个赞
jQuery克隆JavaScript对象,下面的代码演示了如何克隆jQuery的对象,也演示了如何克隆JavaScript的对象 jquery中克隆对象可以用// Clone the DIVvar cloned = $('#somediv').clone()……继续阅读 » 水墨上仙 4年前 (2021-04-07) 1558浏览 2252个赞