Skip to content

Instantly share code, notes, and snippets.

Wendal Chen wendal

Block or report user

Report or block wendal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
wendal /
Last active Mar 15, 2017
测试nutz json 处理getter/setter的情况
package org.nutz.json.meta;
import org.nutz.json.Json;
import org.nutz.json.JsonField;
public class PojoForQQ {
private int id;
private String code;
wendal /
Created Mar 14, 2017
public static void main(String[] args) {
Jedis jedis = new Jedis();
jedis.setex("abc", 15, "hi");
System.out.println("time now = " + System.currentTimeMillis());
jedis.psubscribe(new JedisPubSub() {
public void onPMessage(String pattern, String channel, String message) {
System.out.println("time now = " + System.currentTimeMillis());
wendal /
Created Sep 10, 2015
public void test_get_sql() throws Throwable {
NutDao dao = new NutDao(ioc.get(javax.sql.DataSource.class));
final List<String> sqls = new ArrayList<String>();
final Method m = NutStatement.class.getDeclaredMethod("toStatement", Object[][].class, String.class);
dao.setExecutor(new DaoExecutor() {
public void exec(Connection conn, DaoStatement st) {
String psql = st.toPreparedStatement();
wendal /
Created Sep 7, 2015
public static String getTableName(Dao dao, Class<?> klass, Object t) {
final Entity<?> en = dao.getEntity(klass);
final String[] name = new String[1];, new Runnable() {
public void run() {
name[0] = en.getTableName();
return name[0];
wendal /
Last active Sep 7, 2015
package org.nutz.test;
import java.lang.reflect.Field;
import org.junit.After;
import org.junit.Before;
import org.nutz.ioc.Ioc;
import org.nutz.ioc.IocLoader;
import org.nutz.ioc.impl.NutIoc;
import org.nutz.ioc.loader.annotation.Inject;
wendal / 0_reuse_code.js
Last active Aug 31, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
wendal /
Created Jun 16, 2015
package org.beetl.ext.nutz;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.beetl.core.Configuration;
import org.beetl.core.GroupTemplate;
import org.beetl.core.resource.WebAppResourceLoader;
wendal /
Last active Nov 2, 2017
public static <T> T insertOrUpdate(Dao dao, T obj) {
if (obj == null)
return null;
Entity<T> en = (Entity<T>) dao.getEntity(obj.getClass());
if (en.getPkType() == PkType.UNKNOWN)
throw new IllegalArgumentException("no support , without pks");
boolean doInsert = false;
switch (en.getPkType()) {
case ID:
wendal / ddns.go
Created Jan 22, 2015
golang的dns缓存, 含流量统计
View ddns.go
package ddns
import (
var (
dnsLock = &sync.Mutex{}
wendal /
Created Jan 3, 2015
基于XML配置NutDao的Entity, 未测试代码, 正式代码会出现在nutz主库或nutzmore项目.
package org.nutz.dao.impl.entity.xml;
public class IotUser {
private long id;
private String name;
private int age;
public int getAge() {
return age;
You can’t perform that action at this time.