@SetupBy(value=StartSetup.class)
public class MainModule {
}
2015四月24
Velocity:文本模板渲染public String getTemplateStr(String template, Map<String, String> para) { StringWriter writer = new StringWriter(); try { RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices(); StringReader reader = new StringReader(template); SimpleNode node = runtimeServices.parse(reader, "Template name"); Template t = new Template(); t.setRuntimeServices(runtimeServices); t.setData(node); t.initDocument(); VelocityContext context = new VelocityContext(); if (para.size() > 0) { for (String key : para.keySet()) { context.put(key, para.get(key)); } } t.merge(context, writer); } catch (Exception e) { throw new RuntimeException("Error commiting transaction! cause:"+ e.getMessage()); } return writer.toString(); } @At("/form") @Ok("vm:template.private.test") public void form(HttpServletRequest req, HttpServletResponse resp) { Map<String, Object> formParams = new HashMap<String, Object>(); formParams.put("formKey", "form/waizhibiaodan/01/01.form"); int timeout = 60 * 1000; String str = Http.post("http://127.0.0.1/test/getFormKey", formParams, timeout); NutMap map = Json.fromJson(NutMap.class, str); String formData = map.getString("data"); Map<String, String> params = new HashMap<String, String>(); params.put("startDate", "2015-04-21"); params.put("endDate", "2015-04-25"); req.setAttribute("formData", getTemplateStr(formData, params)); }
2015四月21
Nutz:打包命令
mvn package -Dmaven.test.skip=true
2015四月16
Activiti 5.17.0 解决中文乱码问题
processEngineConfiguration.setActivityFontName(“宋体”);
processEngineConfiguration.setLabelFontName(“宋体”);
windows环境变量:
JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
2014十月24
Android:tcpdump抓包命令
adb shell
su
chmod 777 /data/local/tcpdump
/data/local/tcpdump -p -vv -s 0 -w /sdcard/capture.pcap
2014九月29
MySQL:not in 语句优化
select a.*
from wx_nickname a
left join (select distinct nickname_id from wx_group_nickname )b on
a.id = b.nickname_id
where b.nickname_id is null
2014八月28
Cordova:Toast浮动提示插件