提问的智慧
Eric Steven Raymond, Thyrsus Enterprises, < esr@thyrsus.com >
Rick Moen, < respond-auto@linuxmafia.com >
翻译:柯非, < zer4tul@gmail.com >
这篇译文基于2014.05.21更新的原文修订版3.10。
特别感谢王刚,此前本文的翻译是由他进行的。
public static int hanStrCount(String hanStr){ | |
int count = 0; | |
for (int i = 0; i < hanStr.length(); i++) { | |
boolean matches = Pattern.matches("^[\u4E00-\u9FA5]{0,}$",String.valueOf(hanStr.charAt(i))); | |
if (matches) count++; | |
} | |
return count; | |
} |
public static String getHostNameForLiunx() { | |
try { | |
return (InetAddress.getLocalHost()).getHostName(); | |
} catch (UnknownHostException uhe) { | |
String host = uhe.getMessage(); // host = "hostname: hostname" | |
if (host != null) { | |
int colon = host.indexOf(':'); | |
if (colon > 0) { |
'use strict'; | |
var pagination = require('hexo-pagination'); | |
module.exports = function(locals){ | |
var config = this.config; | |
var posts = locals.posts; | |
posts.data = posts.data.sort(function(a, b) { | |
if(a.top && b.top) { // 两篇文章top都有定义 | |
if(a.top == b.top) return b.date - a.date; // 若top值一样则按照文章日期降序排 | |
else return b.top - a.top; // 否则按照top值降序排 | |
} |
var Index = function(){ | |
//初始化控件 | |
var initComs = function(){ | |
} | |
//处理事件 | |
var handleEvent = function(){ | |
} | |
return { |
rem *******************************Code Start***************************** | |
@echo off | |
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%" | |
mysqldump --opt -uroot -pyake110 hospital > D:\db_backup\hospital_%Ymd%.sql | |
@echo on | |
rem *******************************Code End***************************** |
start(){ | |
now=`date "+%Y%m%d%H%M%S"` | |
exec java -jar /usr/local/pos/cashier-admin.jar 5 >"$now"_bidcheck.log & | |
#tail -f result.log | |
} | |
#停止方法 | |
stop(){ | |
ps -ef|grep java|awk '{print $2}'|while read pid | |
do | |
kill -9 $pid |
/*日期格式化 yyyy-MM-dd*/ | |
Date.prototype.Format = function (fmt) { | |
var o = { | |
"M+": this.getMonth() + 1, //月份 | |
"d+": this.getDate(), //日 | |
"h+": this.getHours(), //小时 | |
"m+": this.getMinutes(), //分 | |
"s+": this.getSeconds(), //秒 | |
"q+": Math.floor((this.getMonth() + 3) / 3), //季度 | |
"S": this.getMilliseconds() //毫秒 |
Eric Steven Raymond, Thyrsus Enterprises, < esr@thyrsus.com >
Rick Moen, < respond-auto@linuxmafia.com >
翻译:柯非, < zer4tul@gmail.com >
这篇译文基于2014.05.21更新的原文修订版3.10。
特别感谢王刚,此前本文的翻译是由他进行的。