Skip to content

Instantly share code, notes, and snippets.

View kymtwyf's full-sized avatar
:octocat:

Wu Yongfeng kymtwyf

:octocat:
View GitHub Profile
@kymtwyf
kymtwyf / solving.md
Last active October 31, 2015 03:28
HDFS Exception java.net.ConnectException: Call to IP:9000 failed on connection exception: java.net.ConnectException: Connection refused

可能原因

  1. hdfs未启动

sbin/start-dfs.sh

  1. core-site.xml配置错误
<configuration>
  <property>
 fs.defaultFS
@kymtwyf
kymtwyf / solving.md
Created October 31, 2015 03:42
org.apache.hadoop.ipc.RemoteException: Server IPC version 9 cannot communicate with client version 4

原因是我多引用了一个hadoop-core: ... 去掉就好了。。。。

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-core</artifactId>
    <version>1.2.1</version>
</dependency>
@kymtwyf
kymtwyf / explain.md
Last active October 31, 2015 09:31
org.springframework.web.filter.HttpPutFormContentFilter config

Spring默认不支持直接用request.getParameter()来拿PUT方法的参数 (包括form-data 和 x-www-form-urlencoded)如果需要添加对其的支持,需要加上使用HttpPutFormContentFilter

参考

添加配置

<filter>
  <filter-name>httpPutFormContentFilter</filter-name>
 org.springframework.web.filter.HttpPutFormContentFilter
@kymtwyf
kymtwyf / Remove file start with dash.md
Created November 15, 2015 14:42
rm file start with dash -
@kymtwyf
kymtwyf / tar list file content.md
Created November 15, 2015 15:00
tar list file content

Reference

Task: List the contents of a tar file

Use the following command:

$ tar -tvf file.tar

Task: List the contents of a tar.gz file

Use the following command:

@kymtwyf
kymtwyf / tar: file changed as we read it.md
Created November 15, 2015 15:10
tar: file changed as we read it

tar 打包的时候提示:

tar: ___ file changed as we read it

这是因为打包的时候文件正在被修改,所以tar命令执行失败。

目前为止找到的方法只能是把原始文件拷贝一份,做一个snapshot,然后再对拷贝的目录进行压缩。。。

@kymtwyf
kymtwyf / maybe.md
Created November 18, 2015 14:14
pm2 无缘无故挂了 pm2 stops without any reason

可能因为log写太多,磁盘满了...然后pm2就生气了,然后就挂了(>_>)

@kymtwyf
kymtwyf / solution.md
Created November 21, 2015 15:48
tomcat hangs

这两天发现我的tomcat总是用着用着莫名其妙地不返回东西了,也不报错。然后去查了一下java进程,做了一个dump发现非常多这样的进程:

"http-bio-8080-exec-14" daemon prio=10 tid=0x00007f8670011800 nid=0x6ed2 waiting for monitor entry [0x00007f86f55a7000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:781)
    - waiting to lock <0x0000000600af2938> (a org.apache.commons.pool.impl.GenericObjectPool)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
@kymtwyf
kymtwyf / finder显示完整路径.md
Created November 24, 2015 10:35
Mac finder 显示 完整 路径
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
@kymtwyf
kymtwyf / batch modify UTF8 WITH BOM .md
Created November 24, 2015 12:44
Intellij Error(1,1)illegalcharacter '\ufeff'

参考

var fs = require('fs');
var path = "目标路径..";


function readDirectory(dirPath) {
    if (fs.existsSync(dirPath)) {
        var files = fs.readdirSync(dirPath);