This file contains hidden or 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 jmxdemo; | |
import java.io.File; | |
import java.util.Set; | |
import javax.management.JMX; | |
import javax.management.MBeanServerConnection; | |
import javax.management.ObjectInstance; | |
import javax.management.ObjectName; | |
import javax.management.remote.JMXConnector; |
This file contains hidden or 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 demo | |
object CodeWriter { | |
def main(args: Array[String]) { | |
val code = new CodeWriter | |
code.println("package wangzx.javabean") | |
code.println | |
code.println("public class Student extends Object"); |
This file contains hidden or 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
<script languange="javascript"> | |
var begin = new Date(); | |
var pie = 0; | |
var loop = 1000 * 1000 * 100; | |
for(var i=1; i<loop; i++){ | |
var sign = (i % 2) == 0 ? -1.0 : 1.0; | |
pie = pie + sign / (2*i - 1) | |
} |
This file contains hidden or 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 demo | |
import reflect_demo.BindMacro._ | |
import reflect_demo._ | |
object BindDemo { | |
def main(args: Array[String]) { | |
val x = Box(10) |
This file contains hidden or 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 wangzx.macros | |
import scala.language.experimental.macros | |
import scala.reflect.macros.Context | |
import java.lang.String | |
import scala.reflect.api.Symbols | |
object EnumsMacro { | |
def docs[A](obj: A): Map[Int, String] = macro docsMacro[A] |
This file contains hidden or 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
//gcc -DPAD=0 -o test2_0 test2.c -lpthread;time ./test2_0 -- 6.5s | |
//gcc -DPAD=0x0C38 -o test2_0C38 test2.c -lpthread;time ./test2_0C38 -- 15s | |
#include <stdio.h> | |
#include <pthread.h> | |
#include <sys/time.h> | |
// very suprise, when PAD = 0x0C38, the speed is slow down | |
typedef struct _Block | |
{ |
This file contains hidden or 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 macro_basic | |
import scala.reflect.macros.Context | |
import scala.language.experimental.macros | |
object BeanMacros { | |
def ToString[A](obj: A): String = macro toStringMacro[A] | |
def toStringMacro[A](c: Context)(obj: c.Expr[A]): c.Expr[String] = { | |
import c.universe._ |
This file contains hidden or 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
# -*- coding: utf-8 | |
''' | |
从数据源同步获取Channel在线的数据,保存到mongodb中 | |
这个脚本一般以crontab方式运行,每30秒运行一次 | |
@author: [email protected] | |
''' | |
from app_logger import Logger, set_logging_path |
This file contains hidden or 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 demo | |
import scala.util.continuations._ | |
object Demo1 { | |
def main(args: Array[String]) { | |
var cont: (Int=>String) = null | |
This file contains hidden or 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 wangzx.util.json; | |
import java.io.IOException; | |
import javax.xml.transform.sax.SAXSource; | |
import net.sf.json.JSONArray; | |
import net.sf.json.JSONObject; | |
import org.xml.sax.ContentHandler; |