'분류 전체보기'에 해당되는 글 126건

  1. 2009.06.08 Firefox 에서 스크롤 양 조절
  2. 2009.04.24 [COM] [예제] COM Aggregation 에서의 casting
  3. 2009.04.10 Calling Convention (VS)
  4. 2009.04.07 [C++] Static member initialization
  5. 2009.04.02 patch 파일 적용.
  6. 2009.03.22 Emacs command 1
  7. 2009.03.18 Web 관련 Site
  8. 2009.03.10 Tree Traversal
  9. 2009.03.07 DUMPBIN
  10. 2009.03.06 Test Site
  11. 2009.02.28 Windows Contents Capturing using WM_PRINT Message
  12. 2009.02.28 [C++] 상속
  13. 2009.02.24 Plug-In 관련 Site
  14. 2009.01.23 Cygwin에서 HOME Directory 변경
  15. 2009.01.19 [C++] casting
  16. 2009.01.18 [C++] 연산자 우선순위
  17. 2009.01.18 [C/C++] Pointers
  18. 2009.01.18 [C++] Enumerations
  19. 2009.01.18 [C++] Misc.
  20. 2009.01.18 [C++] Virtual Function
  21. 2009.01.18 [C++] Representation & Class definition
  22. 2009.01.18 [C++] C 프로그래머에게의 제안
  23. 2009.01.16 Visual Studio
  24. 2009.01.14 Visual Studio에 Guideline 보이게하기
  25. 2008.09.25 emacs 윈도즈(windows)에서 etags 사용하기
  26. 2008.09.21 비스타에서 CapsLock을 Control로 사용하기
  27. 2008.09.21 emacs-snapshot 설치
  28. 2008.09.19 Linux Command
  29. 2008.09.16 잘 알려진 포트 번호
  30. 2008.09.16 Vista MBR 복구

Firefox 에서 스크롤 양 조절

TIPs 2009. 6. 8. 11:39
about:config

mousewheel.withnokey.sysnumlines 를 false로
mousewheel.withnokey.numlines 에 스크롤양 입력
:

[COM] [예제] COM Aggregation 에서의 casting

CS/COM 2009. 4. 24. 07:00
COM공부중 Aggregation 공부하던중 왠지 casting 부분에서 급 혼란. -_-; Casting을 하게 되면, Casting된 Object를 Base class부터 생각하고,  이후 그 Object의 Derived class를 생각하자!!! -_-;;;
class IUnknown
{
public:
	virtual void QueryInterface() = 0;
	virtual void AddRef() = 0;
	virtual void Release() = 0;
};

class IDummy : public IUnknown
{
public:
	virtual void Fx() = 0;
};

class INondelegatingUnknown
{
public:
	virtual void NondelegatingQueryInterface() = 0;
	virtual void NondelegatingAddRef() = 0;
	virtual void NondelegatingRelease() = 0;
};

class C : public IDummy,
	      public INondelegatingUnknown
{
public:
	virtual void QueryInterface() { std::cout << "QueryInterface" << std::endl; }
	virtual void AddRef() { std::cout << "AddRef" << std::endl; }
	virtual void Release() { std::cout << "Release" << std::endl; }

	virtual void NondelegatingQueryInterface() 
                 { std::cout << "NondelegatingQueryInterface" << std::endl; }
	virtual void NondelegatingAddRef() 
                 { std::cout << "NondelegatingAddRef" << std::endl; }
	virtual void NondelegatingRelease() 
                 { std::cout << "NondelegatingRelease" << std::endl; }

	virtual void Fx() { std::cout << "Fx()" <<  std::endl; }

	C();

public:
	IUnknown* m_pI;
	void Go();
};

C::C()
{
	m_pI = reinterpret_cast<IUnknown*>
                   ( static_cast<INondelegatingUnknown*>(this) ); 
}

void C::Go()
{
	m_pI->QueryInterface();
}

int _tmain(void)
{
	C c;

	c.Go();

	return 0;
}
Inside COM Aggregation 예제
:

Calling Convention (VS)

CS/Common 2009. 4. 10. 22:02
. 모든 calling convention에서 모든 Arguments는 함수로 전달될 32비트로 확장되며 리턴 값 또한 32비트로 확장되며, EAX에 리턴된다. 단, 8-byte 구조체에 대해서는 EDX:EAX 레지스터 쌍에 리턴된다.

. 더 큰 구조체는 리턴 구조체를 숨기기 위해서 EAX레지스터에 포인터로서 리턴된다.

. Parameter는 스택에 오른쪽에서 왼쪽으로 push 된다. 
(Structures that are not PODs will not be returned in registers.)

.만약 ESI, EDI, EBX, EBP 레지스터가 함수 내부에서 사용된다면, 컴파일러는 이들을 restore하고 save하기 위해서 prolog와 epilog 코드를 생성한다.



__cdecl 
Stack Cleanup : Caller
인자 전달 : 스택에 Parameters를 reverse order로 Push한다. (RIGHT to LEFT)

C/C++ 에서의 기본 Calling convention이다.
스택이 Caller에 의해서 cleanup 되기 때문에 가변인자 함수를 사용할 수 있다.
각 함수를 호출할 때마다 cleanup 코드를 포함하애 하기 때문에 __stdcall보다 큰 실행 파일을 생성한다.
__cdecl 변경자는 함수 이름이나 variable 전에 위치시킨다.
__cdecl을 강제하기 위해서는 /Gd 컴파일러 옵션을 지정한다.
/Gz(stdcall), /Gr(fastcall) 컴파일러 옵션을 지정했을 경우만 __cdecl을 필요로 한다.

// Example of the __cdecl keyword on function

int __cdecl system(const char *);

 

// Example of the __cdecl keyword on function pointer

typedef BOOL (__cdecl *funcname_ptr)(void * arg1, const char * arg2, DWORD flags, ...);

foo(1, 2, 3, 4);

004118F3  push        4   

004118F5  push        3   

004118F7  push        2   

004118F9  push        1   

004118FB  call        foo (411118h)

00411900  add         esp,10h

 

 

int __cdecl foo(int a, int b, int c, int d) {

00411840  push        ebp 

00411841  mov         ebp,esp

00411843  sub         esp,0CCh

00411849  push        ebx 

0041184A  push        esi 

0041184B  push        edi 

0041184C  lea         edi,[ebp-0CCh]

00411852  mov         ecx,33h

00411857  mov         eax,0CCCCCCCCh

0041185C  rep stos    dword ptr es:[edi]

    int x = a+b+c+d;

0041185E  mov         eax,dword ptr [a]

00411861  add         eax,dword ptr [b]

00411864  add         eax,dword ptr [c]

00411867  add         eax,dword ptr [d]

0041186A  mov         dword ptr [x],eax

    return x;

0041186D  mov         eax,dword ptr [x]

00411870  pop         edi 

00411871  pop         esi 

00411872  pop         ebx 

00411873  mov         esp,ebp

00411875  pop         ebp 

00411876  ret

}




__stdcall
Stack Cleanup : Callee
인자 전달 : 스택에 Parameters를 reverse order로 Push한다.(RIGHT TO LEFT)

Win32 API를 호출하기 위해 사용된다. 
#define CALLBACK __stdcall #define WINAPI __stdcall #define WINAPIV __cdecl #define APIENTRY WINAPI

__stdcall을 강제하기 위해서는 /Gz 컴파일러 옵션을 지정한다.
__cdecl로 선언된 함수와 같은 방법으로 values를 리턴한다.

// Example of the __stdcall keyword

#define WINAPI __stdcall

 

// Example of the __stdcall keyword on function pointer

typedef BOOL (__stdcall *funcname_ptr)

(void * arg1, const char * arg2, DWORD flags, ...);

foo(1, 2, 3, 4);

004118F3  push        4   

004118F5  push        3   

004118F7  push        2   

004118F9  push        1   

004118FB  call        foo (411249h)

 

 

int __stdcall foo(int a, int b, int c, int d) {

00411840  push        ebp 

00411841  mov         ebp,esp

00411843  sub         esp,0CCh

00411849  push        ebx 

0041184A  push        esi 

0041184B  push        edi 

0041184C  lea         edi,[ebp-0CCh]

00411852  mov         ecx,33h

00411857  mov         eax,0CCCCCCCCh

0041185C  rep stos    dword ptr es:[edi]

    int x = a+b+c+d;

0041185E  mov         eax,dword ptr [a]

00411861  add         eax,dword ptr [b]

00411864  add         eax,dword ptr [c]

00411867  add         eax,dword ptr [d]

0041186A  mov         dword ptr [x],eax

    return x;

0041186D  mov         eax,dword ptr [x]

00411870  pop         edi 

00411871  pop         esi 

00411872  pop         ebx 

00411873  mov         esp,ebp

00411875  pop         ebp 

00411876  ret         10h

}




__fastcall
Stack Cleanup : Callee
인자 전달 : Stored in registers, then pushed on stack

가능하다면 arguments가 함수에 레지스터를 통하여 전달된다.
이후의 컴파일러는 parameters를 저장하기 위해 다른 register를 사용할 수도 있다.
__fastcall을 강제하기 위해서는 /Gr 컴파일러 옵션을 지정한다.

// Example of the __fastcall keyword

#define FASTCALL    __fastcall

 

void FASTCALL DeleteAggrWrapper(void* pWrapper);

// Example of the __ fastcall keyword on function pointer

typedef BOOL (__fastcall *funcname_ptr)

(void * arg1, const char * arg2, DWORD flags, ...);

foo(1, 2, 3, 4);

004118F3  push        4   

004118F5  push        3   

004118F7  mov         edx,2

004118FC  mov         ecx,1

00411901  call        foo (41124Eh)

 

 

int __fastcall foo(int a, int b, int c, int d) {

004115D0  push        ebp 

004115D1  mov         ebp,esp

004115D3  sub         esp,0E4h

004115D9  push        ebx 

004115DA  push        esi 

004115DB  push        edi 

004115DC  push        ecx 

004115DD  lea         edi,[ebp-0E4h]

004115E3  mov         ecx,39h

004115E8  mov         eax,0CCCCCCCCh

004115ED  rep stos    dword ptr es:[edi]

004115EF  pop         ecx 

004115F0  mov         dword ptr [ebp-14h],edx

004115F3  mov         dword ptr [ebp-8],ecx

    int x = a+b+c+d;

004115F6  mov         eax,dword ptr [a]

004115F9  add         eax,dword ptr [b]

004115FC  add         eax,dword ptr [c]

004115FF  add         eax,dword ptr [d]

00411602  mov         dword ptr [x],eax

    return x;

00411605  mov         eax,dword ptr [x]

00411608  pop         edi 

00411609  pop         esi 

0041160A  pop         ebx 

0041160B  mov         esp,ebp

0041160D  pop         ebp 

0041160E  ret         8

}




__thiscall
Stack Cleanup : Callee
인자 전달 : Pushed on stack; this pointer stored in ECX



__clrcall
Stack Cleanup : n/a
인자 전달 : Parameters를 CLR expression stacke에 order로 Load한다.(left to right).


예전에 사용하던 블로그에 있던 글인데, 정리할 겸 다시 정리했다. 이놈의 calling convention은 왜 자꾸 까먹는건지.. ㅜㅜ

출처 : MSDN, 나의 옛 블로그
:

[C++] Static member initialization

CS/C/C++ 2009. 4. 7. 11:24
Q.
// Widget.cpp
int Widget::state_;
위와 같은 코드를 보시고 class의 static member 변수의 초기화를 안했다고 생각하고 있진 않으신가요?.
표준 C++에서 정의하고 있는 static member 변수 초기화에 대해 간단히 정리했습니다.



A.
먼저 표준 C++에서 정의하고 있는 세가지 storage duration에 대해 간단히 정리해보겠습니다.

static storage duration - dynamic storage duration을 가지지 않으면서 local인 객체들은 모두 static storage duration을 가지게 됩니다. 이 storage에 있는 객체들은 속해 있는 프로그램의 duration만큼 지속됩니다. 또한 local 변수의 선언에 static keyword를 사용하게 되면 역시 static storage duration을 가지게 됩니다. class의 data member에 사용된 static keyword도 마찬가지입니다.
 
automatic storage duration - auto, register를 명시적으로 선언한 local 객체, 혹은 static, extern등이 명시적으로 선언되지 않은 local 객체들은 automatic storage duration을 가지게 됩니다. 이 storage에 있는 객체들은 자신이 생성된 블록이 끝나기 전까지만 지속됩니다.
 
dynamic storage duration - 프로그램 수행 중에 new-expressions을 가지고 생성된 객체들은 dynamic storage duration을 가지게 되며 delete-expressions를 사용하여 파괴될 수 있습니다.
 
위와 같은 용어의 이해를 바탕으로 ISO/IEC-14882의 3.6.2(1)을 참고하면 다음과 같습니다.

Static storage duration을 가지는 객체들을 위한 storage는 어떤 다른 초기화보다 먼저 0으로 초기화된다(zero-initialization).
이러한 초기화와 상수 초기화를 합쳐서 정적(static) 초기화라고 부르고 나머지는 동적(dynamic) 초기화라고 부른다.
 
static storage duration을 가지는 POD(Plain Old Data) 객체들의 상수 초기화는 항상 어떤 다른 dynamic 초기화보다 먼저 일어나게 된다.
 
동적 초기화되는 객체들과, 같은 translation unit안의 namespace scope에 정의된 static storage duration을 갖는 객체들은 transation unit안에 선언된 순서에 따라 초기화된다.
 
// Widget.cpp
int Widget::state_;
이제 state_ 변수는 static storage duration을 가지게 되고 따라서 다른 종류의 초기화에 앞서 0으로 초기화된다는 사실을 알 수 있습니다.

따라서 위의 코드는 초기화를 잊은 코드가 아니라는 사실을 알 수 있습니다.
단지 코드의 작성자는 그 state_ 변수를 0으로 초기화하려고 했었던 것이죠.

참고로 local에 선언된 static 변수는 어떤 다른 초기화 과정에 앞서 0으로 초기화됩니다.
만약 그 변수가 constant-expressions를 가진 POD 타입일 경우 선언되어 있는 블록이 시작되기 전에 초기화되며 이외의 경우 선언된 라인이 처음 실행되는 순간에 초기화됩니다. 이때 객체의 생성자가 exception을 throw하게 되면 다음 실행되는 순간에 다시 초기화를 시도하게 됩니다.

만약 이 객체가 생성되는 순간에 다시 함수에 재진입(re-enter)하게 되면 (recursively) 결과는 정의되어 있지 않습니다(undefined). 아래의 코드를 참고하세요.

int foo(int i) {
static int s = foo(2 * i); // recursive call. undefined
return i + 1;
}
 
Static storage duration을 가지는 변수들이 하나의 translation unit 안에 정의되어 있다면 선언되어 있는 순서대로 초기화된다는 것을 보장받지만 다른 translation unit 안에 정의되어 있는 static storage duration을 가지는 변수들간의 초기화 순서는 정의되어 있지 않습니다. 따라서 이러한 다른 translation unit의 변수들간의 dependency는 가능하면 피해야 합니다.

하지만 어떠한 경우라도 변수들의 파괴는 정확히 초기화 순서의 반대로 일어납니다.

이 글은 ISO/IEC 14882 문서를 참고하여 만들어졌습니다.

이 페이지의 내용보다 더 자세한 객체의 생성, 삭제에 관련된 다양한 사항들은 위의 문서를 참고하시면 됩니다.




정적 클래스 멤버는 객체의 일부가 아니라 따로 저장된다. 
정적 클래스 멤버에 대해서는 정적 멤버를 클래스 선언 밖에서 별도의 명령문으로 따로 초기화 한다.
하지만, 정적 멤버가 정수형 또는 열거형의 상수이면 클래스 선언 자체에서 초기화할 수 있다.
:

patch 파일 적용.

TIPs 2009. 4. 2. 16:25
 -pnum  or  --strip=num

Strip the smallest prefix containing num leading slashes  from  each file  name found in the patch file.  A sequence of one or more adjacent slashes is counted as a single slash.  This controls  how  file names  found  in  the  patch file are treated, in case you keep your files in a different directory than the  person  who  sent  out  the patch.  

For example, supposing the file name in the patch file was

/u/howard/src/blurfl/blurfl.c

setting 

-p0 gives the entire file name unmodified
-p1 gives u/howard/src/blurfl/blurfl.c without the leading slash, 
-p4 gives blurfl/blurfl.c

and  not specifying -p at all just gives you blurfl.c.  Whatever you end up with is looked for either in the current  directory, or the directory specified by the -d option.

:

Emacs command

TIPs 2009. 3. 22. 01:51

원문 : http://www.cs.rutgers.edu/LCSR-Computing/some-docs/emacs-chart.html

C-SP     set-mark-command  
C-q      quoted-insert

C-a      beginning-of-line   
C-b      backward-char  

C-r      isearch-backward

C-r RET  search-backward
  
C-s      isearch-forward
    
C-s RET  search-forward

C-c      exit-recursive-edit  
C-t      transpose-chars

C-d      delete-char   
C-u      universal-argument (M-num)

C-e      end-of-line   
C-v      scroll-up

C-f      forward-char   
C-w      kill-region

C-h      help-command   
C-x      Control-X-prefix

TAB      indent-for-tab-command  
C-y      yank

LFD      newline-and-indent  
C-z      suspend-emacs

C-k      kill-line   
ESC      ESC-prefix

C-l      recenter   
C-]      abort-recursive-edit

RET      newline   
C-_      undo

C-n      next-line   
SPC .. ~        self-insert-command

C-o      open-line   
DEL      delete-backward-char

C-p      previous-line


C-h v    describe-variable  
C-h d    describe-function

C-h w    where-is   
C-h k    describe-key

C-h t    help-with-tutorial  
C-h c    describe-key-briefly

C-h s    describe-syntax  
C-h b    describe-bindings

C-h n    view-emacs-news  
C-h a    command-apropos

C-h C-n  view-emacs-news  
C-h C-d  describe-distribution

C-h m    describe-mode   
C-h C-c  describe-copying

C-h l    view-lossage   
C-h ?    help-for-help

C-h i    info    
C-h C-h  help-for-help

C-h f    describe-function


C-x C-a  add-mode-abbrev  
C-x 5    split-window-horizontally

C-x C-b  list-buffers   
C-x ;    set-comment-column

C-x C-c  save-buffers-kill-emacs 
C-x <    scroll-left

C-x C-d  list-directory   
C-x =    what-cursor-position

C-x C-e  eval-last-sexp   
C-x >    scroll-right

C-x C-f  find-file   
C-x [    backward-page

C-x C-h  inverse-add-mode-abbrev 
C-x ]    forward-page

C-x TAB  indent-rigidly   
C-x ^    enlarge-window

C-x C-l  downcase-region  
C-x `    next-error

C-x C-n  set-goal-column  
C-x a    append-to-buffer

C-x C-o  delete-blank-lines  
C-x b    switch-to-buffer

C-x C-p  mark-page   
C-x d    dired

C-x C-q  toggle-read-only  
C-x e    call-last-kbd-macro

C-x C-r  find-file-read-only  
C-x f    set-fill-column

C-x C-s  save-buffer   
C-x g    insert-register

C-x C-t  transpose-lines  
C-x h    mark-whole-buffer

C-x C-u  upcase-region   
C-x i    insert-file

C-x C-v  find-alternate-file  
C-x j    register-to-dot

C-x C-w  write-file   
C-x k    kill-buffer

C-x C-x  exchange-dot-and-mark  
C-x l    count-lines-page

C-x C-z  suspend-emacs   
C-x m    mail

C-x ESC  repeat-complex-command  
C-x n    narrow-to-region

C-x $    set-selective-display  
C-x o    other-window

C-x (    start-kbd-macro  
C-x p    narrow-to-page

C-x )    end-kbd-macro   
C-x q    kbd-macro-query

C-x +    add-global-abbrev  
C-x r    copy-rectangle-to-register

C-x -    inverse-add-global-abbrev 
C-x s    save-some-buffers

C-x .    set-fill-prefix  
C-x u    advertised-undo

C-x /    dot-to-register  
C-x w    widen

C-x 0    delete-window   
C-x x    copy-to-register

C-x 1    delete-other-windows  
C-x {    shrink-window-horizontally
C-x }    enlarge-window-horizontally
C-x 2    split-window-vertically 
C-x 4    ctl-x-4-prefix   
C-x DEL  backward-kill-sentence


ESC C-SP mark-sexp   
ESC =    count-lines-region

ESC C-a  beginning-of-defun  
ESC >    end-of-buffer

ESC C-b  backward-sexp   
ESC @    mark-word

ESC C-c  exit-recursive-edit  
ESC O    ??

ESC C-d  down-list   
ESC [    backward-paragraph

ESC C-e  end-of-defun   
ESC \    delete-horizontal-space

ESC C-f  forward-sexp   
ESC ]    forward-paragraph

ESC C-h  mark-defun   
ESC ^    delete-indentation

ESC LFD  indent-new-comment-line 
ESC a    backward-sentence

ESC C-k  kill-sexp   
ESC b    backward-word

ESC C-n  forward-list   
ESC c    capitalize-word

ESC C-o  split-line   
ESC d    kill-word

ESC C-p  backward-list   
ESC e    forward-sentence

ESC C-s  isearch-forward-regexp   
ESC C-r  isearch-backward-regexp   

ESC f    forward-word

ESC C-t  transpose-sexps  
ESC g    fill-region

ESC C-u  backward-up-list  
ESC h    mark-paragraph

ESC C-v  scroll-other-window  
ESC i    tab-to-tab-stop

ESC C-w  append-next-kill  
ESC j    indent-new-comment-line

ESC ESC  ??    
ESC k    kill-sentence

ESC C-\  indent-region   
ESC l    downcase-word

ESC SPC  just-one-space   
ESC m    back-to-indentation

ESC !    shell-command   
ESC q    fill-paragraph

ESC $    spell-word   
ESC r    move-to-window-line

ESC %    query-replace    
ESC C-%  query-replace-regexp    

ESC t    transpose-words

ESC '    abbrev-prefix-mark  
ESC u    upcase-word

ESC (    insert-parentheses  
ESC v    scroll-down

ESC )    move-past-close-and-reindent 
ESC w    copy-region-as-kill

ESC ,    tags-loop-continue  
ESC x    execute-extended-command

ESC -    negative-argument  
ESC y    yank-pop

ESC .    find-tag   
ESC z    zap-to-char

ESC 0 .. ESC 9  digit-argument  
ESC |    shell-command-on-region

ESC ;    indent-for-comment  
ESC ~    not-modified

ESC <    beginning-of-buffer  
ESC DEL  backward-kill-word


C-x 4 C-f       find-file-other-window 
C-x 4 d  dired-other-window

C-x 4 .  find-tag-other-window  
C-x 4 f  find-file-other-window

C-x 4 b  pop-to-buffer   
C-x 4 m  mail-other-window


C-x r m  set-book-mark
C-x r l  list-bookmarks
C-x r b  bookmark-jump           

 

:

Web 관련 Site

Develop/WebKit 2009. 3. 18. 06:17
:

Tree Traversal

CS/Algorithm 2009. 3. 10. 17:59
To traverse a non-empty binary tree in preorder, perform the following operations recursively at each node, starting with the root node:

   1. Visit the root.
   2. Traverse the left subtree.
   3. Traverse the right subtree.

(This is also called Depth-first traversal.)



To traverse a non-empty binary tree in inorder, perform the following operations recursively at each node:

   1. Traverse the left subtree.
   2. Visit the root.
   3. Traverse the right subtree.

(This is also called Symmetric traversal.)



To traverse a non-empty binary tree in postorder, perform the following operations recursively at each node:

   1. Traverse the left subtree.
   2. Traverse the right subtree.
   3. Visit the root.



Finally, trees can also be traversed in level-order, where we visit every node on a level before going to a lower level. This is also called Breadth-first traversal.



Example

In this binary search tree,

Preorder traversal sequence: F, B, A, D, C, E, G, I, H (root,left child,right child)
Inorder traversal sequence: A, B, C, D, E, F, G, H, I (leftchild,rootnode,right node)
Note that the inorder traversal of this binary search tree yields an ordered list
Postorder traversal sequence: A, C, E, D, B, H, I, G, F (leftnode,rightnode,rootnode)
Level-order traversal sequence: F, B, G, A, D, I, C, E, H

원문 : http://en.wikipedia.org/wiki/Tree_traversal

:

DUMPBIN

TIPs 2009. 3. 7. 16:19
사용법: DUMPBIN [options] [files]

   옵션:

      /ALL
      /ARCHIVEMEMBERS
      /CLRHEADER
      /DEPENDENTS
      /DIRECTIVES
      /DISASM[:{BYTES|NOBYTES}]
      /ERRORREPORT:{NONE|PROMPT|QUEUE|SEND}
      /EXPORTS
      /FPO
      /HEADERS
      /IMPORTS[:filename]
      /LINENUMBERS
      /LINKERMEMBER[:{1|2}]
      /LOADCONFIG
      /OUT:filename
      /PDATA
      /PDBPATH[:VERBOSE]
      /RANGE:vaMin[,vaMax]
      /RAWDATA[:{NONE|1|2|4|8}[,#]]
      /RELOCATIONS
      /SECTION:name
      /SUMMARY
      /SYMBOLS
      /TLS
      /UNWINDINFO
:

Test Site

Develop/WebKit 2009. 3. 6. 16:14
:

Windows Contents Capturing using WM_PRINT Message

TIPs 2009. 2. 28. 18:59
:

[C++] 상속

CS/C/C++ 2009. 2. 28. 04:23

  public 상속 protected 상속  private 상속 
 public 멤버 public  protected private
 protected 멤버 protected protected  private 
 private 멤버 접근 불가 접근 불가  접근 불가 

:

Plug-In 관련 Site

Develop/WebKit 2009. 2. 24. 19:17
:

Cygwin에서 HOME Directory 변경

TIPs 2009. 1. 23. 10:37
Emacs Home과 겹치지 않게 하기 위해서 Cygwin.bat 에 다음 추가

set HOME=C:\cygwin\home\{USERNAME}


:-)
:

[C++] casting

CS/C/C++ 2009. 1. 19. 08:09
[ static_cast ] 
static_cast는 암시적으로 수행될 수 있는(역변환을 포함하여) 캐스팅을 수행할 수 있도록 한다.
 
double d = 3.14159265;
int i = static_cast<int>(d);
클래스에 대한 포인터 관점에서 static_cast는 상속된 클래스에서 기초 클래스로(암시적으로 수행되는 vaild conversion) 혹은 그 반대(기초 클래스에서 상속된 클래스)로의 캐스팅을 해 준다.
  
class Base {};
class Derived : public Base {};

Base *a = new Base;
Derived *b = static_cast<Derived *>(a);


[ dynamic_cast ] 
체크는 런타임시에 수행되며, 만약 변환된 포인터가 요청된 type의 유효한 객체에 대한 포인터가 아니라면 NULL 포인터를 리턴한다. (참조자였다면 bad_cast 예외를 던진다.) 

(다운 캐스팅 예)
class Base { virtual dummy() {} };
class Derived : public Base {};

Base* b1 = new Derived;
Base* b2 = new Base;

Derived* d1 = dynamic_cast<Derived *>(b1); // succeeds
Derived* d2 = dynamic_cast<Derived *>(b2); // fails: returns 'NULL'
(크로스 캐스팅 예)
class BaseOne { virtual dummy() {} };
class BaseTwo { virtual dummy() {} };
class Derived : public BaseOne, public BaseTwo
{
void dummy() {}
};

BaseOne* pBaseOne = NULL;
BaseTwo* pBaseTwo = new Derived;

pBaseOne = pBaseTwo; // error : 타입 변환을 할 수 없다.
pBaseOne = dynamic_cast<BaseOne*>( pBaseTwo ); // success


[ reinterpret_cast ] 
서로 관계가 없는 type간의 변환을 수행한다.
class A {};
class B {};

A * a = new A;
B * b = reinterpret_cast<B *>(a);


[ const_cast ] 
포인터 혹은 참조형의 상수성을 제거하는데 사용
class C {};

const C *a = new C;
C *b = const_cast<C *>(a);


[참조]
http://www.codeguru.com/forum/showthread.php?t=312456 
http://cbuilder.borlandforum.com/impboard/impboard.dll?action=read&db=bcb_tutorial&no=146
:

[C++] 연산자 우선순위

CS/C/C++ 2009. 1. 18. 22:27

::

Scope resolution

None

.

Member selection (object)

->

Member selection (pointer)

[]

Array subscript

()

Function call

()

Member initialization

++

Postfix increment

--

Postfix decrement

typeid()

Type name

cast

Type cast (conversion)

sizeof

Size of object or type

++

prefix increment

--

postfix decrement

~

One's complement

!

Logical not

-

Unary minus

+

Unary plus

&

Address of

*

Indirection

new

Create object

delete

Destroy object

()

Cast

.*

Pointer to member (objects)

->*

Pointer to member (pointer)

*

Multiplication

/

Division

%

Modulus

+

Addition

-

Subtraction

<<

Left shift

>>

Right shift

<

Less than

>

Greater than

<=

Less than or equal to

>=

Greater than or equal to

==

Equality

!=

Inequality

&

Bitwise AND

^

Bitwise exclusive OR

|

Bitwise inclusive OR

&&

Logical AND

||

Logical OR

E1 ? E2 : E3

Conditional

=

Assignment

*=

Multiple assignment

/=

Division assignment

%=

Modulus assignment

+=

Addition assignment

-=

Subtraction assignment

<<=

Left-shift assignment

>>=

Right-shift assignment

&=

Bitwise AND assignment

|=

Bitwise inclusive OR assignment

^=

Bitwise exclusive OR assignment

throw expr

Throw expression

,

comma




:

[C/C++] Pointers

CS/C/C++ 2009. 1. 18. 20:28
1. 배열의 끝을 하나 넘어선 포인터
배열의 끝을 하나 지난 포인터를 취하는것은 동작하는 것이 보장된다.
이것은 많은 알고리즘에서 중요하다.
하지만, 이런 포인터는 배열의 요소를 실제로 가리키고 있지 않기때문에, 읽거나 쓰는데 사용되선 안된다.
int main(void)
{
	...
	char a[3] = {'a', 'b', 'c'}

	char *start = &a[0];
	char *end = &a[4];

	while (p != end) cout << *p++;
	...
	return 0;
}

2. 포인터 연산 
하나의 포인터에서 다른 포인터를 뺐을 경우, 결과값은 포인터 값이다.
이때 포인터 연산은 같은 배열에 대해서 이루어 져아 한다.
 
void f()
{
	int v1[10];
	int v2[10];

	int i1 = &v1[5] - &v1[3]; // i1 = 2
	int i2 = &v1[5] - &v2[3]; // result undefined

	int *p1 = v2 + 2; // p1 = &v2[2]
	int *p2 = v2 - 2; // result undefined
	int *p3 = &v2[4] - 2; // p3 = &v2[2]
}

3. Pointer to constant VS Constant pointer
  
int main(void)
{
void f()
{
	char s[] = "Grom";
	
	const char* pc = s; // pointer to constant. *PC가 상수
	char* const cp = s; // constant pointer. CP가 상수
	const char* const cpc = s; // constant pointer to constant. *CPC, CPC 모두 상수
}
포인터를 상수로 만드는 선언자는 *const 이며, const* 선언자는 없다.
따라서 *전에 나오는 const는 기본 타입으로 간주된다.
 
char *const cp; // const pointer to char
const char* pc; // pointer to const char
char const* pc; // pointer to const char
원문 : C++ Programming Laguage 3rd Edtion.
:

[C++] Enumerations

CS/C/C++ 2009. 1. 18. 19:02
기본적으로, 열거자는 0부터 값을 증가 시킨다.
열거자는 이름을 가질 수 있으며, 각 열거자는 다른 type을 가지게 된다.
enum keyword {ASM, AUTO, BREAK};
위에서 AUTO는 keyword type이다.
  
void f(keyword key)
{
	switch (key) {
	case ASM:
		// do something
		break;
	case BREAK:
		// do something
		break;
	}
}
열거자는 정수형 타입의 constant-expression에 의해 초기화될 수 있다.
열거자의 범위는 반올림 해서 2의 지수승에 가장 가까운 수 -1 을 갖는다.
enum e1 {dark, light}; // range 0:1
enum e2 {a = 3, b = 9}; // range 0:15
enum e3 {min=-10, max=1000000} // range -1048575:1048575

정수형 값은 명시적으로 열거자 형으로 변환될 수 있다.
변환이 열거자 값의 변환 범위에 없다면, 결과는 비확정적인다.

원문 : C++ Programming Laguage 3rd Edtion.
:

[C++] Misc.

CS/C/C++ 2009. 1. 18. 17:50
Size
1 ≡ sizeof(char) ≤ sizeof(short) ≤ sizeof(int) ≤sizeof(long)
1 ≤ sizeof(bool) ≤ sizeof(long)
sizeof(char) ≤ sizeof(wchar_t) ≤ sizeof(long)
sizeof(float) ≤ sizeof(double) ≤ sizeof(long double)
sizeof(N) ≡ sizeof(signed N) ≡ sizeof(unsigned N)

cf) limit 확인
  
#include <limits>
// ...
numeric_limits<float>::max();
// ...

Declator
* pointer  prefix
*const constant pointer  prefix 
reference  prefix 
[] array  postfix 
()  function  postfix 
postfix 선언자는 prefix 보다 더 강하게 결합한다. *kings[]는 포인터의 벡터.


전역 변수 접근
지역 변수는 접근할 수 없지만, 숨겨진 전역 변수는 다음과 같이 접근 가능하다.
  
int x;

void f2()
{
	int x = 1; // hide global x
	::x = 2; // assign to global x
	x = 2; // assign to local x
	// ...
}

초기화
초기화값이 지정되지 않은 global, namespace, local static은 적당한 타입의 0으로 초기화된다.


wide character prefix
L"angst"와 같이 L prefix는 wide character를 나타낸다.


constant variable
const 키워드는 객체를 상수로 선언하기 위해 객체의 선언에 추가될 수 있다.
const int x = 10;
extern const int x;
를 헤더파일에 선언할 수 있음. (const 가 아닌경우 중복 정의)


pointing constant pointer
constant가 아닌 pointer로 constant인 pointer를 pointing할 수 없다.

 
void f()
{
	int a = 1;
	const int c = 2;
	const int* p1 = &c; 	// ok
	const int* p2 = &a; 	// ok
	int* p3 = &c; 		// error
}

참조형 초기화
일반 T&의 초기값 T형의 lvalue여야 하지만, 
const T&의 초기값은 다음과 같은 경우에 T형의 lvalue를 필요로 하지 않는다.
[1] 묵시적으로 T형으로의 형변환이 일어난 후
[2] T 형의 임시 변수에 결과값이 대입되고
[3] 임시 변수가 초기값으로 사용된다.

double& dr = 1; // error : lvalue needed
const double& cdr = 1; // ok

두번째 초기화는 다음과 같은 해석이 일어날 것이다.
double temp = double(1);
const double& cdr = temp;

임시로 생성된 값은 참조 범위가 끝날때까지 영속한다.


형변환
  
void f()
{
	void* pv = pi; 	// ok: implicit conversion of int* to void*
	*pv; 			// error : can't dereference void*
	pv++; 		// error : cna't increment void*
	
	int* pv2 = static_cast<int*>(pv); 		// explicit conversion back to int*
	
	double* pd1 = pv; 					// error
	double* pd2 = pi; 					// error
	double* pd3 = static_cast<double*>(pv); 	// unsafe
}
다른 type의 객체를 가리키는 포인터를 "cast"하는 것은 안전하지 못하다.
int형을 double로 cast 하는 경우, 일반적으로 int형은 4바이트 경계, double형은 8바이트 경계를 갖기 때문에 잘못된 결과를 가지게 된다.


구조체 맴버에서의 구조체 이름 사용
구조체의 type은 선언한 후 바로 사용 가능하지만, 새로운 객체의 생성은 그 구조체의 선언이 완전히 끝난 후에야 가능하다.

  
struct Link {
	Link* prev;	// ok
	Link* next;	// ok
	Link member;	// error: recursive definition
}
:

[C++] Virtual Function

CS/C/C++ 2009. 1. 18. 16:14
 
class Stack {
public:
	class Underflow{};
	class Overflow{};

	 // =0은 상속받은 클래스는 이 함수들을 다시 정의해야함을 의미
	virtual void push(char c) = 0;
	virtual void pop() = 0;
}

class Array_stack : public Stack {
	char* p;
	int max_size;
	int top;
public:
	Array_stack(int s);
	~Array_stack();

	void push(char c);
	char pop();
};

class List_stack : public Stack {
	list<char> lc;
public:
	List_stack() {}
	void push(char c) { lc.push_front(c); }
	char pop();
}

char List_stack::pop()
{
	char x = lc.front();
	lc.pop_front();

	return x;
}



void f(Stack& s_ref)
{
	s_ref.push('c');
	if (s_ref.pop() != 'c') throw Bad_pop();
}

void g()
{
	Array_stack as(200);
	f(as);

void h()
{
	List_stack ls;
	f(ls);
}

h()에서 f()가 호출되어졌을 때, List_stack::pop()이 호출되어져야만 한다.
g()에서 f()가 호출되어졌을 때, Array_stack::pop()이 호출되어져야만 한다.
이것을 풀기위해, Stack 객체는 런타임에 호출되어질 수 있는 함수를 가리키는 정보를 가지고 있어야만 한다.
이것을 위한 일반적인 구현 방법은 컴파일러가 virtual function 이름을 function을 가리키는 포인터들의 테이블의 index로 만드는 것이다. 이 테이블은 "a virtual function table" 혹은 간단하게 vtbl이라고 불린다.
virtual functino을 가지고 있는 각 클래스는 자신의 virtual function을 가리킬수 있도록 자신의 vtbl을 가지고 있다.



원문 : C++ Programming Laguage 3rd Edtion.
:

[C++] Representation & Class definition

CS/C/C++ 2009. 1. 18. 14:20
1. Representation
[a] 분리된 idea로써 "it"을 생각할 수 있다면, 그것을 class로 만들어라
[b] 분리된 entity로써 "it"을 생각할 수 있다면, 그것을 어떤 클래스의 object로 만들어라
[c] 두 개의 클래스가 공통 인터페이스를 가지고 있다면, 그 인터페이스를 추상 클래스(abstract class)로 만들어라
[d] 두개의 클래스의 구현이 현저히 의미있는 공통성을 가지고 있다면, 공통된 부분을 기초 클래스(base class)로 만들어라
[e] 어떤 클래스가 객체의 컨테이너라면, 그것을 템플릿(template)로 만들어라
[f] 만약 함수가 컨테이너를 위한 알고리즘을 구현한다면, 그것을 컨네이너 패밀리의 알고리즘을 구현하는 템플릿 함수로 만들어라.
[g] 만약 클래스셋, 템플릿등이 논리적으로 연관되어 있다면 그것들을 common namespace에 위치시켜라.

2. Class definition
[a] 전역 데이타를 사용하지 말아라(member를 사용)
[b] 전역 함수를 사용하지 말아라
[c] public 데이터 멤버를 사용하지 말아라
[d] [a]나 [c]를 피하기 위해 friends를 사용하지 말아라
[e] 클래스에 "type filed"를 놓지 말아라, virtual function을 사용하라
[f] 중요한 최적화를 위해서를 제외하고는 inline 함수를 사용하지 말아라.

원문 : C++ Programming Laguage 3rd Edtion.
:

[C++] C 프로그래머에게의 제안

CS/C/C++ 2009. 1. 18. 13:45
[1] C++ 에서 매크로는 거의 필요하지 않다.
const, enum : 상수를 정의
inline : 함수 호출 오버헤드 줄임
template : 함수와 타입의 군을 정의
namespace : 이름 충돌을 회피
하기 위해 사용할 수 있다.

[2] malloc()을 사용하지 말것
new 는 같은 작업을 더 잘 한다. realloc()대신 vector()를 사용하라

[3] void* 를 피하라
대부분의 경우에, cast는 디자인 에러를 불러온다. 만약 명시적인 형 변환이 필요하다면 "new casts"중 하나를 사용하라.

[4] C 스타일의 문자열의 사용을 최소화 하라
C++의 표준 라이브러리 string과 vector클래스는 전통적인 C스타일에 비해 간단한 프로그래밍을 제공할 수 있다.

[5] NULL 대신 0을 사용하라
어떤 오브젝트도 0의 주소로 할당되지는 않는다. 
C++에서는 type 확인이 더 엄격하기 때문에 NULL 매크로보다는 plain 0를 사용해라. 이것이 더 적은 문제를 일으킨다.
정 NULL을 사용하고 싶다면, const in NULL = 0 을 사용하라. 

원문 : C++ Programming Laguage 3rd Edtion.
:

Visual Studio

TIPs 2009. 1. 16. 12:24
__declspec (novtable)
원문 : Component Development with Visual C++ & ATL

추상적인 클래스의 생성자에서 초기화된 가상 함수 테이블 포인터는 파생 클래스의 생성자에 의해 다시 한번 덮어 씌여 지게 되므로 필요없게 된다.
따라서 ATL_NO_VTABLE 매크로가 지정될 때 링커는 가상 함수 테이블과 가상 함수를 없애고 가상 함수 테이블 포인터를 적절하게 초기화할 수 있게 된다.
기본적으로 ATL Object Wizard가 생성한 클래스에는 ATL_NO_VTABLE 매크로가 지정되어 있다. 그러나 클래스의 생성자에서 가상 함수를 호출하지 않도록 주의해서 사용해야 한다.
클래스 생성자에서 가상 함수를 호출해야 할 경우가 필요하다면 이 코드는 FinalConstruct 멤버 함수에서 처리해햐 한다. FinalConstruct 멤버 함수가 호출되는 경우에는 이미 COM 객체 클래스의 인스턴스가 생성되어 초기화가 된 상태가 되므로 안전하게 가상 함수를 호출할 수 있게 된다.



#pragma

예) 임시로 경고 끄기
#pragma warning(push)
#pragma warning(disable:4483)
...
#pragma warning(pop)



환경 변수 설정


C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat



[속성] 페이지에서 만들어진 매크로 ( Inside Microsoft Visual Studio .NET )


 매크로  설명

 ConfigurationName  현재 프로젝트 구성

 DevEnvDir  Visual Studio .NET 설치 폴더

 FrameworkDir  .Net Framework 설치 폴더

 FrameworkSDKDir  .Net Framework SDK 설치 폴더

 FrameworkVersion  .Net Framework 버전 번호

 Inherit  Visual Studio .NET이 만든 명령줄에서 상속된 속성의 순서

 InputDir  입력 파일 폴더는 프로젝트 파일 폴더와 같다

 InputExt  입력 파일의 확장자

 InputFileName  입력 파일의 이름 (이름 + 확장자)

 InputName  입력 파일명

 InputPath  입력 파일 경로

 IntDir  중개 파일(Intermediate file) 경로

 NoInherit  속성이 상속되지 않게 한다.

 OutDir  출력 폴더

 PlatformName  Win32 또는 .NET인 프로젝트 플랫폼의 이름

 ProjectDir  프로젝트 파일이 있는 폴더

 ProjectExt  프로젝트 확장자(.vcproj)

 ProjectFileName  프로젝트의 전체 이름

 ProjectName  프로젝트의 이름

 ProjectPath  프로젝트 파일의 전체 경로

 RemoteMachine  원격지 컴퓨터(원격 디버깅을 하는 경우)

 SolutionDir  솔루션 파일이 있는 폴더

 SolutionExt  솔루션 파일의 확장자(.sln)

 SolutionFileName  솔루션의 전체 이름

 SolutionName  솔루션의 이름

 SolutionPath  솔루션 파일의 전체 이름

 TargetDir  프로젝트의 Output 폴더

 TargetExt  출력 대상의 확장자

 TargetFileName  대상 파일명

 TargetName  대상의 이름

 TargetPath  대상의 전체 경로

 VCInstallDir  Visual C++ .NET 설치 폴더

 VSInstallDir  Visual Studio .NET 설치 폴더



빌드 이벤트

빌드 이벤트 폴더를 사용해서 빌드 프로세스 중에 어플리케이션과 스크립트를 실행할 수 있다.
대상 폴더를 여는 예 : Explore.exe $(TargetDir)



프로젝트 종속성 설정

프로젝트 종속성을 설정하면 두 가지가 보장됩니다.
첫째, 특정 프로젝트에서 필요로 하는 종속 파일을 항상 찾을 수 있도록 프로젝트들이 정확한 순서로 빌드됩니다.
둘째, 종속 프로젝트의 출력 디렉터리가 암시적으로 경로에 추가되어 링크 타임에 해당 파일을 쉽게 찾을 수 있습니다.
원문 : http://msdn.microsoft.com/ko-kr/library/ms235517.aspx



컴파일러 옵션

/RTCn : 런타임 에러 확인
최적화된 /O 빌드와 함께 사용되지 않는다.
/RTCs(스택오류), /RTCu(초기화되지 않은 변수 사용), /RTCc(작은 변수와 배열에 더 큰 데이터를 할당)

/GS : 버퍼 오버런 확인

/GL : 프로젝트에 대해 전체 프로그램의 최적화를 실시

/MP : 멀티 프로세서를 이용하여 빌드




:

Visual Studio에 Guideline 보이게하기

TIPs 2009. 1. 14. 22:45
[HKEY_CURRENT_USER]\Software\Microsoft\VisualStudio\8.0\Text Editor

Create a string value called
Guides
 
Set Guides to the following
RGB(x,y,z) n1,...,n13
Where x,y,z are the RGB values and n is the column number.  
You can have at most 13 guidelines.
 
For example,
Guides = RGB(128,0,0) 5, 80
will place a Red guideline at column numbers 5 and 80.

:

emacs 윈도즈(windows)에서 etags 사용하기

TIPs 2008. 9. 25. 07:19
dir "*.h" "*.c" "*.s" /s/b | etags -

윈도즈 CMD에도 파이프가 있는지 오늘 알았네... -_-;;
:

비스타에서 CapsLock을 Control로 사용하기

TIPs 2008. 9. 21. 03:42
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]

"Scancode Map"=hex:00,00,00,00,00,00,00,00,20,00,00,00,1d,00,3a,00,00,00,00,00
:

emacs-snapshot 설치

TIPs 2008. 9. 21. 03:03

Debian Lenny,sid  저장소
deb http://emacs.orebokech.com sid main
deb-src http://emacs.orebokech.com sid main

Debian Etch  저장소
deb http://emacs.orebokech.com etch main
deb-src http://emacs.orebokech.com etch main

key
wget http://orebokech.com/Romain_francoise.pgp -O- | apt-key add -
:

Linux Command

TIPs 2008. 9. 19. 04:29
mkdir

-p : 많약 부모 디렉토리가 존재하지 않는다면, 부모 디렉토리까지 같이 만들어 준다.


source

: shell 환경등을 파일로부터 읽고 실행
$ source .bash_profile


find

-iname 
: 이름에서 대소문자 구분하지 않음
$ find -iname *cookie*

-maxdepth n
: 최대 n depth 까지만 검색

-mindepth n
: 최소 n depth 이상만 검색

-size n
k (kilobytes), M (megabytes), G (gigabytes), T (terabytes), P (petabytes)
$ find / -size +100M (크기가 100M 이상인 파일 검색)

-mtime n
s (second), m (minute), h (hour), d (day), w (week)
$ find . -mtime +60 (변경된지 60일이 지난 파일 검색)

-path pattern
pathname이 패턴과 일치한다면 True이다.
$ find . -type f -not -path "*.svn*" (경로에 svn을 포함하지 않는 파일)

OPERATORS
( expression )
             This evaluates to true if the parenthesized expression evaluates to true.

! expression
-not expression
             This is the unary NOT operator.  It evaluates to true if the expression is false.

-false  Always false.
-true   Always true.

expression -and expression
expression expression
             The -and operator is the logical AND operator.  As it is implied by the juxtaposition of two expressions it does not have to be specified.  The expression evaluates to true if both expressions are true.  The second expression is not evaluated if the first expression is false.

expression -or expression
             The -or operator is the logical OR operator.  The expression evaluates to true if either the first or the second expression is true.  The second expression is not evaluated if the first expression is true.

$ find . -name "*.js" -and -not -name "dojo.js"
짧게 쓰면, 
$ find . -name "*.js" ! -name "dojo.js"


grep
-v, --invert-match 
: 매칭되지 않는 라인을 선택한다.

-m NUM, --max-count=NUM 
: 파일에서 NUM 매칭 라인을 읽은 후에 멈춘다. 
만약 -c or --count 옵션도 사용되었다면, NUM보다 많은 count를 출력하지 않는다.

-c, --count
: 매칭되는 라인의 count수를 출력한다.

-C NUM, -NUM, --context=NUM
: Print NUM lines of output context (매칭되는 라인 주변 NUM 라인을 같이 출력)

-w, --world-regxp
: 전체 단어를 매칭 시킨다.


dd

bs=BYTES

: read and write BYTES bytes at a time

ibs=BYTES
: read BYTES bytes at a time (defauilt : 512)

obs=BYTES
: write BYTES bytes at a time (default : 512)

count=BLOCKS
: copy only BLOCKS input blocks

# dd if=/dev/zero of=bigfile bs=1K count=1024


cut


-d, --delimiter=DELIM
: use DELIM instead of TAB for field delimiter

-f, --fields=LIST
: select only these fields; also print any line that contains no delimiter character, unless the -s option is specified

$ lspci | cut -d: -f1-3


:

잘 알려진 포트 번호

TIPs 2008. 9. 16. 15:18
원문 : http://ko.wikipedia.org/wiki/잘_알려진_포트

포트 설명 상태
0/udp 예약됨; 사용하지 않음 공식
1/tcp TCPMUX (TCP 포트 서비스 멀티플렉서) 공식
7/tcp ECHO 프로토콜 공식
7/udp ECHO 프로토콜 공식
9/tcp DISCARD 프로토콜 공식
9/udp DISCARD 프로토콜 공식
13/tcp DAYTIME 프로토콜 공식
13/udp DAYTIME 프로토콜 공식
17/tcp QOTD (Quote of the Day) 프로토콜 공식
19/tcp CHARGEN (Character Generator) 프로토콜 공식
19/udp CHARGEN 프로토콜 공식
20/tcp FTP (파일 전송 프로토콜) - 자료 포트 공식
21/tcp FTP - 제어 (명령) 포트 공식
22/tcp SSH (Secure Shell) - ssh scp, sftp같은 프로토콜 및 포트 포워딩 공식
23/tcp 텔넷 프로토콜 - 암호화되지 않은 텍스트 통신 공식
25/tcp SMTP (Simple Mail Transfer Protocol) - 이메일 전송에 사용 공식
37/tcp TIME 프로토콜 공식
37/udp TIME 프로토콜 공식
49/udp TACACS 프로토콜 공식
53/tcp DNS (Domain Name Server) 공식
53/udp DNS 공식
67/udp BOOTP (부트스트랩 프로토콜) 서버. DHCP로도 사용 공식
68/udp BOOTP (부트스트랩 프로토콜) 서버. DHCP로도 사용 공식
69/udp TFTP 공식
70/tcp 고퍼 프로토콜 공식
79/tcp Finger 프로토콜 공식
80/tcp HTTP (HyperText Transfer Protocol) - 웹 페이지 전송 공식
88/tcp 케르베로스 - 인증 에이전트 공식
109/tcp POP2 (Post Office Protocol version 2) - 전자우편 가져오기에 사용 공식
110/tcp POP3 (Post Office Protocol version 3) - 전자우편 가져오기에 사용 공식
113/tcp ident - 예전 서버 인증 시스템, 현재는 IRC 서버에서 사용자 인증에 사용 공식
119/tcp NNTP (Network News Transfer Protocol) - 뉴스 그룹 메시지 가져오기에 사용 공식
123/udp NTP (Network Time Protocol) - 시간 동기화 공식
139/tcp NetBIOS 공식
143/tcp IMAP4 (인터넷 메시지 접근 프로토콜 4) - 이메일 가져오기에 사용 공식
161/udp SNMP (Simple Network Management Protocol) 공식
179/tcp BGP (Border Gateway Protocol) 공식
194/tcp IRC (Internet Relay Chat) 공식
389/tcp LDAP (Lightweight Directory Access Protocol) 공식
443/tcp HTTPS - HTTP over SSL (암호화 전송) 공식
445/tcp Microsoft-DS (액티브 디렉터리, 윈도 공유, Sasser-worm, Agobot, Zobotworm) 공식
445/udp Microsoft-DS SMB 파일 공유 공식
465/tcp SSL 위의 SMTP - Cisco 프로토콜과 충돌 비공식, 충돌
514/udp syslog 프로토콜 - 시스템 로그 작성 공식
540/tcp UUCP (Unix-to-Unix Copy Protocol) 공식
542/tcp 상용 (Commerce Applications) (RFC maintained by: Randy Epstein [repstein at host.net]) 공식
542/udp 상용 (Commerce Applications) (RFC maintained by: Randy Epstein [repstein at host.net]) 공식
587/tcp email message submission (SMTP) (RFC 2476) 공식
591/tcp 파일메이커 6.0 Web Sharing (HTTP Alternate, see port 80) 공식
636/tcp SSL 위의 LDAP (암호화된 전송) 공식
666/tcp id 소프트웨어 멀티플레이어 게임 공식
873/tcp rsync 파일 동기화 프로토콜 공식
981/tcp SofaWare Technologies Checkpoint Firewall-1 소프트웨어 내장 방화벽의 원격 HTTPS 관리 비공식
993/tcp SSL 위의 IMAP4 (암호화 전송) 공식
995/tcp SSL 위의 POP3 (암호화 전송) 공식
:

Vista MBR 복구

TIPs 2008. 9. 16. 03:59
Vista CD로 부팅 > 복구 모드 > Command 입력
bootrec /FixMbr
: