우분투 10.04 한글깨짐현상 해결방법

우분투 10.04를 설치해서 사용중입니다.
이놈 아주 빠르고, UI효과 좋고 다 좋은데... 한글이 깨져서 써집니다 ㅠㅠ
검색결과 해결방법을 찾았는데, 내용은 아래와 같습니다.

'시스템>기본설정>IBus기본설정'항목을 보시면 됩니다.
IBus 입력기에 Hangul 을 추가해서 기본인 han2보다 우선으로 잡아주면 일단 정상적인 한글입력은 가능합니다. (http://www.spoonzero.com/archives/177 내용참고)

저도 직접 해보니, 정상적인 입력이 가능해 졌습니다.
한칸한캄 띠엄띠엄 적었던 것에 비하면 천국이네요 +_+

추신.
리눅스중에서도 우분투는 참 설치도 간편하고, 사용하기도 쉽습니다.
윈도우에 질리신 분들이라면 과감하게!!! 포멧은 좀 겁나고 불편해지니깐 멀티부팅 한번 하시죠!!!

List Sort Sample Using Comparator<T> Interface

사용자 삽입 이미지










어떠한 문자열, 또는 수치값등을 List 형태의 객체 담아 정렬하는 기법이다.
첨부된 예제에서는 ArrayList를 사용하였고, String 형 객체에 담긴 문자열을 ArrayList에 담아
중복문자 및 공백문자를 제거하여, 오름차순으로 정렬하는 코드를 구현하였다.

주요메서드는 다음과 같다.
조금 더 자세한 내용은 검색을 통해 스스로 찾길 바란다.


[중복문자 제거 메서드(MyUtil.java)]
 public static ArrayList<Character> removeSameCharacters(ArrayList<Character> list)  {
  ArrayList<Character> returnList = new ArrayList<Character>();
 
        for (char character : list) {      // list 사이즈만큼 반복하며 char 형변수에 담기
            if(!returnList.contains(character)) {   // returnList에 해당 char 존재하지 않으면 수행
             returnList.add(character);       // returnList에 char 추가
            }  
        }  
 
  return returnList;         // returnList 리턴
 }
[리스트내의 문자열에 대한 정렬 (MyUtil.java)]
 public static ArrayList<Character> sort(ArrayList<Character> list) {
  ArrayList<Character> sortedList = null;

  Collections.sort(list, new SortList());    // Collections 클래스를 이용한 정렬
  sortedList = list;         // null 문자를 제외한 값복사
 
  return sortedList;         // sortedList 리턴
 }

[Comparator 인터페이스를 구현한 클래스(SortList.java)]
public class SortList implements Comparator<Character> {

 /* (non-Javadoc)
  * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
  *
  * 정렬을 위해 인자로 받은 두개의 데이터를 비교하는 메서드
  */
 public int compare(Character char1, Character char2) {
  if((int) char1 > (int) char2) {
   return 1;
  } else if((int) char1 < (int) char2) {
   return -1;
  } else {
   return 0;
  }
 }
}

DOM Parser vs SAX Parser

136. Parsers? DOM vs SAX parser
Parsers are fundamental xml components, a bridge between XML documents and applications that process that XML. The parser is responsible for handling xml syntax, checking the contents of the document against constraints established in a DTD or Schema.
파서는 XML 문서와 XML을 처리하는 응용프로그램 사이에 다리역할을 하는 XML의 기본구성요소이다. 파서의 DTD 또는 스키마에 정의된 제약에 대한 문서의 내용을 확인하고, XML을 구문을 처리하는 책임이 있습니다.
DOM
1. Tree of nodes
2. Memory: Occupies more memory, preffered for small XML documents
3. Slower at runtime
4. Stored as objects
5. Programmatically easy
6. Ease of navigation

SAX 
1. Sequence of events
2. Doesn't use any memory preferred for large documents
3. Faster at runtime
4. Objects are to be created
5. Need to write code for creating objects
6. Backward navigation is not possible as it sequentially processes the document

http://dev.fyicenter.com/Interview-Questions/Java-1/Parsers_DOM_vs_SAX_parser.html

How to send an XML document to a remote web server using HTTP POST

How to send an XML document to a remote web server using HTTP POST
HTTP POST를 이용하여 원격지의 웹서버로 XML문서를 전송하는 방법에 대한 참고자료

  String strURL = "http://웹서버의경로";
 
  String strXMLFilename = "c:/input.xml";
  File input = new File(strXMLFilename);
 
  PostMethod post = new PostMethod(strURL);
 
  try {
   post.setRequestEntity(
          new InputStreamRequestEntity(
                   new FileInputStream(input), input.length()));
   post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
   HttpClient httpClient = new HttpClient();
   
   int result = httpClient.executeMethod(post);
   System.out.println("Response status code : " + result);
   System.out.println("Response body : ");
   System.out.println(post.getResponseBodyAsString());
   
  } catch (FileNotFoundException e) {
   e.printStackTrace();
  } catch (HttpException e) {
   e.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  } finally {
   post.releaseConnection();
  }

파일형태로 저장된 XML 은 위의 코드처럼 하면 되는데,
내가 필요한건 문자열로 구성된 XML데이터의 전송이였다.
아래의 코드처럼 StringBuffer 클래스와 ByteArrayInputStream 클래스를 이용하여 이를 해결해보았다.

  String strURL = "웹서버의 경로";
 
  StringBuffer strInputXMLBuffer = new StringBuffer();
  strInputXMLBuffer.append("<FortuneInput>");
  strInputXMLBuffer.append("<mentorType>" + 0 + "</mentorType>");
  strInputXMLBuffer.append("</FortuneInput>");

  PostMethod post = new PostMethod(strURL);
 
  try {
   InputStream inputStream =
           new ByteArrayInputStream(strInputXMLBuffer.toString().getBytes("UTF-8"));
   
   post.setRequestEntity(
           new InputStreamRequestEntity(inputStream, strInputXMLBuffer.length()));
   post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
   HttpClient httpClient = new HttpClient();
   
   int result = httpClient.executeMethod(post);
   System.out.println("Response status code : " + result);
   System.out.println("Response body : ");
   System.out.println(post.getResponseBodyAsString());
   
  } catch (FileNotFoundException e) {
   e.printStackTrace();
  } catch (HttpException e) {
   e.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  } finally {
   post.releaseConnection();
  }











 참고자료 : http://foldurl.com/206706

getLocalActivityManager()내의 AlertDialog() 사용시의 유의점!!


getLocalActivityManager() 사용시 AlertDialog()를 사용하게 되면 아래와 같은 에러메세지가 발생하는 경우가 있다.

android.view.WindowManager$BadTokenException: Unable to add window --


token android.app.LocalActivityManager$LocalActivityRecord@43b976f8
is not valid; is your activity running?



샘플코드를 살펴보자.
아래는 보통의 다이얼로그를 띄워줄때의 방식이다.

  AlertDialog.Builder alert_internet_status = new AlertDialog.Builder(getParent());

    alert_internet_status.setTitle( "Warning" );            
    alert_internet_status.setMessage( msg );
    alert_internet_status.setPositiveButton( "close", new DialogInterface.OnClickListener() {
     public void onClick( DialogInterface dialog, int which) {
      dialog.dismiss();   //닫기
     }
    });
    alert_internet_status.show();        
}


보통은 붉게 표시한 부분에 'this' 또는 '클래스명.this'를 사용할텐데, ActivityGroup 사용시에는 다른 Activity에서 사용되는 Intent와는 달리 다소 복잡한 부분이 있으며 주체가 누구냐에 따라 달라지므로 유의해야 한다.


출처 : http://www.androes.com/71