Month: January 2013

MySQL 5.5 的TPS

摘自《MySQL 5.5: Storage Engine Performance Benchmark for MyISAM and InnoDB》 Benchmark环境: 硬件: (CPU总核数从6核到36核都分别测过) 引用 –  4 Sockets, 4 8 cores total, 4 x 12 – core AMD Opteron 6172 “Magny – Cours” 2.1GHz CPUs.  (Note: 36 cores were allocated to MySQL and the remaining 12 the Sysbench processes).  –   64 GB DDR3 RAM –   2 …

MySQL 5.5 的TPS Read More »

从M个里取N个的组合 C(m,n)

用递归写的,使用时要注意栈空间问题 /** * 从m个里取n个的所有组合 c(m,n) * * @param m * @param n * @return */ public static List<List<Integer>> getCombinationList(int m, int n) { if (n == 1) { List<List<Integer>> resultList = new ArrayList<List<Integer>>(); for (int i = 1; i <= m; i++) { resultList.add(new ArrayList<Integer>(Arrays.asList(i))); } return resultList; } List<List<Integer>> nMinusOneCombList = getCombinationList(m, n – …

从M个里取N个的组合 C(m,n) Read More »

jmimemagic: 找出文件的MIMIE类型

jmimemagic这个开源软件可以让你用java语言找出某个文件的MIME类型 比如,判断文件是不是文本文件。 private boolean isTextFile(File file) { MagicMatch magic = Magic.getMagicMatch(file, false, true); String mimeType = magic.getMimeType().toLowerCase(); return mimeType.startsWith("text/"); }

获取所执行的程序所在目录及其上层目录的办法

抄自catalina.sh PRG="$0" # resolve links – $0 may be a softlink while [ -h "$PRG" ]; do ls=`ls -ld "$PRG"` link=`expr "$ls" : ‘.*-> \(.*\)$’` if expr "$link" : ‘/.*’ > /dev/null; then PRG="$link" else PRG=`dirname "$PRG"`/"$link" fi done # 所执行程序所在的目录 PRGDIR=`dirname "$PRG"` # 所执行程序所在的目录的上级目录 [ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." >/dev/null; pwd`

solr里要使用FastVectorHighlighter时须使用的配置和代码

schema.xml里配置term位置信息 <field name="text" type="text_en_splitting_tight" indexed="true" stored="true" multiValued="false" [b] termVectors="true" termPositions="true" termOffsets="true"[/b] /> 如果使用了比较智能的分词,则要在solrconfig.xml里配置breakIterator <boundaryScanner name="breakIterator" default="true" class="solr.highlight.BreakIteratorBoundaryScanner"> <lst name="defaults"> <!– type should be one of CHARACTER, WORD(default), LINE and SENTENCE –> <str name="hl.bs.type">SENTENCE</str> <!– language and country are used when constructing Locale object. –> <!– And the Locale object will be used when getting instance …

solr里要使用FastVectorHighlighter时须使用的配置和代码 Read More »

收藏几本关于unix编程的书

来自陈晧的 http://coolshell.cn/articles/4990.html 引用 学习Unix/Linux系统调用《Unix高级环境编程》,,了解系统层面的东西。 《Unix编程艺术》了解Unix系统领域中的设计和开发哲学、思想文化体系、原则与经验。你一定会有一种醍醐灌顶的感觉。 《Unix网络编程卷1,套接字》这是一本看完你就明白网络编程的书。重要注意TCP、UDP,以及多路复用的系统调用select/poll/epoll的差别。 《Unix网络编程卷2,进程间通信》信号量,管道,共享内存,消息等各种IPC…… 这些技术好像有点老掉牙了,不过还是值得了解。