Skip to content

Instantly share code, notes, and snippets.

@ryanjin
ryanjin / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ryanjin
ryanjin / run_hbase_on_spark_mr.md
Last active August 29, 2015 14:15
蛋疼的在spark的mapreduce任务中执行hbase

##hbase-protocol.jar cd /opt/cloudera/parcels/CDH-5.1.0-1.cdh5.1.0.p0.53/lib/hadoop

ln -s /opt/cloudera/parcels/CDH-5.1.0-1.cdh5.1.0.p0.53/lib/hbase/lib/hbase-protocol-0.98.1-cdh5.1.0.jar hbase-protocol-0.98.1-cdh5.1.0.jar

参考: http://www.cloudera.com/content/cloudera/en/documentation/cloudera-search/v1-latest/Cloudera-Search-Release-Notes/csrn_known_issues_current.html?scroll=csrn_topic_2

##Configuration/HTable的初始化 因为在MR中调用hbase,一开始在Function内新建,但是会报错,java.io.NotSerializableException

##query出现不同结果(numfound) #####每次query得到的总数可能会不同结果集

  1. google后某个人说因为更新solr的document导致solr内部没有同步造成,之后查找该方面资料,没有详细说明。

  2. 后来想到当初制造shard的split,如果原始shard没有删除,那么查询可能会落在原始shard,但新的insert只会进入新shard,造成查询结果不同步,那么会不会因为查了不同的shard造成结果不同呢?

  3. 接下来尝试针对不同shard进行查询(distrib=false),同一个shard的lead节点和replica节点出现的结果集不同

  4. 然后看哪个replica节点的日志,发现某个时间点恢复失败了(因为当初更新solr的jar包进行了重启,中间出现了同步失败的错误),估计solr失败后由于内部某方面的bug,没有尽心个标记从而继续进行replica操作

##INSTALL EXCEPTION _imagingft.c:73:10: fatal error: 'freetype/fterrors.h' file not found

##fix it ln -s /usr/local/Cellar/freetype/2.5.1/include/freetype2 /usr/local/include/freetype

--- count Examples:hbase> count ‘t1′

hbase> count ‘t1′, INTERVAL => 100000

hbase> count ‘t1′, CACHE => 1000

hbase> count ‘t1′, INTERVAL => 10, CACHE => 1000

hbase> t.count

python2.6中total_seconds方法

2.6中没有这个方法,但是等价于(td.microseconds + (td.seconds + td.days * 24 * 3600) * 106) / 106

Spring MVC Restful

问题1 POST的方法无法获得@RequestParam

添加contenttype:application/x-www-form-urlencoded

问题2 PUT的方法无法获得@RequestParam

由于servletapi的限制,参数仅仅从Get(url中),POST(Body中)获得,其他场景,getParameter不起作用,因此PUT方法无法获@得RequestParam

Spring Data

Spring Data Rest

字符集

\u3232\u6674 那么可以通过: decodedUniChars = slashUStr.decode("unicode-escape");