This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
public class Md5 { | |
public static String toMd5(String arg) { | |
try { | |
MessageDigest md = MessageDigest.getInstance("MD5"); | |
md.update(arg.getBytes()); | |
byte b[] = md.digest(); | |
int i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test { | |
public static void main(String[] args) { | |
Test test = new Test(); | |
System.out.println(test.lpad(10, 23)); | |
} | |
/** | |
* 补齐不足长度 | |
* @param length 长度 | |
* @param number 数字 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
public class sdf { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//获得访客最近评论数 | |
function get_author_comments_num($email = "") { | |
if(empty($email)) return; | |
$commentsNum = Helper::options()->commentsNum; | |
$time = time() - (24 * 60 * 60 * $commentsNum); //当前时间戳减去30天的时间戳 | |
$db = Typecho_Db::get(); | |
$sql = $db->select('COUNT(mail) as emailnum')->from('table.comments') | |
->where('status = ?','approved') | |
->where('mail = ?',$email) | |
->where('created > ?',$time); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 显示下一篇 | |
* | |
* @access public | |
* @param string $default 如果没有下一篇,显示的默认文字 | |
* @return void | |
*/ | |
function theNext($widget, $default = NULL) | |
{ | |
$db = Typecho_Db::get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FeiQSocket { | |
public static void main(String[] args) throws Exception { | |
List<String> hosts = new ArrayList<String>(); | |
String host = "localhost"; //目标IP | |
int port = 2425; //目标端口,缺省为 2425 | |
InetAddress IPAddress = InetAddress.getByName(host); | |
//String str = "1_lbt4_10#32899#002481627512#0#35807#0:1:Administrators:1D46A2A23307456:288:内容"; //普通消息 | |
String str = "1_lbt4_35#128#0022680C51AC#0#35807#0:1250815230:Administrators:1D46A2A23307456:209:"; //抖屏 | |
byte[] buf = str.getBytes(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.util.Iterator; | |
import com.drew.imaging.jpeg.JpegMetadataReader; | |
import com.drew.metadata.Directory; | |
import com.drew.metadata.Metadata; | |
import com.drew.metadata.Tag; | |
import com.drew.metadata.exif.ExifDirectory; | |
/*** | |
* 批量修改目录下图片,根据EXIF信息命名。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
** 加法函数,用来得到精确的加法结果 | |
** 说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。 | |
** 调用:accAdd(arg1,arg2) | |
** 返回值:arg1加上arg2的精确结果 | |
**/ | |
function accAdd(arg1, arg2) { | |
var r1, r2, m, c; | |
try { | |
r1 = arg1.toString().split(".")[1].length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**清空表格**/ | |
function clearLocationTable(){ | |
var objTable = document.getElementById("locationTable"); | |
var length = objTable.rows.length; | |
for (var i = 1; i<length; i++){ | |
objTable.deleteRow(1); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class ReadMinds { | |
public static void main(String[] args) { | |
String result = init(); // 初始化 | |
Scanner scan = new Scanner(System.in); | |
scan.nextLong(); | |
System.out.println(result); | |
} |
OlderNewer