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
package org.nutz.json.meta; | |
import org.nutz.json.Json; | |
import org.nutz.json.JsonField; | |
public class PojoForQQ { | |
private int id; | |
private String code; | |
@JsonField |
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 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() { | |
@Override | |
public void onPMessage(String pattern, String channel, String message) { | |
System.out.println("time now = " + System.currentTimeMillis()); |
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
@Test | |
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); | |
m.setAccessible(true); | |
dao.setExecutor(new DaoExecutor() { | |
public void exec(Connection conn, DaoStatement st) { | |
String psql = st.toPreparedStatement(); | |
sqls.add(psql); |
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 static String getTableName(Dao dao, Class<?> klass, Object t) { | |
final Entity<?> en = dao.getEntity(klass); | |
final String[] name = new String[1]; | |
TableName.run(t, new Runnable() { | |
public void run() { | |
name[0] = en.getTableName(); | |
} | |
}); | |
return name[0]; | |
} |
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
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; |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
package org.beetl.ext.nutz; | |
import java.io.IOException; | |
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; |
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
@SuppressWarnings("unchecked") | |
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: |
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
package ddns | |
import ( | |
"log" | |
"net" | |
"sync" | |
) | |
var ( | |
dnsLock = &sync.Mutex{} |
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
package org.nutz.dao.impl.entity.xml; | |
public class IotUser { | |
private long id; | |
private String name; | |
private int age; | |
public int getAge() { | |
return age; | |
} |
NewerOlder