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
var node = db.getSiblingDB("db1"); | |
var rs = db.getSiblingDB("db2"); | |
function prepareMsgIds(table) { | |
var iter = table.find({"_id":{"$regex":"^sq:"}}); | |
return iter; | |
} | |
//FIXME: performace | |
function districtArray(array) { |
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 sample.remote.test | |
import scala.actors.threadpool.Executor | |
import scala.actors.threadpool.Executors | |
import java.util.concurrent.ExecutorService | |
class Test1 { | |
private val map = scala.collection.mutable.HashMap[Int, String]() | |
def get(index: Int) = synchronized { |
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 akka.actor.Actor | |
import akka.actor.ActorSystem | |
import akka.actor.Props | |
class PrinterActor extends Actor { | |
def receive = { | |
case any => println(Thread.currentThread().getName()) | |
} | |
} |
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
mport com.mongodb.{Mongo, BasicDBObject, DBObject} | |
import scala.collection.convert.WrapAsJava | |
object Test extends App with WrapAsJava { | |
val mongo = new Mongo("host").getDB("TestGeoDB").getCollection("city") | |
private val line2Bson: String => DBObject = line => { | |
val Array(_id, country, city, lati, longi, elevation) = line.split(";").map(_.replace("\"", "")) | |
new BasicDBObject( | |
mapAsJavaMap(Map( |
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
/** | |
* Created by focusj on 14-6-20. | |
*/ | |
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
mongoose.connect('mongodb://10.0.1.39:30000/TestGeo'); | |
var db = mongoose.connection; |
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
# CoffeeScript CheetSheet# | |
## Declaration | |
### there is no vars, and no need to add ';' and the end | |
i = 10 | |
str = "hello world" | |
[firstName, lastName] = ["kang", "wang"] | |
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
Exception in thread "vert.x-eventloop-thread-0" java.lang.InternalError: java.io.FileNotFoundException: /usr/lib/jvm/java-8-oracle/jre/lib/ext/cldrdata.jar (Too many open files) | |
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1040) | |
at sun.misc.URLClassPath.getResource(URLClassPath.java:239) | |
at java.net.URLClassLoader$1.run(URLClassLoader.java:365) | |
at java.net.URLClassLoader$1.run(URLClassLoader.java:362) | |
at java.security.AccessController.doPrivileged(Native Method) | |
at java.net.URLClassLoader.findClass(URLClassLoader.java:361) | |
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) | |
at java.lang.ClassLoader.loadClass(ClassLoader.java:411) | |
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) |
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 netty.toturials; | |
import io.netty.buffer.ByteBuf; | |
import io.netty.buffer.Unpooled; | |
import io.netty.util.ByteProcessor; | |
/** | |
* 1. ByteBuf根据其分配空间不同有可以分为三种:JVM堆内的,直接内存,组合的。堆内受JVM的管辖,使用上相对安全一些,但是要注意GC是会影响性能。 | |
* 直接内存不受JVM的管控,在编程的时候要注意不用的ByteBuf要手动释放,否则会造成内存泄漏。 | |
* <p> |
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
https://gist.github.com/dangbiao1991/7825db1d17df9231f4101f034ecd5a2b |
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
https://gist.github.com/dangbiao1991/7825db1d17df9231f4101f034ecd5a2b |
OlderNewer