'2019/11'에 해당되는 글 6건

  1. 2019.11.29 [MSSQL] GeoLocation 범위계산
  2. 2019.11.18 apt-get 관련
  3. 2019.11.15 [안드로이드, Kotlin] Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6
  4. 2019.11.13 [Kotlin] Http Request
  5. 2019.11.13 [IntelliJ] TypeError: this.cliEngine is not a constructor
  6. 2019.11.04 [MSSQL] IDENTITY Column (PK)의 값을 insert 하기
2019. 11. 29. 15:05

[MSSQL] GeoLocation 범위계산

alter table [yourTable] add [p] as geography::Point(Latitude, Longitude, 4326) persisted;
create spatial index [yourSpatialIndex] on [yourTable] ([p])

declare @Latitude float = <somevalue>, @Longitude float = <somevalue>;
declare @point geography = geography::Point(@Latitude, @Longitude, 4326);
declare @distance int = <distance in meters>;

select * from [yourTable] where @point.STDistance([p]) <= @distance;


2019. 11. 18. 09:09

apt-get 관련

패키지 인덱스 정보 업데이트 : /etc/apt/sources.list 이 파일에서 저장된 저장소에서 사용할 패키지의 정보를 얻습니다.
sudo apt-get update

설치된 패키지 업그래이드
sudo apt-get upgrade
의존성검사하며 설치하기
sudo apt-get dist-upgrade

패키지 설치
sudo apt-get install 패키지이름

패키지 재설치
apt-get --reinstall install 패키지이름

패키지 삭제 : 설정파일은 지우지 않음
sudo apt-get remove 패키지이름

설정파일까지 모두 지움
sudo apt-get --purge remove 패키지이름

패키지 소스코드 다운로드
sudo apt-get source 패키지이름

위에서 받은 소스코드를 의존성있게 빌드
sudo apt-get build-dep 패키지이름

패키지 검색
sudo apt-cache search 패키지이름

패키지 정보 보기
sudo apt-cache show 패키지이름

apt를 이용해서 설치된 deb패키지는 /var/cache/apt/archive/ 에 설치

2019. 11. 15. 13:23

[안드로이드, Kotlin] Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6

Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6

이런 오류가 발생하는 경우 app/build.gradle에 아래 내용을 추가

android {
...
kotlinOptions {
jvmTarget = "1.8"
}
...
}


2019. 11. 13. 14:57

[Kotlin] Http Request

val html:String = URL("url").readText()
또는
fun sendGetRequest(userName:String, password:String) {

var reqParam = URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode(userName, "UTF-8")
reqParam += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8")

val mURL = URL("<Yout API Link>?"+reqParam)

with(mURL.openConnection() as HttpURLConnection) { //Or HttpsURLConnection
// optional default is GET
this.requestMethod = "GET"

println("URL : $url")
println("Response Code : $responseCode")

BufferedReader(InputStreamReader(this.inputStream)).use {
val response = StringBuffer()

var inputLine = it.readLine()
while (inputLine != null) {
response.append(inputLine)
inputLine = it.readLine()
}
it.close()
println("Response : $response")
}
}
}


fun sendPostRequest(userName:String, password:String) {

var reqParam = URLEncoder.encode("username", "UTF-8") + "=" + URLEncoder.encode(userName, "UTF-8")
reqParam += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode(password, "UTF-8")
val mURL = URL("<Your API Link>")

with(mURL.openConnection() as HttpURLConnection) { //Or HttpsURLConnection
// optional default is GET
this.requestMethod = "POST"

val wr = OutputStreamWriter(this.outputStream)
wr.write(reqParam)
wr.flush()

println("URL : $url")
println("Response Code : $responseCode")

BufferedReader(InputStreamReader(this.inputStream)).use {
val response = StringBuffer()

var inputLine = it.readLine()
while (inputLine != null) {
response.append(inputLine)
inputLine = it.readLine()
}
it.close()
println("Response : $response")
}
}
}


2019. 11. 13. 09:50

[IntelliJ] TypeError: this.cliEngine is not a constructor

webstorm에서 eslint 적용 후 

TypeError: this.cliEngine is not a constructor

위와 같은 에러 발생



출처: https://tristan91.tistory.com/516 [개발모음집]

webstorm에서 eslint 적용 후 

TypeError: this.cliEngine is not a constructor

위와 같은 에러 발생



출처: https://tristan91.tistory.com/516 [개발모음집]

webstorm에서 eslint 적용 후 

TypeError: this.cliEngine is not a constructor

위와 같은 에러 발생



출처: https://tristan91.tistory.com/516 [개발모음집]

IntelliJ에서 eslint 사용 시 아래와 같은 오류가 발생하는 경우.

TypeError: this.cliEngine is not a constructor


문제는 IntelliJ의 node(eslint) 버전이 낮은 버전(eslint v5)에 맞춰져 있는데 설치된 버전(eslint v6)이 높아서 발생함


IntelliJ를 2019.1.2 이상으로 업데이트 하던지 아래 방법을 사용할 것


1. node_modules/eslint 와 eslint*에 관련된 디렉토리 삭제


2. package.json 에서 eslinkt 버전을 ^5.16.0 으로 변경한 후 npm install을 실행

2019. 11. 4. 08:45

[MSSQL] IDENTITY Column (PK)의 값을 insert 하기

Identity로 설정된 column의 값은 임의로 변경하지 못함.

자동으로 증가되는 값 이외의 수치로 변경(0, -1등등)하기 위해서는 IDENTITY_INSERT를 변경해 주어야 함.

update는 delete 후 insert 하는 수 밖에 없음

SET IDENTITY_INSERT [table] ON
INSERT INTO [table] (PK) VALUES (-1)
SET IDENTITY_INSERT [table] OFF