scala를 webjars-play와 연동하다가 종종 중복 이슈가 발견이 되어서 자세히 중복 확인을 하고 싶었다.


자실 webjars-play 뿐 아니라 일반 scala 프로젝트를 사용할 때도 많은 도움이 된다. 




https://github.com/sbt/sbt-duplicates-finder를 사용해.. 자세히 확인할 수 있다. 



addSbtPlugin("org.scala-sbt" % "sbt-duplicates-finder" % "0.7.0")



$ sbt


[project name] $ checkDuplicates


[warn] Detected classes conflicts:

[warn]

[warn] - io/netty/handler/codec/string/LineSeparator.class: content differ

[warn] - /Users/samuel.kim/.ivy2/cache/io.netty/netty-codec/jars/netty-codec-4.1.9.Final.jar

[warn] - /Users/samuel.kim/.ivy2/cache/io.netty/netty-all/jars/netty-all-4.1.10.Final.jar

[warn]

[warn] - io/netty/util/internal/logging/InternalLoggerFactory.class: content differ

[warn] - /Users/samuel.kim/.ivy2/cache/io.netty/netty-common/jars/netty-common-4.1.9.Final.jar

[warn] - /Users/samuel.kim/.ivy2/cache/io.netty/netty-all/jars/netty-all-4.1.10.Final.jar

[warn]

[warn] - javax/servlet/SingleThreadModel.class: content differ

[warn] - /Users/samuel.kim/.ivy2/cache/org.mortbay.jetty/servlet-api-2.5/jars/servlet-api-2.5-6.1.14.jar

[warn] - /Users/samuel.kim/.ivy2/cache/javax.servlet/servlet-api/jars/servlet-api-2.5.jar

[warn]



하지만, https://github.com/coursier/coursier는 훨씬 자세히 보여준다.




$ sbt compile

[warn] Executing in batch mode.

[warn]   For better performance, hit [ENTER] to switch to interactive mode, or

[warn]   consider launching sbt without any commands, or explicitly passing 'shell'

[info] Loading project definition from /Users/samuel.kim/dev/ccc/kemi-logview/project

[info] Set current project to kemi-logview (in build file:/Users/samuel.kim/dev/ccc/kemi-logview/)

coursier.ResolutionException: Conflict(s) in dependency resolution:

  org.webjars.npm:object-assign:3.0.0:default(compile)

org.webjars.npm:object-assign:4.0.1:default(compile)

org.webjars.npm:object-assign:4.1.1:default(compile)

[error] (*:coursierResolutions) coursier.ResolutionException: Conflict(s) in dependency resolution:

[error]   org.webjars.npm:object-assign:3.0.0:default(compile)

[error] org.webjars.npm:object-assign:4.0.1:default(compile)

[error] org.webjars.npm:object-assign:4.1.1:default(compile)

[error] Total time: 8 s, completed 2017. 12. 22 오후 6:45:36


Posted by '김용환'
,

개발자라면 이미 변수의 데이터가 존재하느냐 라는 함수/메소드를 정의해야 할 때가 있다. 


그냥 생각나는 대로 isExistedData, isExistData 란 함수/메소스를 쓰는 경우가 있다. 


이는 Konglish이다. hasData라는 함수/메소드를 사용하는 것이 좋다.



출처 


https://forum.wordreference.com/threads/is-existed-vs-exists.1773199/



is existed data

is exist data

-> has data






Posted by '김용환'
,

React를 이해하고 Redux를 사용해야 할 때 


React 컴포넌트를 개발하고 처음으로 Redux 를 사용하려 하는 개발자를 위한 참조 문서


개념에 대한 이해도를 높이고 Provider를 활용할 수 있는 가이드

(기본 소스로 얘를 이용)

https://www.kirupa.com/react/using_redux_with_react.htm



custom 이벤트 데이터를 payload로 전달할 수 있고 connect에 대한 이해를 높이는 가이드

https://lorenstewart.me/2016/11/27/a-practical-guide-to-redux/



mapStateToProps을 이해하는데 도움되는 가이드

https://www.zerocho.com/category/React/post/57b60e7fcfbef617003bf456










Posted by '김용환'
,



superagent(https://github.com/visionmedia/superagent)는 동기 콜이 없다. 


무조건 비동기 콜이다.


따라서 아래처럼 superagent가 동기콜인양 쓰면 state/props 간의 동기 이슈가 발생할 수 있다. 


즉, superagent에서 end 내부가 동작되기 전에 handleResult가 먼저 실행된다. 


superagent.get('/search_log')
.
query(..)
.
retry(2)
.
end((err, res) => {
if (res.ok) { //..
}
else {
//
..
}

}); {this.handleResult()}




따라서. end() 밑에 성공하고 난 이후에 handleResult()를 호출하는 형태로 진행하면 동기 콜과 같은 효과를 얻을 수 있을 것이다. 


superagent.get('/search_log')
.
query(..)
.
retry(2)
.
end((err, res) => {
if (res.ok) { //..
{this.handleResult()}
}
else {
//
..
}

});




Posted by '김용환'
,



react 컴포넌트 안에서 다음처럼 내부 함수끼리 호출할 때 에러가 발생할 수 있다. 

(handleMouseDown은 bind()되어 있다)


handleMouseDown(e) {

   _handleLog()

}


_handleLog() {

..

}






아래와 같이 _handleLog()를 호출할 때 {와 }를 추가하면 문제가 해결된다. 




handleMouseDown(e) {

   {_handleLog()}

}


_handleLog() {

..

}






render() 함수 내에서도 동일하게 사용할 수 있다.

Posted by '김용환'
,