반응형
1. Python 설치
    . http://www.python.org/download/ 

2. Pydev 설치
    . update site : http://pydev.org/updates
    . eclipse -> Window -> Preferences -> Interpreter-Python에서 New 에서  python.exe 의 경로를 찾아 선택

3. Python 환경변수 및 패스 설정
    . Windows
        환경변수명 : PYTHONPATH
        환경변수값 : %PYTHONPATH%;C\Python32
        패스추가    : C\Python32

    . Mac
        환경변수 추가 : export PYTHONPATH=/Library/Python/2.6

반응형
Posted by seungkyua@gmail.com
,
반응형
1. 수치형 (Numbers)
    . int, long. complex, float 
    . type : IntType, LongType, ComplexType, FloatType

2. 문자열 (Strings)
    . 문자들의 집함, 내용 변경이 안됨
    . 'spams', "ham"
    . type : StringType

3. 리스트 (Lists)
    . 순서를 가지는 객체의 집합
    . ['ham', 'spam']
    . type : ListType

4. 사전 (Dictionaries)
    . 순서를 가지지 않는 객체의 집합. 키-값(key-value) 로 저장
    . {'ham':4, 'spam':5}
    . type : DictionaryType

 5. 튜플 (Tuples)
    . 순서를 가지는 파이썬 임의 객체의 집합이다. 내용 변경이 안됨
    . ('ham', 'spam')
    . type : TupleType

5. 파일 (Files)
    . 파일에 자료를 입 출력하기 위한 객체이다.
    . f = open('ham')
    . type : FileType

6. None
    . null 을 의미
    . type : NoneType





반응형
Posted by seungkyua@gmail.com
,
반응형
1. html5 기능을 감지할 수 있는 라이브러리
    . Modernizr(http://www.modernizr.com) : 2011-05-27 현재 


<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>HTML5 browser detect</title>

<script src="/html5/js/modernizr-1.7.min.js"></script>

<script language="javascript">

if (Modernizr.canvas) {

alert("html5 canvas supported");

} else {

alert("html5 canvas not supported");

}

if (Modernizr.canvastext) {

alert("html5 canvastext supported");

else {

alert("html5 canvastext not supported");

}

if (Modernizr.video) {

if (Modernizr.video.ogg) {

alert("html5 video theora supported");

} else if (Modernizr.video.h264) {

alert("html5 video H.264 supported");

}

} else {

    alert("html5 video not supported");

</script>

</head>

<body>

...

</body>

</html>


2. 직접 소스로 알아보기
    - canvas
        . DOM <canvas> 엘리먼트 객체의 getContext 속성이 지원되는지 확인

function supports_canvas() {

return !!document.createElement('canvas').getContext;

}


function supports_canvas_text() {

if (!supports_canvas()) { return false; }

var dummy_canvas = document.createElement('canvas');

var context = dummy_canvas.getContext('2d');

return typeof context.fillText == 'function';

}


if (supports_canvas_text()) {

alert("html5 canvastext supported");

} else {

alert("html5 canvastext not supported");

}


    - 비디오
        . DOM <video> 엘리먼트 객체의 canPlayType 속성이 지원되는지 확인

function supports_video() {

return !!document.createElement('video').canPlayType;

}


/* Mac, iPhone 에서만 지원하는 유료 코덱

 * MPEG-4 컨테이너의 H.264 베이스라인 비디오와 AAC LC 오디오 지원

 * return string : "probably" - 지원, "maybe" - 아마도, "" - 미지원

 */

function supports_h264_baseline_video() {

if (!supports_video()) { return false; }

var v = document.createElement('video');

return v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');

}


/* firefox 와 같은 오픈소스 브라우저가 지원하는 코덱

 * ogg 컨테이너와 Theora 비디오와 Vorbis 오디오를 지원

 */

function supports_ogg_theora_video() {

    if (!supports_video()) { return false; }

    var v = document.createElement('video');

    return v.canPlayType('video/ogg; codecs="theora, vorbis"');

}


/* Chrome, firefox, Opera 와 같은 오픈소스 브라우저가 지원하는 오픈소스 코덱

 * WebM 컨테이너와 vp8 비디오와 Vorbis 오디오를 지원

 */

function supports_webm_video() {

    if (!supports_video()) { return false; }

    var v = document.createElement('video');

    return v.canPlayType('video/webm; codecs="vp8, vorbis"');

}



if (supports_h264_baseline_video() == 'probably') {

alert("html5 video H.264 supported");

} else {

alert("html5 video H.264 not supported");

}

if (supports_ogg_theora_video() == 'probably') {

    alert("html5 video theora supported");

} else {

    alert("html5 video theora not supported");

}

if (supports_webm_video() == 'probably') {

    alert("html5 video vp8 supported");

} else {

    alert("html5 video vp8 not supported");

}


    - 로컬 저장소

    - 위치정보
        . 전역 객체(window, navigator)의 속성이 지원되는지 확인
        . navigator.geolocation;









 
반응형
Posted by seungkyua@gmail.com
,

PHP 설치

프로그래밍/php 2011. 5. 27. 00:01
반응형
I. 리눅스에서 설치
    1. 필요한 라이브러리
        - Apache(http://httpd.apache.org)
        - OpenSSL(http://www.openssl.org)
        - Mod_SSL(http://www.modssl.org)  : OpenSSL 에 대한 Apache 모듈 인터페이스 제공
        - PHP(http://www.php.net)
        - PHP Library : /usr/src  에 다운받는다
            . PDFlib 와 gd 에 필요한 JPEG 라이브러리(ftp://ftp.uu.net/graphics/jpeg)
            . gd 에 필요한 PNG 라이브러리(http://www.libpng.org/pub/png/libpng.html)
            - 위 PNG 라이브러리에 필요한 zlib 라이브러리(http://www.zlib.net)
            - PDFlib 에 필요한 TIFF 라이브러리(http://www.libtiff.org)
            - IMAP  에 필요한 IMAP 클라이언트

    2. PHP 설치
# cd /usr/src/httpd-2.2.9
# ./configure --prefix=/usr/local/apache2

# cd /usr/src/php-5.2.6
# ./config --prefix=/usr/local/php
                --with-mysqli=/usr/local/mysql_config \
                --with-apx2=/usr/local/apache2/bin/apxs \
                --with-jpeg-dir=/usr/src/jpeglib \
                --with-tiff-dir=/usr/src/tiffdir \
                --with-zlib-dir=/usr/src/zlib \
                --with-imap=/usr/src/imapcclient \
                --with-gd
# make
# make install
# cp php.ini-dist /usr/local/lib/php.ini    (개발용)
# cp php.ini-recommended /usr/local/lib/php.ini   (운영용)

# cd /usr/src/openssl-0.9.8h
# ./config --prefix=/usr/local/ssl
# make
# make test
# make install

# cd /usr/src/httpd-2.2.9
# SSL_BASE=../openssl-0.9.8h \
   ./configure \
   --prefix=/usr/local/apache2 \
   --enable-so
   --enable-ssl
# make
# make certificate TYPE=custom
# make install

# vi /usr/local/apache2/conf/httpd.conf
   <!-- 주석해제 -->
   AddType application/x-httpd-php .php
   AddType application/x-httpd-php-source .phps
   ...
   Include conf/extra/httpd-ssl.conf

# vi /usr/local/lib/php.ini
   <!-- 추가 -->
   extension = extenstion_name.so

# cp 설치된모듈* /usr/local/lib/php/extensions/

# cd /usr/local/apache2/bin
# ./apachectl configtest
# ./apachectl start



II. 윈도우에 설치
    1. 필요한 라이브러리
        - Apache(http://httpd.apache.org) : apache_2.2.9-win32-x86-openssl-0.9.8h-r2.msi
            . http://tud.at/programm/apache-ssl-win32-howto.php3 문서를 읽고 ssl 설치
        - PHP5(http://www.php.net)
            . php-5.2.6-win32.zip   :  PHP ZIP 파일                 설치경로 : c:\php
            . pecl-5.2.6.win32.zip   : 라이브러리 모음 파일    설치경로: c:\php\ext

[php.ini 수정]
extension_dir = c:/php/ext
doc_root="원하는 경로"
# 아래 원하는 라이브러리 해제
extension=php_pdf.dll 
extension=php_mysqli.dll
extension=php_pdfflib.dll
extension=php_gd2.dll
extension=php_imap.dll

[httpd.conf 수정]
LoadModule php5_module c:/php/php5apache2_2.dll
PHPIniDir "c:/php/"
AddType application/x-httpd-php.php 







 
반응형
Posted by seungkyua@gmail.com
,
반응형
1. array 출력하는 함수

function dump_array($array) {

    if (is_array($array)) {

        $size = count($array);

        $string = "";

        if ($size) {

            $count = 0;

            $string .= "{";

            foreach ($array as $var => $value) {

                $string .= $var . " = " . $value;

                if ($count++ < ($size-1)) {

                    $string .= ", ";

                }

            }

            $string .= " }";

        }

        return $string;

    } else {

        return $array;

    }

}


2. 오류 처리 방법

function errorHandler ($errno, $errstr, $errfile, $errline) {

echo "<br/><table bgcolor=\"#cccccc\"><tr><td>

      <p><strong>ERROR:</strong> " . $errstr . "</p>

      <p>Please try again, or contact us and tell us

      that the error occurred in line " . $errline . " of

      file " . $errfile . "</p>";

if (($errno == E_USERERROR) || ($errno == E_ERROR)) {

echo "<p>This error was fatal, program ending</p>

      </td></tr></table>";

exit;

}

echo "</td></tr></table>";

}

set_error_handler('errorHandler');

trigger_error('Trigger function called', E_USER_NOTICE); 







 
반응형
Posted by seungkyua@gmail.com
,
반응형

http://www.davidflanagan.com/

1. 문서 엘리먼트 드래그하기
    - 17.02.Drag.js

2. 단축키 설정을 위한 Keymap 클래스
    - 17.08.Keymap.js

반응형
Posted by seungkyua@gmail.com
,
반응형
1. 이벤트 처리기와 HTML 엘리먼트
 이벤트 처리기 호출 시점  지원되는 엘리먼트 
 ondblclick 더블클릭한 경우   대부분의 엘리먼트
 onclick 마우스를 눌렀다 떤 경우, mouseup 이벤트 후에 연달아 발생함. 기본 동작을 취소하기 위해서는 false를 반환   대부분의 엘리먼트
 onkeydown 키를 누른 경우. 취소하려면 false를 반환  <body> <form> 
 onload 문서 로딩이 끝난 경우  <body>, <frameset>, <img> 
 onunload 문서나 프레임셋을 언로드한 경우 (해당 페이지에서 빠져나가는 경우)  <body>, <frameset> 
 onblur 마우스 포인터나 입력 커서가 엘리먼트를 멋어나 입력 포커스를 잃어버리는 경우   <body>, <label>, <button>, <input>, <select>, <textarea>
 onchange 다른 폼 엘리먼트의 값이 변한경우  <input>, <select>, <textarea> 

    - onsubmit, onclick, onkeydown, onkeypress, onmousedown, onmouseup, onreset
        . false 를 반환하면 행동이 실행되는 것을 취소할 수 있다.
    - onmouseover
        . window status line 에 연결된 링크 url 을 보여주는 것을 막을려면 true 를 반환한다. 

2. 이벤트 전파
    - 이벤트 포착(capture) 단계에서는 Document 객체에서 시작하여 문서 트리 아래쪽으로 이벤트가 전파된다.
    - 대상 노드에 직접 등록되어 있는 적절한 이벤트 처리기가 실행된다.
    - 문서 계층 구조에 따라 대상 엘리먼트에서 Document 객체로 이벤트가 되돌아가는 bubbling phase 단계이다.
    - Event.stopPropagation() 메소드를 호출하여 더 이상 이벤트가 전파되는 것을 막을 수 있다.
    - Event.preventDefault() 메소드를 호출하여 <a> 클릭의 경우 기본 이벤트 처리 3단계를 거친 후 브라우저가
      하이퍼 링크를 따라가는 기본적인 동작을 막을 수 있다.

3. Event 객체의 프로퍼티
    - type
        . 이벤트의 타입, click, mouseover 등
    - target
        . 이벤트가 발생한 노드
    - currentTarget
        . 이벤트를 처리하고 있는 노드. 만약 이벤트가 포착단계나 bubbling 단계에서 처리되는 중이라면
          이 프로퍼티의 값은 target 과 다르다.
    - eventPhase
        . Event.CAPTURING_PHASE, Event.AT_TARGET, Event.BUBBLING_PHASE 상수 값 중 하나이다.
    - bubbles
        . 이벤트가 문서 트리를 따라 위로 올라가는지를 나타내는 부울 값
    - cancelable
        . preventDefault() 메소드를 사용하여 이벤트의 기본 행동을 취소할 수 있는지 나타내는 부울 값

4. MouseEvent 의 프로퍼티
    - Button
        . mousedown, mouseup, click 이벤트 동안 어떤 마우스 버튼의 상태가 바뀌었는지를 나타낸다.
          버튼의 상태가 바뀌었을 때만 사용된다. 0 : 왼쪽 버튼, 1: 가운데 버튼, 2: 오른 쪽 버튼
    - clientX, clientY
        . 문서의 얼마나 스크롤되었는지는 상관 없이 화면상 가장 위쪽 지점에서 이벤트가 발생했으면
          clientY 값은 0 이다.
        . IE 이외의 다른 브라우저에서는 window.pageXOffset 과 window.pageYOffset 을 더해 줘서
          창에 대한 좌표를 문서에 대한 좌표로 바꿔줄 수 있다.
    - screenX, screenY
        . 마우스 포인터가 사용자 모니터의 왼쪽 상단부분에 대해 상대적으로 어디에 위치하는지를 나타냄

5. IE 에서 이벤트 처리기와 메모리 누수
    - IE 에서는 중첩된 함수를 이벤트 처리기로 사용할 때 메모리 누수가 발생하기 쉽다.
    - 아래 함수가 호출되면 주어진 폼 엘리먼트에 이벤트 처리기가 추가된다.
    - 함수는 폼 엘리먼트를 참조하지 않지만 클로저의 일부분으로 인식되는 유효범위는 폼 엘리먼트를 참조한다.
    - 폼 엘리먼트는 자바 스크립트 function 객체를 참조하고 이 객체는 폼객체를 참조한다.
function addValidationHandler(form) {
    form.attachEvent("onsubmit", function() { return vallidate(); });
}

    - 메모리 누수 해결을 위해서는 IE 를 위한 프로그램에서는 최대한 중첩된 함수를 작성하지 않는다.
      다른 방법은 onunload() 이벤트가 발생하면 모든 이벤트 처리기를 주의해서 제거한다.








반응형
Posted by seungkyua@gmail.com
,
반응형
1. 툴팁 만들기
/**
 * 아래의 css 클래스가 정의되어야 한다.
 * .tooltipShadow
 *     background: url(shadow.png);  /* 반투명한 그림자 */
 * }
 * .tooltipContent {
 *     left: -4px; top: -4px;
 *     background-color: #ff0;
 *     border: solid black 1px;
 *     padding: 5px;
 *     font: bold 10pt sans-serif;
 *
 */
function Tooltip() {
    this.tooltip = document.createElement("div");
    this.tooltip.style.position = "absolute";
    this.tooltip.style.visibility = "hidden";
    this.tooltip.className = "tooltipShadow";
   
    this.content = document.createElement("div");
    this.content.style.position = "relative";
    this.content.className = "tooltipContent";
   
    this.tooltip.appendChild(this.content);
}
Tootip.prototype.show = function(text, x, y) {
    this.content.innerHTML = text;
    this.tooltip.style.left = x + "px";
    this.tooltip.style.top = y + "px";
    this.tooltip.style.visibility = "visible";
    if (this.tooltip.parentNode != document.body)
        document.body.appendChild(this.tooltip);
};
Tooltip.prototype.hide = function() {
    this.tooltip.style.visibility = "hidden";
};











반응형
Posted by seungkyua@gmail.com
,
반응형
1. http://quirksmode.org/
    - http://quirksmode.org/dom/
        . Peter-Paul Koch 의 웹사이트로 W3C DOM에 대한 호환 정보

2. http://www.webdevout.net/
    - http://www.webdevout.net/browser-support
        . David Hammond 의 웹사이트로 DOM 호환성을 포함하여 HTML, CSS 등의 정보도 포함한다.

반응형
Posted by seungkyua@gmail.com
,
반응형
1. </script> 태그
    . document.write() 메소드나 innerHTML 프로퍼티를 사용하여 동적인 HTML을 작성할 때 동적인 HTML 안에
      </script> 태그는 escape 시켜줘야 한다. HTML 파서는 문자열 안에서라도 무조건 </script> 문자열을 발견
      하면 현재 실행 중인 스크립트를 중단한다.
<script>
f1.document.write("<script>");
f1.document.write("document.write('<h1>Hello</h1>')");
f1.document.write("<\/script>");

2. URL(javascript:) pseudoprotocol 사용
    . javascript: 를 사용하면 한 줄 코드로 인식한다. 여러 문장을 쓰려면 ; 으로 구분하여 쓴다.
    . URL 자바스크립트가 실행될 때 새 문서로 출력되는 리턴 값이 있으면 현재 출력 중인 문서의 내용이
      변경될 수 있다. 그러므로 아무런 문서 변경을 하고 싶지 않으면 아무 값도 반환하지 말아야 한다.
    . void 0; 를 이용하여 아무 값도 반환하지 않을 수 있다.
javascript:window.open("about:blank"); void 0;





 




 





반응형
Posted by seungkyua@gmail.com
,