스크립트에서 ajax로 한글파라미터를 POST 방식으로 넘겼는데 자바파일에서 한글이 깨진다. 지금까지 한 번도 안그랬던 것같은데 찾아보니 많이 일어나는 일이었나보다.

그래서 스크립트에서 파라미터를 인코딩(encodeURI)했는데 넘어오는 값이 계속 깨지는게 아닌가.

고심끝에 멘토에게 문의.
문제는 인코딩-디코딩이었던건가.
계속 인코딩만하고 디코딩을 안해주고 있던...

anyway,
String name = new String(request.getParameter("dpAreaNm").getBytes("ISO-8859-1"), "UTF-8");
이렇게 했더니 한글이 나온다.

(Is there anybody who can explain to me?)
Posted by zeide
,

[자료]Type System

자료 2010. 5. 22. 22:05
슬라이드 자료를 보던 중에 type system이 뭔지 몰라서 검색.

http://en.wikipedia.org/wiki/Type_system

즉, 타입시스템은 값(Value)을 타입(Type)으로 연관짓는다. 예를 들어 Java에서 value는 type을 선언하고 그 type에 맞는 값을 할당해야 한다. 그렇지 않으면 컴파일시 에러가 발생한다(Java는 static type system).

왜 몰랐지;
Posted by zeide
,

[Scala] Hello World

Scala 2010. 5. 21. 11:27
http://www.scala-lang.org/node/166

Hello World 찍기.


후-
Posted by zeide
,

http://kwon37xi.egloos.com/3666564

글을 읽어봅니다.
도움이 되는 글이라고 생각합니다.

Posted by zeide
,
설명을 안써서...
매뉴얼에 나와있지만 써본다.
Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles.

사실 설치하는 것을 설명할 필요는 없다.
http://ant.apache.org/manual/index.html
매뉴얼이 친절하게 알려준다.

여기서 중요한 점은 환경변수 설정인데
- Add the bin directory to your path.
- Set the ANT_HOME environment variable to the directory where you installed Ant. On some operating systems, Ant's startup scripts can guess ANT_HOME (Unix dialects and Windows NT/2000), but it is better to not rely on this behavior.
라고 나와있다.
PATH에 빈디렉터리를 추가해주고 ANT_HOME을 만들어서 ANT의 경로를 추가해주면 된다.
도스창에 들어가서 ant를 치면 메시지가 띡-하고 뜬다. 그 다음에 버전을 체크하면 버전표시가 띡-하고 뜬다.

그 다음 중요한 점은 buildfile 작성하기.
ant의 빌드파일은 xml로 되어있다.

빌드파일의 예제

<project name="MyProject" default="dist" basedir=".">
    <description>
        simple example build file
    </description>
  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist"  location="dist"/>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
  </target>

  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>

    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>

http://pcguy7.springnote.com/pages/546569
다음에 올라온 예제를 실행해본 결과,

Buildfile: E:\project\ztest\WebContent\build.xml
prepare:
     [echo] Build Start!! ======> 2009.03.04-10:41
clean:
   [delete] Deleting directory E:\project\ztest\WebContent\dist
compile:
    [mkdir] Created dir: E:\project\ztest\WebContent\build
mkjar:
    [mkdir] Created dir: E:\project\ztest\WebContent\dist
      [jar] Warning: skipping jar archive E:\project\ztest\WebContent\dist\1.0_helloprint.jar because no files were included.
      [jar] Building MANIFEST-only jar: E:\project\ztest\WebContent\dist\1.0_helloprint.jar
dist:
     [copy] Copied 1 empty directory to 1 empty directory under E:\project\ztest\WebContent\dist\lib
     [copy] Copied 1 empty directory to 1 empty directory under E:\project\ztest\WebContent\dist\src
      [zip] Building zip: E:\project\ztest\WebContent\2009.03.04_1.0_helloprint.zip
BUILD SUCCESSFUL
Total time: 203 milliseconds
경고만 빼면...그럭저럭 돌아가는 듯하다.
Posted by zeide
,

[게시판] 글 조회수

자료 2009. 3. 2. 10:00
...
Connection con = null;
PreparedStatement pstmt = null;
...

try{
...(커넥션 얻기)
StringBuffer addCount = new StringBuffer();
addCount.append("update board set readcount = readcount+1 where num=?");
pstmt = con.prepareStatement(addCount.toString());
pstmt.setInt(1,num);
pstmt.executeUpdate();
...
}
...

이것은 누구나 아는 방법.
보통 글 번호에 따른 게시물을 읽는 코드와 같이 쓴다.(파라미터로 글 번호를 받기 때문에)
Posted by zeide
,