2011년 12월 29일 목요일

[JavaScript] undefined 값 확인하기

잘못된 예
xxx == "undefined"

잘 사용한 예
document.getElementById("xxx").value = xxx == undefined ? "0" : xxx

[아데설구] 스토리14 - 트랜잭션관리의 실무적용

트랜잭션이란 데이터베이스에 행해지는 작업의 논리적인 단위(Logical Unit Of Work)

Elementary Process는 일반적으로 한사람이 한 작업이 완성될때까지 수행되는 것

트랜잭션은 기술적으로 처리하는 의미의 단위가 아니라 업무적으로 의미가 있는 최소의 작업처리 단위이다.

작업의 논리 단위가 트랜잭션이 되기 위해서는 다음 4가지 속성을 가져야 한다.
Atomicity(원자성), Consistency(일관성), Isolation(고립성), Durability(영속성)

Atomicity(원자성)
더 이상 쪼갤 수 없는 업무적으로 처리되는 의미있는 기준의 의미한다.
업무를 처리하는 최소한의 단위가 트랜잭션 원자성의 기준이 된다.

Consistency(일관성)
업무적으로 처리된 데이터들은 일관성을 갖고 보존 되어야 한다.

Isolation(고립성)
트랜잭션이 진행 될 때에는 다른 트랜잭션이 중간에 접근되지 않아야 한다.

Durability(영속성)
처리가 완료된 트랜잭션은 그 값이 변치 않아야 한다.

프로젝트에서 트랜잭션을 분석하는 이유는 두가지이다.
하나 데이터가 업무적으로 무결성을 가질 수 있도록 프로세스와 설계사상에 반영 되어야 하기 때문이다.
둘째 데이터베이스에 발생하는 처리량을 분석하여 용량 산정의 근거로 삼아 자원배치를 효과적으로 하기 위함이다.

트랜잭션을 분석할 때에는 Elementary Process 와 CRUD Matrix를 이용하여 트랜잭션 분석서(Transaction Action Diagram or Logical Access Map)를 작성한다.


2011년 12월 28일 수요일

톰캣 에러... 해결 할 것

Dec 28, 2011 2:47:24 PM org.apache.tomcat.util.http.Parameters processParameter
s
INFO: Character decoding failed. Parameter [orderDt] with value [<=order_dt%>] h
as been ignored. Note that the name and value quoted here may be corrupted due t
o the failed decoding. Use debug level logging to see the original, non-corrupte
d values.
java.io.CharConversionException: EOF
at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:80)
at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:46)
at org.apache.tomcat.util.http.Parameters.urlDecode(Parameters.java:410)

at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.j
ava:370)
at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.j
ava:420)
at org.apache.tomcat.util.http.Parameters.handleQueryParameters(Paramete
rs.java:186)
at org.apache.catalina.connector.Request.parseParameters(Request.java:25
94)
at org.apache.catalina.connector.Request.getParameterNames(Request.java:
1148)
at org.apache.catalina.connector.RequestFacade.getParameterNames(Request
Facade.java:371)
at wdf.control.BaseController.getParameterValues(BaseController.java:347
)
at com.wj.ariba.common.control.ProductSubController.getSubProductCodeLis
t(ProductSubController.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at wdf.servlets.FCHttpServlet.invokeRequest(FCHttpServlet.java:312)
at wdf.servlets.FCHttpServlet.processRequest(FCHttpServlet.java:542)
at wdf.servlets.FCHttpServlet.doGet(FCHttpServlet.java:402)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)


===================================================================
dataUrl="/common/getSubProductCodeList.do?orderNo=&goodsCd=&orderDt=<%=order_dt%>"

여기서 <=order_dt%> %가 누락되어서 발생되는 문제였음

톰캣에서 null이 null로 보이는 문제

Jar 두개를 업데이트 해줘야 함

jasper.jar

Thanks ^^

2011년 11월 20일 일요일

[JAVA] 스트링 배열선언

중괄호는 스트링 배열 선언 시 선언문에서만 사용할 수 있다.
예를들어

  • (잘못된 예)
String[] s;
s = {"aaa","aab","aac"};
  • (옳은 사용방법)
int[] arr new int[]{1,2,3};

2011년 11월 19일 토요일

[android] SimpleCursorAdapter 사용하기

SimpleCursorAdapter

SimpleCursorAdapter는 커서를 XML 파일에 정의된 TextViews 혹은 ImageViews로 컬럼을 맵핑시키는 쉬운 어댑터이다. 당신은 어떤 컬럼을 원하는지 어떤 뷰에 컬럼을 보여주고 싶은지 명시할 수 있다. 그리고 이러한 뷰의 모습을 정의하는 XML파일은 두가지 형태로 바인딩된다. 첫째로 만약 SimpleCursorAdapter.ViewBinder가 가능하다면, setViewValue(android.view.View, android.database.Cursor, int)가 호출된다. 만약 리턴값이 참이면 바인딩이 실행된다. 만약 리턴값이 거짓이고 바인딩 되는 뷰는 TextView 라면 setViewText(TextView, String)가 호출된다. 만약 리턴 값이 거짓이고 바인딩되는 뷰가 ImageView라면 setViewImage(ImageView, String)이 호출된다. 만약 적절한 바인딩이 발견되지 않으면 IllegalStateException이 던져진다. 만약 이 어댑터가 필터링과 함께 사용되면 예를들어 AutoCompleteTextView와 같은 당신은 SimpleCursorAdapter.CursorToStringConverter와 FilterQueryProvider 인터페이스가 필터링프로세스를 컨트롤한다. 자세한 내용은 convertToString(adnroid.database.Cursor) 그리고 runQueryOnBackgroundThread(CharSequence)에 대해서 내용을 참조할 수 있다.

(원문)

An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file. You can specify which columns you want, which views you want to display the columns, and the XML file that defines the appearance of these views. Binding occurs in two phases. First, if a SimpleCursorAdapter.ViewBinder is available, setViewValue(android.view.View, android.database.Cursor, int) is invoked. If the returned value is true, binding has occured. If the returned value is false and the view to bind is a TextView, setViewText(TextView, String) is invoked. If the returned value is false and the view to bind is an ImageView,setViewImage(ImageView, String) is invoked. If no appropriate binding can be found, an IllegalStateException is thrown. If this adapter is used with filtering, for instance in an AutoCompleteTextView, you can use the SimpleCursorAdapter.CursorToStringConverter and the FilterQueryProviderinterfaces to get control over the filtering process. You can refer to convertToString(android.database.Cursor) andrunQueryOnBackgroundThread(CharSequence) for more information.

2011년 11월 3일 목요일

[JAVA] ResultSet의 결과수에 따라 로직을 만들려고 할때...

자바에서 ResultSet으로 결과를 Fetch 한 뒤 총 몇개의 열이 Fetch 되었나는 다소 복잡하다.

conn = DBHandler.getConnection()

pstmt = conn.prepareStatement(Query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs = pstmt.executeQuery();

rs.last();
int vFetchedRow = rs.getRow();
rs.beforeFirst();

이후 다시
while(rs.next){
/// codes
}

해도 에러가 나지 않는다.