2019. 11. 29. 15:05
[MSSQL] GeoLocation 범위계산
2019. 11. 29. 15:05 in 팁&테크/MSSQL
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 관련
2019. 11. 18. 09:09 in 팁&테크/Linux
패키지 인덱스 정보 업데이트 : /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
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
2019. 11. 13. 14:57 in 팁&테크/Kotlin
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")
}
}
}