목록Programming (13)
Leonardo Go
1. 관련자료1) https://dzone.com/articles/non-blocking-rest-services-with-spring2) https://github.com/callistaenterprise/blog-non-blocking-rest-service-with-spring-mvc
위치정보로 날씨 정보를 가져오기 위해서는 우선 GeoPoint로 지역정보를 가져와야합니다.이를 위해서는 Geocoder를 이용합니다.지역->GeoPoint 를 지오코딩(Geocoding)이라고 하고,GeoPoint->지역 을 역 지오코딩(Reverse geocoding)이라고 합니다.여기서는 역 지오코딩을 이용합니다.Geocoder의 getFromLocation()을 이용하여 Address 객체를 받아올 수 있습니다.※ 주의 : 아시다시피 GeoPoint의 위도와 경도 값은 마이크로 값이므로 int형 입니다.하지만 getFromLocation에서 사용되는 위도와 경도는 실제 값으로 double형입니다.그래서 10^6으로 나누어서 인자를 넣어줘야 합니다.Address 객체를 통해 지역 값을 가져오면 그것을..
http://www.google.co.kr/ig/api?weather=해당 시/군의 영문명 위 주소는 구글에서 제공하는 날씨 정보를 얻기 위한 날씨 API용 주소이다. 원하는 시/군의 영문명을 입력하면 XML형태의 데이터로 결과를 출력해준다. 예를 들어 대구의 날씨를 알고 싶다면 다음과 같이 입력해주면 1. http://www.google.co.kr/ig/api?weather=Daegu 2. http://www.google.co.kr/ig/api?weather=Taegu 1,2번 아무거나 넣으면 된다. 내가 알기론 2번의 영문명은 예전에 사용하던 것이고 1번이 변경된 영문명인 걸로 안다. 결과는 다음과 같이 나온다. View Result < /xml_a..
거제 http://www.google.co.kr/ig/api?weather=Koje 구미 http://www.google.co.kr/ig/api?weather=Gumi http://www.google.co.kr/ig/api?weather=Kumi 군산 http://www.google.co.kr/ig/api?weather=Kunsan http://www.google.co.kr/ig/api?weather=Gunsan 김해 http://www.google.co.kr/ig/api?weather=Gimhae 광주 http://www.google.co.kr/ig/api?weather=Kwangju 동해 http://www.google.co.kr/ig/api?weather=Tonghae 당진 http://www.go..
Include는 비슷한 화면이 여러개 있을때 활용하면 좋다. 소스를 보면 main.xml 에는Include를 사용했다. 이건 top.xml인데, 이 xml을 딴 xml에서 참조를 할 수 있기 때문에, 굉장히 편하다. 실행화면
import java.util.*; class Student implements Comparable { String name; int ban; int no; int kor, eng, math; int total; int schoolRank; public Student(String name, int ban, int no, int kor, int eng, int math) { this.name = name; this.ban = ban; this.no = no; this.kor = kor; this.eng = eng; this.math = math; total = kor + eng + math; } int getTotal() { return total; } float getAverage() { return (..
import java.util.*; class Student2 { String name; int ban; int no; int kor, eng, math; public Student2(String name, int ban, int no, int kor, int eng, int math) { this.name = name; this.ban = ban; this.no = no; this.kor = kor; this.eng = eng; this.math = math; } int getTotal() { return kor + eng + math; } float getAverage() { return (int) (((getTotal() / 3f) * 10 + 0.5) / 10f); } public String t..
import java.util.*; class Student implements Comparable{ String name; int ban; int no; int kor; int eng; int math; public Student(String name, int ban, int no, int kor, int eng, int math) { super(); this.name = name; this.ban = ban; this.no = no; this.kor = kor; this.eng = eng; this.math = math; } int getTotal() { return kor + eng + math; } float getAverage() { return (int) (((getTotal() / 3f) *..
Comparable인터페이스를 구현하도록 변경해서 이름이 기본 정렬기준이 되도록 만든소스 import java.util.*; class Student2 implements Comparable{ String name; int ban; int no; int kor, eng, math; public Student2(String name, int ban, int no, int kor, int eng, int math) { this.name = name; this.ban = ban; this.no = no; this.kor = kor; this.eng = eng; this.math = math; } int getTotal() { return kor + eng + math; } float getAverage() {..