Programming

MySQL code

* My-SQL – mysql 공식 사이트 http://www.mysql.com – 로그인하는 방법 mysql -h 호스트 -u 아이디 -p => 패스워드를 입력 mysql -u 아이디 -p패스워드 – 데이터베이스 보기 show databases; – 데이터베이스 사용 use 데이터베이스명 – 테이블 목록 보기 show tables; – 종료하기 ( quit or \q ) – 데이터베이스 만들기 create database 데이터베이스이름; – mysql에 새로운 사용자 계정 추가하기 1) root 계정으로 접속 : mysql -u root -p 2) mysql 데이터베이스 연결 : use mysql 3) user 테이블에 새로운 사용자 계정 추가 insert into user (host,user,password) values (‘호스트’,’아이디’,password(‘패스워드’) ); // 패스워드는 반드시 암호화 처리 IP => 특정 호스트 % => 모든 호스트 localhost => 로컬에서만 접속 가능 4) db 테이블에 권한 […]

Posted in MySQL | Comments Off on MySQL code

JSP로 XML출력

<%@ page language=”java” contentType=”text/xml; charset=utf-8″ pageEncoding=”utf-8″%> <article> <article_no><%=”게시물번호”%></article_no> <content><![CDATA[<%=”글내용”%>]]></content> </article>   contenttype만 text/xml로 설정하시고 똑같이 out.printl 으로 출력

Posted in JSP | Comments Off on JSP로 XML출력

JSP페이지 URL로 직접 접근

URL을 통해서 JSP 페이지에 직접 접근하는 것을 차단해야하는 경우가 있습니다. 특히 스트러츠처럼 프론트 콘틀롤러 패턴을 적용한 시스템에서는 서블릿 콘트롤러만이 JSP를 실행할 수 있어야하죠. 그런데 JSP 페이지를 일반 HTML 페이지와 동일하게 취급하여 배치하게 되면, 영리한(?) 사용자가 JSP 경로를 알아내어 서블릿을 통하지 않고 실행할 수가 있습니다. JSP 페이지를 매핑된 경로(*.do)를 통해 호출하는 것이 정상이지만, 여전히 JSP페이지는 URI접근에 노출되어 있기 때문에 사용자가 매핑경로를 통하지 않고 JSP 페이지를 실행하는 것을 막지는 못한다는 얘깁니다. 이를 해결할 여러 가지 방법이 있습니다. (1) JSP를 WEB-INF 디렉토리 밑에 두는 방법 모든 JSP 페이지를 WEB-INF 디렉토리 아래에 두는 방법입니다. WEB-INF 디렉토리는 클라이언트에게는 접근이 금지되어 있으나, 컨테이너는 접근이 허용됩니다. 다시 말하면 사용자는 WEB-INF 아래의 JSP 페이지를 URI 로 접근하여 실행할 […]

Posted in JSP | Comments Off on JSP페이지 URL로 직접 접근

ime-mode 입력폼의 한영전환 지정

ime-mode 속성은 IME(Input Method Editor)의 상태를 반환하거나 설정합니다. 로그인 폼에서 아이디와 비밀번호를 입력하는 경우나 우편번호를 찾기 위해서 동이름을 입력하는 경우 한글/영문을 기본으로 지정해 놓으면 상당히 편리한데 이런 경우 사용하는 속성이라고 할 수 있습니다. ime-mode 속성의 값은 아래와 같이 3가지로 지정할 수 있습니다. auto 기본값으로 ime-mode 값이 지정되지 않은 것과 같습니다. active 활성화 된 상태입니다. 값을 입력하면 기본적으로 한글이 입력됩니다. 우편번호를 찾기 위해서 동이름을 입력하는 경우 많이 사용됩니다. <input type=”text”style=”ime-mode:active;”><input type=”text”style=”ime-mode:active;”> inactive 비활성화 된 상태입니다. 값을 입력하면 기본적으로 영문이 입력됩니다. <input type=”text”style=”ime-mode:inactive;”><input type=”text”style=”ime-mode:inactive;”> disabled IME를 사용할 수 없는 경우입니다. 한영키를 눌러도 한글로 변환하지 않고 영문만 입력 가능합니다. 아이디와 비밀번호는 한글이 허용되지 않으므로 이런 경우 사용할 수 있습니다. <input type=”text” style=”ime-mode:disabled;”><input type=”text” […]

Posted in CSS | Comments Off on ime-mode 입력폼의 한영전환 지정

Shift-JIS text to UTF-8

I searched for an answer for how to convert Japanese Shift-JIS text to UTF-8 format but couldn’t find any suitable answer so here is my proposed method. I first encountered Japanese Shift-JIS when cutting and pasting Japanese text that my wife had typed on a Windows computer. I thought it started out as UTF-8 which is best for the web but during the cut and paste in the Windows environment, it was converted to Shift-JIS format. Shift-JIS is a horrible way of encoding Japanese symbols that is only used for Japanese and there are several versions of it. But for us PC programmers, we are interested in Microsoft Code Page […]

Posted in etc | Comments Off on Shift-JIS text to UTF-8

Popup Window in the center

<script language=”javascript”> <!– function OpenWin() { window.open(“팝업.html”,”ow1″,”width=200,height=200,top=”+(screen.availHeight/2-100)+”,left=”+(screen.availWidth/2-100)+”");//팝업창 중앙에 띄우기 } //–> </script><script language=”javascript”> <!– function OpenWin() { window.open(“팝업.html”,”ow1″,”width=200,height=200,top=”+(screen.availHeight/2-100)+”,left=”+(screen.availWidth/2-100)+”");//팝업창 중앙에 띄우기 } //–> </script> <body leftMargin="0" topMargin=”0″ onload=”OpenWin()”>   </body><body leftMargin="0" topMargin=”0″ onload=”OpenWin()”> </body> ——————————————————————————–   popup.html <body> <img src=”예쁜버튼그림1.jpg” width=”10″ height=”10″ onClick=”opener.location.href=’http://www.naver.com’;window.close()” style=”cursor:hand”> <img src=”예쁜버튼그림2.jpg” width=”10″ height=”10″ onClick=”window.close()” style=”cursor:hand”> </body><body> <img src=”예쁜버튼그림1.jpg” width=”10″ height=”10″ onClick=”opener.location.href=’http://www.naver.com’;window.close()” style=”cursor:hand”> <img src=”예쁜버튼그림2.jpg” width=”10″ height=”10″ onClick=”window.close()” style=”cursor:hand”> </body>

Posted in jQuery, Javascript | Comments Off on Popup Window in the center

background

A. 배경이미지의 반복 (background-repeat 속성) • 속성 : background-repeat • 값 : repeat, repeat-x, repeat-y, no-repeat, inherit •기본값 : repeat • 적용대상 : 모든 요소 이 속성은 요소의 배경 이미지가 반복되는 방향을 지정한다. 이러한 반복의 시작은 background-position 값으로 정한다. 속성 값에 대한 의미는 다음과 같다. repeat : 수평과 수직으로 반복된다. repeat-x : 수평으로 반복된다. repeat-y : 수직으로 반복된다. no-repeat: 반복하지 않고 한 번만 표시한다. body { background-image:url(’paper.gif’); background-repeat:repeat-y; }body { background-image:url(‘paper.gif’); background-repeat:repeat-y; } B. 배경이미지의 이동, 고정 (background-attachment 속성) • 속성 : background-attachment • 값 : scroll, fixed, inherit • 기본값 : scroll • 적용대상 : 모든 요소 이 속성은 배경 이미지가 요소와 함께 스크롤될지 안될지 결정한다. 대부분 body에 적용한다. 속성 값에 대한 의미는 […]

Posted in CSS | Comments Off on background