시스템 종료와 재부팅 - shutdwon 명령어shutdown [옵션] [시간] [메세지] shutdwon -h 1010분후에 시스템을 종료shutdwon -r now바로 시스템 재부팅shutdown -c시스템종료 예약 취소 명령 - init 명령어리눅스 시스템이 가동되는 방법에는 0~6까지 7개가 있다. 이를 런레벨(Run Level)이라고 한다.0 - 종료모드1 - 단일 사용자 모드(시스템 복구시 사용)2 - 다중 사용자 텍스트 모드(NFS 사용불가)3 - 다중 사용자 텍스트 모드4 - 사용안함5 - 다중 사용자 그래픽 모드6 - 재부팅 모드 init 0 시스템을 종료한다.init 6 시스템을 재부팅 한다.init 3 다중사용자 텍스트 모드로 전환한다. 현재 사용되고 있는 init모드를 설정하거나 확..
익명클래스는 인스턴스 생성시 이름이 없는 클래스이다. 익명 클래스는 클래스, 인터페이스가 그 대상이 된다. 클래스의 선언과 인스턴스 생성을 동시에 하기 때문에 한번만 사용되며, 하나의 객체만을 생성한다는 특징이 있다. 익명클래스 형태 new 조상클래스이름{} new 인터페이스이름{} 이름이 없기 때문에 생성자도 가질 수 없다. 일반적인 클래스와는 달리 상속과 구현을 동시에 할 수 없으며 오로지 하나의 인터페이스를 구현하거나 하나의 클래스를 상속 받을 수 있다.System.out.println(new Layout(){ void test(){ System.out.println(i); } void tests(){ System.out.println(222); } }); 위의 결과는 패키지명,메인클래스이름$1@1..
jsp 개발환경 구축 ○ java 설치 및 설정 - java se jdk 다운로드(본인은 1.8 버전받음)http://www.oracle.com/technetwork/java/javase/downloads - FTP를 열어서 다운받은 jdk파일 올린다. - java jdk1.8.~ 압축파일 해제 (tar -xvf 파일명) - mv 명령어로 압축을 해제한 jdk1.8.~디렉토리를 /usr/local/ 경로로 이동시킨다. - jdk 경로설정을 쉽게 알아보기 위해 jdk1.8.~디렉토리의 심볼릭링크를 java이름으로 변경> ln -s /usr/local/jdk.1.8~ java - 콘솔에서 자바를 컴파일, 실행하기 위해 환경변수를 설정한다.1. 수정을 위해 profile파일을 연다(vi 모드)> vi /etc..
1. 구글 리캡차 api key 발급https://www.google.com/recaptcha/admin#list label : 이름domain : URL입력 (로컬이라면 localhost 입력) owner : 소유자 이메일 발급받은 후 sitekey, secretkey 복사 2. 메이븐 의존성 주입net.tanesha.recaptcha4jrecaptcha4j0.0.7 3. jsp 엘리먼트 작성 siteKey는 발급받은 것 적으면 됨 4. 자바스크립트 메서드 작성(본인은 ajax 처리) $.ajax({ url : '/member/captchaAjax', type : 'post', data : { recaptcha : document.getElementById("g-recaptcha-response").v..
열거형은 사용자 정의 타입이다. 기본형 중에서도 숫자와 관련된 타입(int, long, double, short 등등)을 상속받아 정의할 수 있다. 기본형식은[접근제한자] enum enum명{ 식별자1, 식별자2, 식별자3 .......}처럼 사용 enum Today : byte { Monday, Tuesday, Wednesday } enum Olympians { Zeus, Hera, Poseidon = 10, Athena, Ares = 20, Aphrodite } 다음은 enum을 정의한 것으로Today와 Olympians이다. Today처럼 상속을 받으면 해당 기본형타입을 토대로 사용하며, 상속받는 타입이 없을 경우(Olympians경우)에는 기본적으로 int(System.Int32)를 상속받는다. ..
저장 프로시저는.. 하나 이상의 sql문을 후에 사용하기 편하게 저장해둔 것. mysql 4.x 이하 버전에서는 프로시저를 지원하지 않는다. mysql 5.x 부터 지원.. 저장 프로시저를 사용하는 이유? - 복잡한 작업을 하나의 단위로 묶어 쉽게 사용하기 위해 - 같은 코드를 반복할 필요없이 프로시저를 만들어 놓고 재활용 하기 위해 - 테이블의 칼럼이름이나 로직 등이 변경 되었을 때 저장 프로시저만 변경하면 되므로 사용하는 입장에서는 신경을 쓸 필요가 없다 - 저장 프로시저는 컴파일된 형식으로 저장되기 때문에 DBMS가 명령을 수행하는 작업이 보다 적어지므로 성능의 향상을 기대해 볼 수 있다. 간단한 사용법(사용프로그램 토드 FOR MYSQL) 1 2 3 4 5 6 7 8 9 10CREATE PROCE..
- delegate는 함수(메서드)를 담을 수 있는 타입이다.- 타입이기 때문에 메서드의 매개변수나 리턴타입 같은 곳에도 delegate타입을 선언 할 수 있다.- 델리게이트에 메서드를 여러개 담을 수 있다. 다음은 델리게이트의 사용 예이다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 delegate void OperDelegate(int n1, int n2); class Oper { public void Add(int n1, int n2) { Console.WriteLine(n1 + n2); } public void Sub(int n1, int n2) { Console.WriteLine(n1 - n2); } publi..
연산자 오버로딩이란?- 피연산자가 하나 또는 둘 모두가 사용자 정의 클래스거나 구조체 형식일 때 해당 클래스나 구조체 안에 사용자 정의 연산자를 구현할 수 있는 것 예를 들어 코드를 보겠다.class Kilogram { int kg; public int Kg { get { return kg; } } public Kilogram(int kg) { this.kg = kg; } public int Add(Kilogram k) { return this.kg + k.kg; } public static Kilogram operator +(Kilogram k1, Kilogram k2){ return new Kilogram(k1.kg + k2.kg); } } class Program { static void Main(..
Object는 모든 클래스의 최상위 조상이다.c#도 모든 객체지향언어가 그렇듯 단일 상속만을 지원하는데..만약 클래스 A와 클래스 B가 있는데클래스 A는 부모클래스클래스 B는 자식클래스라 하자. c#컴파일러는 컴파일시 아무것도 상속 받고 있지 않는 클래스에 대해 System.Object클래스를 상속한다.클래스 B의 부모는 A클래스이지만 클래스 A의 부모는 아무것도 없기 때문에 결국 컴파일시 class A : Object{ }같이 변한다. 종국에는 상속관계도에 따라Object class - A class - B class와 같이되므로 A와 B 클래스 둘 전부 Object를 최고 조상 클래스로 갖게된다. Object클래스는 참조형식이지만 값형식이 되기도 한다.값형식일 경우는 System.ValueType을 ..
is 와 as 키워드와 비슷한 기능을 하는 것을 JAVA로 말한다면 instanceof키워드를 들 수 있다. is - 참조변수와 인스턴스를 비교해 형변환이 가능하다면 true 형변환이 불가하다면 false를 반환.as - 참조변수와 인스턴스를 비교해 형변환이 가능하다면 해당 인스턴스를 반환 아니라면 null을 반환 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58namespace ObjectApplication { class TestParent { internal..
자바와 같이 c#도 객체지향언어이며, 상속개념이 있다.상속은 부모타입의 멤버들을 자손이 물려받는 것이다.상속받는다를 확장한다라고도 표현할 수 있다. 이유는 부모의 멤버들을 자손이 물려받고 자손은 물려받은 멤버와 함께 자손 자신이 가지고 있는 멤버가 따로 있을 수도 없을 수도 있기 때문에 부모에 비해 항상 자손클래스 멤버의 수는 같거나 더 많기 때문.. 다음은 상속의 예이다. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace InheritApplication { class GasStation { protected int disel; ..
Spring 3.2 부터 이 @ControllerAdvice가 생겼다고 한다.컨트롤러 서비스 퍼시스턴스 단에 발생할 수 있는 예외를 이 어노테이션을 지정한 클래스에서 공통적으로 관리 해 줄 수 있다. 사용 방법은 간단하다.(세부적으로 들어가면 간단하지 않음.) 보는 것처럼 스프링 빈을 정의해주는 config파일에 구문을 넣어준다.context:component-scan이라는 것은 bean엘리먼트를 정의하지 않아도 자동으로 해당 패키지에 있는 @compoenet, @service, @controller 등을 알아서 스캔해 인스턴스를 생성해준다. 안에 있는 context:include-filter는 스프링이 제공하는 기본필터를 사용하지 않고 @ControllerAdvice의 클래스를 사용하겠다는 뜻.. 다음..
Thread 쓰레드는 프로세스에 포함되는 자원이다.프로세스란 실행중인 프로그램이며, 프로그램을 실행할 때 필요한 자원이 하나 이상의 쓰레드이다. 하나의 프로세스에 하나의 쓰레드만 있다면 싱글 쓰레드 프로세스라 부르고, 하나의 프로세스에 하나 이상의 쓰레드가 있다면 멀티 쓰레드 프로세스라고 부른다.옛날에 쓰던 DOS환경을 보통 싱글쓰레드, 요즘 쓰는 windows환경을 멀티쓰레드로 이해하면 되겠다. 자바에서 콘솔 프로그램을 짤 때 public staitc void main(String[] args)라는 메서드가 있는데 이것조차도 하나의 쓰레드이다. 아래의 쓰레드 예제는 쓰레드를 생성하는 두가지 방법을 코딩한 것이다.쓰레드를 생성하는 방법은 Runnble인터페이스를 구현하는 방법과 Thread클래스를 상속하..
소스코딩을 하면서 JDBC연결에 필요한 username, password, url 같은 접속 정보나 로컬호스트와 서버의 파일 저장 경로같은 설정을 기존에는 MessageSource기능을 이용해서 사용하였는데..이 방법의 단점은 자바의 controller단에서 request객체를 이용하여 서버의 url을 가져온 다음에 조건문으로 localhost나 127.0.0.1, 192.168.x.x 같은 호스트가 포함되어 있으면 로컬이라하고 아니면 서버로 구분한 문자열을 service단으로 넘겨서이문자열을 플래그 값으로 해서 실서버 환경인지 로컬작업 환경인지를 구분하는 조금 복잡한 구조를 가지고 있었는데.. 어떻게 다른 방법이 없나 하다가 profile이라는 기능을 발견하게 되었다. 사용방법은 의외로 간단하면서 유용..
본인은 닷네임 코리아에서 네임서버를 신청했다. 닷네임코리아 - 도메인관리 - DNS 설정 - 네임서버 변경 보시다시피 네임서버 정보에 1차,2차,3차,4차에 카페24의 웹호스팅 네임서버를 적어주었다.(네임서버는 카페24의 홈화면 왼쪽 하단에 있으며, 위의 경우는 웹호스팅일 경우이고, 서버호스팅일 경우에는 네임서버가 다르니 참고.) 그리고 카페24의 나의서비스관리 - 호스팅관리 - 도메인연결관리 - 도메인 직접 입력하기 에서 닷네임코리아에 신청한 도메인명(위의 사진 예 : a.net) 을 입력한다. 적용은 내 경우엔 신청한지 꽤 지나서 그런지 몰라 바로(10분 이내) 되었지만, 처음 설정할 때는 24시간이 걸릴 수도 있다고 했으니 알아두자.