살군의 보조기억 장치

Another memory device…

Archive for August 2011

How to see a variable contents on xcode

leave a comment »

Simply you can use “po” command on debug screen. For instance,

po [tableViewData objectAtIndex:indexPath.row]

works well.

Written by gomiski

2011/08/29 at 12:57 am

Posted in iOS, Lecture

Spring: Annotation based configuration

leave a comment »

Need to read: Annotation based configuration in Spring

 

————————————————————————————————————————————

Spring 2.5 introduces further stereotype annotations: @Component, @Service, and @Controller. @Component is a generic stereotype for any Spring-managed component. @Repository, @Service, and @Controller are specializations of @Component for more specific use cases, for example, in the persistence, service, and presentation layers, respectively. Therefore, you can annotate your component classes with @Component, but by annotating them with @Repository, @Service, or @Controller instead, your classes are more properly suited for processing by tools or associating with aspects. For example, these stereotype annotations make ideal targets for pointcuts. It is also possible that @Repository, @Service, and @Controller may carry additional semantics in future releases of the Spring Framework. Thus, if you are choosing between using @Component or @Service for your service layer, @Service is clearly the better choice. Similarly, as stated above, @Repository is already supported as a marker for automatic exception translation in your persistence layer.

retrieved from: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-java

1) PRESENTATION LAYER (@Controller)

  • a) View (jsp)
  • b) FormBeans
  • c) Controllers

2) BUSSINESS LAYER (@Service)

  • a) Transactions
  • b) Services with interfaces -
  • c) Data transfer object
  • d) Validators

3) PERSISTANCE LAYER  (@Repository)

  • a) DAO (Hibernate DAO Classes of Spring)
  • b) ORM (Hibernate)
  • c) Database
  • d) POJO

retrieved from: http://www.coderanch.com/t/448566/Spring/many-layers-jpetstore-application

Written by gomiski

2011/08/16 at 8:24 am

Posted in Java, Lecture

몽고DBmongodb setting problem

leave a comment »

I spent couple of hours to figure out what was wrong in my system(Ubuntu). I had found a sample code from git-hub(https://github.com/springsource/spring-data-document-examples) of the spring data project and tested it but failed. This was the beginning of my problem. I tracked my log then I found the test code tried to connect the address “127.0.1.1” which is address of my domain name. You may see if you hit command “prompt>cat /etc/hosts” and this will show up your domain name and address.

I solved this problem, by the way, to put my localhost address(127.0.0.1) manually on the sample code. Below shows another solution, yet I didn’t tried. How to fix Apache – “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Error on Ubuntu .

Written by gomiski

2011/08/16 at 7:56 am

Posted in Java, Lecture, Linux

adding tomcat6 to eclipse (cannot add a server problem)

leave a comment »

You would have found below solution unless you found my blog before searching an answer, and it would work well except some other cases like me.

sudo apt-get install tomcat6
cd /usr/share/tomcat6
sudo ln -s /var/lib/tomcat6/conf conf
sudo ln -s /etc/tomcat6/policy.d/03catalina.policy conf/catalina.policy
sudo ln -s /var/log/tomcat6 log
sudo chmod -R 777 /usr/share/tomcat6/conf

It did work well until I switched “workspace.” When I changed it, I couldn’t add a server and I was confused. I took several hours and I found a solution finally. A permission of “tomcat-users.xml” file caused a problem adding the server into eclipse. Here’s a solution.

sudo chmod 777 /usr/share/tomcat6/conf/tomcat-users.xml

Done! Now my eclipse works well.

Written by gomiski

2011/08/12 at 6:30 am

Posted in General, Java, Lecture, Linux

log4j.properties 패턴pattern

leave a comment »

%d{yyyy-MM-dd HH:mm:ss,SSS}

날짜출력 {} 형식은 SimpleDateFormat 형식에 따름

%-5p

Priority 출력(fatal, error, warn, info, debug)

%n

줄바꿈 문자 출력

%t

자바 스레드명 출력

Read the rest of this entry »

Written by gomiski

2011/08/11 at 2:06 am

Posted in Java, Lecture

메이븐maven 명령어

leave a comment »

페이즈Phases 별로 어떤 역할을 하는지 정리했다. 이 명령어는 다음과 같이 쓸 수 있다.

prompt> mvn compile

이 경우 compile 페이즈를 수행하라고 명령한 것이다. 페이즈 목록은 아래와 같다.

  • validate:
  • compile: 소스코드 컴파일
  • test: 단위테스트 프레임웍을 이용해서 테스트 하는 단계. 이 단계는 package나 deploy 단계의 필수사항은 아니다.
  • package:
  • integration-test:
  • verify:
  • install:
  • deploy:

 

디팬던시 트리를 보는 명령어

prompt>mvn dependency:tree

디펜던시 카피해서 타겟 디렉토리로 옮기는 명령어

prompt>mvn dependency:copy-dependencies

Written by gomiski

2011/08/08 at 4:28 am

Posted in Java, Lecture

메이븐maven 에서 자바Java 컴파일compile/실행exec 하기

leave a comment »

제일처음 메이븐maven을 설치하고 자바 프로젝트를 생성하는 방법은…

prompt>mvn archetype:generate -DgroupId=com.mycompany -DartifactId=myapplication

명령어를 치면 중간에 몇가지 묻는게 나오는데 그대로 엔터enter키를 몇번 치면 생성이 된다. 그런 다음 이 결과를 메이븐maven에서 컴파일 하고 실행하고 싶다면 어떻게 해야 될까? 사실 컴파일은 “mvn compile” 명령어를 통해 바로 수행이 되지만 실행은 되지 않는다. 이를 다음과 같이 pom.xml 파일을 고치면 된다.

<project .....
...
  <build>
 <plugins>
 <plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>exec-maven-plugin</artifactId>
 <executions>
 <execution>
 <goals>
 <goal>java</goal>
 </goals>
 </execution>
 </executions>

 <configuration>
 <mainClass>com.mycompany.App</mainClass>
 </configuration>
 </plugin>
 </plugins>
 </build>
</project>

요렇게 해주면 해결!! 그다음에 다음과 같이 명령어를 입력하면 컴파일과 실행이 잘 되는것을 볼 수 있다. 한가지 주의할 점은 붉게 표시한 부분이 같아야 된다는 것이다. 자바의 package 이름에 해당하는 것이므로, 둘을 같게 맞춰줘야지 제대로 빌드가 된다. 이제 개발환경이 셋팅되었으니 진짜로 삽질할 일만 남았구나… ㅋㅋㅋ

prompt>mvn compile exec:java

Written by gomiski

2011/08/06 at 5:58 am

Posted in Java, Lecture