C#에서의 키워드 readonly와 const는 값을 변경할 수 없다는 같은 특징을 가지고 있다. const int a = 1; readonly int b = 2; 하지만 차이점이 있다면 readonly키워드가 붙은 변수의 경우 생성자에서의 변경을 허용한다.const키워드의 경우 변수 선언시 명시적(생성자X)으로 값을 저장하여야 한다. readonly는 인스턴스 선언시 초기화 되지만 const는 컴파일 할때 초기화 된다. 아래는 두 readonly와 const의 비교 소스코드이다. class ProgramEx { readonly int ri = 5; const int ci = 4; public ProgramEx() { this.ri = 3; //this.ci = 3; //ci는 생성자에서 초기화 할 수 ..
정보은닉이라고 하면 보여주기 싫은 정보를 감추는 것으로 해석할 수 있다. 객체지향 프로그래밍 언어에서의 정보은닉은 인스턴스의 멤버에 직접접근을 막는 것이다. class Program{ public int no = 0; } 객체를 정의하고 인스턴스를 생성하고 위에 제시한 no라는 변수에 접근이 가능할 것이다. 하지만 no에 10이하의 수만 저장할 수 있다고 할 때 no의 접근에 10이하의 수로 제한하는 어떤 제한하는 방법도 가지고 있지 않다. class Program{ int no = 0; public void setNo(int no){ if(no > 10){ return; } this.no = no; } public int getNo(){ return no; } } 그래서 getter와 setter라는 ..
Array객체의 선언 방법var array1 = [1,2,3,4,5];var array2 = new Array();var array3 = new Array(10);var array4 = new Array(5,4,3,2,1); /* Array객체 */ arr = new Array(5,4,3,2,1); console.log('배열의길이>>>>>'+arr.length); console.log('Array.join()>>>>>'+arr.join()); //배열을 문자열로 리턴 console.log('Array.pop()>>>>>'+arr.pop()); //배열의 마지막요쇼를 제거 후 마지막요소 리턴 arr.push({이름:'남궁춘'}); //배열의 마지막에 새로운 요소 추가 console.log('Array.j..
델리게이트란 메서드를 값으로 가질 수 있는 타입으로써 델리게이트형 타입 변수를 선언함으로써 이 변수에 메서드를 값으로 넘길 수 있다. 자세한 부분은 밑에 코딩 참고 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DelegateApplication; namespace DelegateApplication1 { class Program { static void Main(string[] args) { DelegateEx de = new DelegateEx(); //Console.WriteLine(de.sDel(1,2)); //SDelegate..
Colored By Color Scripter™ 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 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ConsoleApplication11; namespace ConsoleApplication1 { class OperatorTest { static void Main(string[] args) { Operators o..
선택정렬 버블정렬 구현코드 Colored By Color Scripter™ 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 58 59 60 61 62 import java.util.Scanner; public class Sort1 { static int[] bubbleSort(int[] arr) { int temp = 0; for (int i = 0; i
Colored By Color Scripter™ 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 import java.util.*; public class MapOrder implements Comparator{ private List mapList; private ArrayList treeList; private..
1. 엑셀에 우편번호 txt 파일을 작성(copy&paste)한다. 우편번호 파일을 받는 곳은... 개발자를 위해 zipcode를 제공해주는 사이트가 있다.http://www.zipfinder.co.kr/ 2. 엑셀에 다른이름으로 저장한 후 .csv 확장자 파일로 바꾼다. 이상한 경고창이 뜰 것인즉 ok로 무시한다. 3. 해당 .csv파일을 .txt확장자로 바꾼다.(작성자는 .csv 파일이 열리지 않아 검색해보고 알았음..) 4. .txt파일을 열면 각 엘리먼트마다 (,)콤마로 구분되어진 것을 볼 수 있을 것이다. 5. 이제 toad for mysql에서 접속한다. 토드에서 저장할 때 테이블을 우선 만들고 우편번호를 밀어 넣어도 되고, 밀어넣는 즉시 테이블을 만들수도 있다. 아주 편리하다. 6. 토드에서..
[javascript] 쿠키보기 alert(document.cookie); 생성방법 document.cookie = 'Name=value;Expires=날짜;Domain=도메인;Path=경로;Secure'; Name=value 쿠키의 이름과 값 Expires 쿠키의 제거날짜 지정 Secure 쿠키가 보안연결을 사용하고 있을 때 전송되야 하는지의 여부(지정하면 SSL보안에서만 쿠키를 사용할 수 있다.) Colored By Color Scripter™ 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 //쿠키 생성 var date = new Date(); //alert(date.getTime()); //오늘 날짜 출력 date.setTime..
const는 상수로써 사용한다는 뜻 int num = 10, num2 = 20;const int* ptr = # //다음과 같이 포인터 변수 타입의 앞에 const키워드가 위치할 경우..*ptr = 20; //에러!! 포인터가 참조하고 있는 값의 변경을 허용하지 않는다.ptr = &num2; //포인터가 참조하는 주소값의 변경은 허용 만약에 아래와 같이 포인터 변수앞에 const키워드가 붙는다면...위 와는 반대로int* const ptr = #ptr = &num2; //에러!! 포인터가 참조하고 있는 주소값의 변경은 불허*ptr = 20; //포인터가 참조하는 값의 변경은 허용 const int* const ptr = #처럼 포인터변수의 타입과 변수 앞에 둘다 const키워드가 오..
sitemesh는 레이아웃을 꾸며주는 기술이다. 웹페이지들을 보면 어떤 화면을 출력하던지 항상 같은 위치에 존재하는 태그들을 볼 수 있다.(메뉴나 하단내용 등) 같은 기술로는 tiles나 velocity 등이 있지만 이것들과 sitemesh는 동작하는 구성이 다르다. Tiles나 Velocity 방식이 전체 페이지 중 내용 부분에 해당하는 코드만을 생성하는 방식이라면, SiteMesh는 완전한 HTML 페이지를 생성한 뒤 Decorator라는 패턴을 사용하여 데코레이터HTML 페이지에 레이아웃을 입히는 방식이다. sitemesh 설정 1. 스프링 메이븐의 라이브러리를 디펜던시한다.(pom.xml) (그룹아이디 : opensymphony, 아이팩트아이디 : sitemesh) 2. sitemesh.xml과 ..
모 사이트에서 여러개의 알림메세지를 하나씩 보여주는 기능을 보고 작성해 봄 Colored By Color Scripter™ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 $(document).ready(function(){ arr = new Array(); $('#notice_content p').each(function(index){ arr[index] = this; }); idx=0; len=$('#notice_content p').length; setInterval( function(){ if(idx==len){ idx=0; } $('#notice_content p').css('display','none'); $(arr[idx]).slideDown('sl..
Colored By Color Scripter™ 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 Board 스터디모집 자료게시판 Etc 일상이야기 blank 알림 알립니다 알립니다 알립니다
Colored By Color Scripter™123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160..
사용용도 : 웹 어플리케이션의 최초 시작시 초기화 작업이나 종료 작업에 쓰임(DB의 커넥션 객체를 가져온다거나 등의..) 관련 인터페이스 : ServletContextListener 관련 클래스 : - 사용법 : 1. ServletContextListener인터페이스를 구현하는 클래스를 작성한뒤 초기화작업 메서드 contextInitialized(ServletContextEvent sce) 종료작업 메서드 contextDestroyed(ServletContextEvent sce) 를 오버라이딩해준다. (사용해보니 톰캣을 시작 할때 최초 1번 contextInitialized를 수행했고, 톰캣을 재시작 했을 때 1번 contextDestroyed가 수행됐다. 톰캣을 종료할 때는 수행 되지않았다.) 2. 오..