엔티티를 지속적으로 저장하고 있는 속성을 영속성 컨텍스트 라고 말할 수 있다. JPA에서는 기본적으로 EntityManagerFactory객체를 이용해서 EntityManager객체를 생성하고,이 EntityManager객체의 메서드를 이용해서 조회, 저장, 변경, 삭제의 작업을 수행한다. 영속성 컨텍스트는 눈으로 확인 할 수는 없지만, EntityManager를 생성할 때 같이 만들어지고 EntityManager를 닫을 때 사라진다. Entity에는 다음과 같은 상태가 존재한다. ▶ 비영속@Entity로 지정한 객체를 생성했을 뿐 EntityManager를 사용하고 있지 않은 상태이다. ▶ 영속영속성 컨텍스트가 엔티티를 관리할 수 있는 상태를 '영속' 상태라 한다.EntityManager의 persis..
1. pom.xml dependency org.springframework.data spring-data-jpa 1.2.0.RELEASE org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final org.hibernate hibernate-core 4.1.9.Final org.hibernate hibernate-entitymanager 4.1.9.Final org.hibernate hibernate-ehcache 4.1.9.Final com.jolbox bonecp 0.7.1.RELEASE mysql mysql-connector-java 5.1.22 runtime 2. dao-context.xml hibernate.cache.use_second_..
서버환경 : 리눅스 CentOS 6.9이 글은 우선 아파치와 mod_jk, openssl 그리고 톰캣이 설치되어 있고 웹환경이 다 구현되어 있다는 전제로 설정하는 부분만 적는다.서버에 Let'sEncrpyt도 마찬가지로 설치되어 있어야 한다. Let'sEncrpyt 디렉토리로 이동..RPM방식으로 설치하니 두 가지 경로가 나온다.[root@host ~]# whereis letsencrypt letsencrypt: /etc/letsencrypt /usr/local/letsencrypt 인증서를 생성하는 명령어가 위치하는 곳은 /usr/local/letsencrypt이다
1. 이곳으로 가서 최신 설치파일의 주소를 가져온다.http://humdi.net/vnstat/ 2. wget http://humdi.net/vnstat/vnstat-1.17.tar.gz 3. tar -zxvf vnstat-1.17.tar.gz 4. cd vnstat-1.17makemake allmake install 5. 정상적으로 동작하는지 확인# vnstat --testkernelThis test will take about 60 seconds.Everything is ok. 6. # vnstat -u -i eth0Error: Unable to read database "/var/lib/vnstat/eth0".Info: -> A new database has been created. 7.# vnst..
mod_jk 설치를 위해서는 사전에 다음과 같은 패키지들을 설치하거나 설치되어 있어야 한다. yum -y install gcc gcc-c++ yum install httpd-devel 1. 먼저 mod_jk 설치 파일을 받는다. 그 다음 압축을 푼다. wget http://apache.mirror.cdnetworks.com/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz tar -zxvf tomcat-connectors-1.2.42-src.tar.gz
1. root 디렉토리로 가서 다음을 다운로드 wget http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip 2. 파일이 다운로드 되면 압축을 푼다.unzip GeoIPCountryCSV.zip 3. vi /root/only-Korea-IP-Allow.sh 작성##########################################!/bin/bashDATA=/root/GeoIPCountryWhois.csvIPT=/sbin/iptablesfor IPRANGE in `egrep "Korea" $DATA | cut -d, -f1,2 | sed -e 's/"//g' | sed -e 's/,/-/g'`do $IPT -A INPUT -p ..
1. 아래 명령어로 설치할 수 있는 jdk버전 확인 yum list java*jdk-devel 그럼 아래처럼 뜬다 1.6, 1.7, 1.8version을 설치 할 수 있음을 알 수 있다. Available Packages java-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.el6_8 base java-1.7.0-openjdk-devel.x86_64 1:1.7.0.141-2.6.10.1.el6_9 updates java-1.8.0-openjdk-devel.x86_64 1:1.8.0.141-2.b16.el6_9 updates 2. jdk 설치가장 최신 버전인 1.8version을 설치하겠다.yum install java-1.8.0-openjdk-devel.x86_6..
..... ..... 스크롤뷰 안에 리스트뷰를 위치하면 화면에 보이지 않는다.ListView의 속성인 android:layout_height="wrap_content"를 하면 하나의 아이템만 보이고, android:layout_height="match_parent"를 하면 아예 보이지 않는다. 본인은 인터넷을 돌아다니다 보면 여러가지 방법이 나오는데 그 중에서리스트뷰의 높이를 재설정해서 다시 그려주는 방법으로 해결했다. 123456789101112131415161718public void setListViewSize(ListView myListView) { ListAdapter myListAdapter = myListView.getAdapter(); if (myListAdapter == null) { r..
안드로에드에서 startActivity(Intent type)를 통해 액티비티를 전환하게 되면, 깜빡임과 함께 다른 액티비티로 전환된다. 하지만 액티비티를 전환할 때 애니메이션 효과를 주면 깜빡임 효과없이 액티비티가 개발자가 원하는 방향에서 나타날 수 있게 할 수 있다. 방법은 Activity클래스에서 overridePendingTransition(int showAnim, int hideAnim) 메서드를 호출하면 된다.12345678910//overridePendingTransition(int showAnim, int hideAnim); //다른 액티비티 호출 시startActivity(intent);overridePendingTransition(R.anim.rightin_activity,R.anim...
여기에서 정리하는 것을 요약해서 말하자면 별도의 Thread를 생성하고 사용 할 경우, 그 안에서는 UI 관련 객체(Button, TextView 등)에 대해서는 변경을 가할 수 없기 때문에 이를 해결 할 수 있는 방법을 정리하는 것이다. Thread 사용시 Handler의 필요성 안드로이드 어플리케이션이 실행되면 안드로이드에선 UI의 처리를 위해 사용되는 기본 쓰레드를 생성하는데 이것을 '메인쓰레드'라고 한다. 그런데 어떤 작업을 백그라운드로 실행 시키면서 그 작업의 상황을 중간중간 보고 받을 필요가 있는데, 백그라운드를 만드는 작업은 새로운 Thread를 만들어서 할 수 있다. 이를테면 의 진행상황을 TextView에서 표현할 상황이 생길 수 있다.새로운 Thread를 이용하여 ProgressBar의..
안드로이드에서 Bitmap 객체를 이용해 화면에 이미지를 나타낼 수 있다. 그리고 비트맵에는 그래픽을 그릴 수도 있다. Bitmap을 사용할 때 더블버퍼링(새로운 비트맵을 만들고 비트맵에 그래픽이나 이미지를 다 그려놓은 다음 완성된 Bitmap을 마지막에 canvas에 그리고 뷰가 다시 그려져야 할 때 기존의 Bitmap을 화면에 표시하는 기법)방식을 사용한다. Bitmap은 다음과 같이 createBitmap(...)메서드를 이용해 생성하고 Canvas에 셋팅한다.123Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);Canvas canvas = new Canvas();canvas.setBitmap(bitmap);Co..
기본적인 그래픽을 그리는 방법은 View를 상속하는 클래스를 만들고 Paint, Canvas객체를 이용하면 된다. View를 상속하는 클래스 A를 만든다.A의 생성자에서 Paint객체를 가지고 그리기 관련 설정을 한다.A에서 onDraw(Canvas canvas)메서드를 오버라이딩하고, 파라미터인 canvas를 이용해 drawRect, drawCircle, drawText, drawLine 메서드를 이용하여 각각 사각형, 원, 텍스트, 선을 그린다. 다음은 액티비티 화면에 두 개의 그래픽(하나는 선, 하나는 면)을 그리는 테스트 코드다. + View클래스를 상속하는 클래스 작성 (여기에서 Paint와 Canvas를 이용하여 그래픽을 그린다.) 1234567891011121314151617181920212..
안드로이드에서는 보안 때문에 일반적 RDBMS(MySQL, MSSQL 등)를 사용하지 못한다고 한다.그래서 AsyncTask객체의 doInBackground메서드를 이용해서 이 구현부에서 HttpURLConnection객체를 이용해 로컬서버나 실서버와 통신하고 결과를 json형태로 가져와 파싱하는 과정을 거치는 프로그램을 짜야 한다. 다음은 로컬서버와 통신하기 위한 테스트 코드이다. +서블릿 코드12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667@WebServlet("/CommonJdbc")public class CommonJdbc ..
리스트뷰는 말 그대로 view를 리스트의 형태로 보여주는 것을 얘기한다. 리스트뷰는 여러 리스트 목록 중에 하나의 목록을 선택 가능하다. 그래서 '선택 위젯'이라고 한다. '선택 위젯'에는 리스트, 스피너, 그리드, 갤러리 등이 있다. 리스트뷰를 만들기 위해서는 다음과 같은 절차를 따라야 한다.1. 리스트 뷰의 목록이 될 하나의 디자인 레이아웃 xml을 만든다. 그리고 이것을 액티비티에 인플레이션 하는 자바 코드를 작성한다.2. 하나의 리스트뷰 목록에 들어갈 정보를 클래스로 정의한다.3. 리스트뷰에 필요한 뷰를 가져오는 어댑터를 확장한 클래스를 만든다.4. 메인 액티비티에서 정보를 가져와서 setAdapter메서드를 이용해 3번의 어댑터 확장 클래스를 설정한다. list_view.xml리스트뷰 하나하나의..