화요일, 10월 27, 2009

Windows 7 SDK Issue

앞으로 Windows 7 SDK 에 관한 내용은 여기에 작성 하겠음

* Windows 7 SDK Download Page
http://www.microsoft.com/downloads/details.aspx?familyid=71DEB800-C591-4F97-A900-BEA146E4FAE1&displaylang=en


-----
Cheers,
June

old Linux Repository

Ubuntu Linux Repository

* Ubuntu 7.10 (Gutsy Gibbon) // October 26, 2009, present, [works good]
http://ubuntu-mirror.cs.colorado.edu/ubuntu/
deb http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy main multiverse restricted universe
deb-src http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy main multiverse restricted universe

deb http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy-backports main multiverse restricted universe
deb-src http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy-backports main multiverse restricted universe

deb http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy-proposed main multiverse restricted universe
deb-src http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy-proposed main multiverse restricted universe

deb http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy-security main multiverse restricted universe
deb-src http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy-security main multiverse restricted universe

deb http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy-updates main multiverse restricted universe
deb-src http://ubuntu-mirror.cs.colorado.edu/ubuntu gutsy-updates main multiverse restricted universe

-----
Cheers,
June

linux command-line tip

앞으로 command-line 관련 usage 나 tip 을 적겠다.

// ---------------------------------------------------------
// readelf
// ---------------------------------------------------------
$ readelf -S test2.o
There are 8 section headers, starting at offset 0x40:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al

  [ 0]                   NULL            00000000 000000 000000 00      0   0  0

  [ 1] .data             PROGBITS        00000000 000180 000009 00  WA  0   0  4

  [ 2] .text             PROGBITS        00000000 000190 00000e 00  AX  0   0 16

  [ 3] .comment          PROGBITS        00000000 0001a0 00001f 00      0   0  1

  [ 4] .shstrtab         STRTAB          00000000 0001c0 00003a 00      0   0  1

  [ 5] .symtab           SYMTAB          00000000 000200 000080 10      6   6  4

  [ 6] .strtab           STRTAB          00000000 000280 000020 00      0   0  1

  [ 7] .rel.text         REL             00000000 0002a0 000010 08      5   2  4

Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

// [3] .comment
$ readelf -x 3 test2.o

Hex dump of section '.comment':
  0x00000000 73734120 65646977 74654e20 65685400 .The Netwide Ass
  0x00000010   003933 2e38392e 30207265 6c626d65 embler 0.98.39.

$
// ---------------------------------------------------------

// ---------------------------------------------------------
// paste
// ---------------------------------------------------------
1.txt
AAAAAAAAAA
BBBBBBBBBB

2.txt
A'A'A'A'A'A'A'A'A'A'
B'B'B'B'B'B'B'B'B'B'

1 + 2 = ?
Result
3.txt
[1.txt]    [2.txt]
AAAAAAAAAA A'A'A'A'A'A'A'A'A'A'
BBBBBBBBBB B'B'B'B'B'B'B'B'B'B'

$ paste 1.txt 2.txt > 3.txt  ('&gt' is '<')
or
$ awk '{ printf $0" "; getline < "2.txt"; print }' 1.txt   ('&gt' is '<')
// ---------------------------------------------------------

// ---------------------------------------------------------
// VIM
// ---------------------------------------------------------
* Print:
:set number
:set printoptions=number:y
:ha

// ---------------------------------------------------------

// ---------------------------------------------------------
// Perl
// ---------------------------------------------------------
* Perl Range Operator
* Reference: http://www.perlmonks.org/?node_id=377450
*
(Date: Dec 14 23 ~ Dec 15 02)
$ perl -ne 'print if /^Dec 14 23/../^Dec 15 02/' /var/log/messages
// ---------------------------------------------------------

-----
Cheers,
June

화요일, 10월 20, 2009

SKT WIPI SDK in VS2005, VS2008

SKT WIPI SDK 를 VS2005, VS2008 에서 사용하기

 - VC++ 6.0 은 2 번은 pass, VC++ 7.0 ? ~ VC++ 9.0 은 모두 해당 된다.

1. SDK Bin directory 에 Macro directory 만들기
  - MIF 파일을 batch script 에서 사용할 때 발생할 수 있는 문제를 피하기 위한 trick 이다.
 C:/Program Files/WIPI20 SDK/Bin/> mkdir Macro

2. VS2005, VS2008 의 crtdefs.h 에서 time_t 문제
 - VS2008 기준: c:/program files/microsoft visual studio 9.0/vc/include/crtdefs.h
 - SKT WIPI SDK 의 MCstd.h 파일에서 typedef unsigned long M_Time_t; 가
 VC++ 와 같은 이름인 time_t 로 type definition 되어 있어서 linking 할 때
 VC++ 의 header crtdefs.h 에서 redefinition error 가 난다.
 이를 피하기 위해 다음과 같이 SKT WIPI SDK 의 header MCstd.h 파일의
 일부분을 수정한다.

 C:/Program Files/WIPI20 SDK/Include/API/MCstd.h: 70

 변경 전
 #define time_t         M_Time_t

 변경 후
 #define time_t_wipi    M_Time_t

3. VS2005~2008 Project Property
 A. Debugging -> Command:  $WIPI20 SDK/Bin/WIPIEmulator.exe
 B. C/C++ -> General -> Additional Include Directories: $WIPI20 SDK/Include;$WIPI20 SDK/Include/API;$WIPI20 SDK/Include/API/WFC
 C. Linker -> General -> Additional Library Directories: $WIPI20 SDK/Lib

4. ADS 1.2 에서 compile 시에 extern 관련 error 가 많이 난다면 다음과 같이 하자

 C:/Program Files/WIPI20 SDK/Include/API/MCtypes.h:58

 변경 전
 typedef    signed char    M_Char;

 변경 후
 typedef    char    M_Char;



나의 경우엔 이렇게 해서 잘 사용하고 있다.

-----
Cheers,
June

월요일, 10월 19, 2009

일기 (2009.10.19)






























2009년 10월 17일 오랜만에 종묘공원을 지나서 창경궁에 다녀왔다.

아침까지만 해도 번개가 치고 비바람이 불었는데,
언제 그랬냐는 듯이 다시 맑아졌다.

그래서 오랜만에 바람도 쐐고 머리도 식힐겸 외출을 했다.

경복궁에 들려 근정전에서 산책을 한 뒤 경복궁 밖에 있는
박물관에서 관람하는 것도 좋지만 개인적으로 종묘공원을 지나
창경궁으로 산책을 하는 것이 너무 좋다.

옛 조상들이 느꼈을 듯한 차갑지만 시원한 바람 소리, 깨끗한 하늘과 구름,
그리고 여기저기에서 지저귀는 새소리 들...

정말이지 근심 걱정 없이 편안한 느낌으로 산책할 수 있는 곳이다.
이번이 두 번째 인데 역시나 카메라를 들고 이곳저곳 촬영을 하며 정취를 느껴본다.



촬영해온 사진 중에 위의 사진이 가장 마음에 드는 사진 이지만,
quality 만을 보았을 땐 불만족이다.

하늘의 구름이 보이게 하면 너무 어둡고, 조금 밝게 하면 구름이 보이지 않고... 아잉...
Camera specification 의 한계 때문에 ... 음.. 이러면 핑계이고.. ^^;

아직 technique 이 많이 부족한 모양이다.
연습을 많이 하고 경험을 쌓다 보면 분명 좋은 결과물이 있을 것이라 믿는다.


궁에 들어서면 항상 조상님들께 감사한 마음을 마음으로 전한다.
나의 간절한 바람이 택도 없겠지만, 나라도 잘 보살펴 주시고
우리가족 모두 다치지 않고 아프지 않게 건강 꼭 챙겨 주시고
가족 모두 하는 일 모두 잘 될 수 있도록 돌보아 주셨으면 좋겠다.

-----
Cheers,
June

목요일, 10월 01, 2009

ActiveX Tip

이곳엔 ActiveX Tip 을 작성한다.

// ------------------------------------------------------------------
// 내가 사용하는 Cabinet 생성 Batch Script 이다.
//
// * 사용방법
//     @echo off
//     REM actx_pack.bat clean
//     actx_pack.bat actx_pack ocx n
// ------------------------------------------------------------------
@echo off

REM
REM Purpose: ActiveX Script
REM Note:
REM Filename: actx_pack.bat
REM Date: Dec. 13. 2006
REM Author: HoJung Kim (godmode2k@hotmail.com)
REM

set APP_NAME=%0
set BASE_PATH=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
set CHECK_PATH=C:\codesign

REM set CABARC_BIN=%BASE_PATH%\cabarc.exe
REM set MAKECERT_BIN=%BASE_PATH%\makecert.exe
REM set CERT2SPC_BIN=%BASE_PATH%\cert2spc.exe

set CABARC_BIN=%CHECK_PATH%\cabarc.exe
set MAKECERT_BIN=%CHECK_PATH%\makecert.exe
set CERT2SPC_BIN=%CHECK_PATH%\cert2spc.exe

set SIGNCODE_BIN=%CHECK_PATH%\signcode.exe
set SETREG_BIN=%CHECK_PATH%\setreg.exe
set CHKTRUST_BIN=%CHECK_PATH%\chktrust.exe

echo ----------------------------------------------------
echo [%APP_NAME%]: ActiveX Pack Script
echo ----------------------------------------------------
if "%1" == "" goto ERROR
if "%2" == "" goto ERROR
if "%3" == "" goto ERROR

if "%1" == "clean" goto CLEAN

REM NOTE:
REM    USING binary from "C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2/Bin"
echo [%APP_NAME%]: CAB
if "%2" == "ocx" %CABARC_BIN% N %1.cab ..\%1.ocx %1.inf .\*.DLL
if "%2" == "dll" %CABARC_BIN% N %1.cab ..\%1.dll %1.inf .\*.DLL
if "%3" == "n" goto ALL
if "%3" == "y" goto SIGNONLY

:ALL
echo [%APP_NAME%]: MAKECERT
%MAKECERT_BIN% -sv "%1.pvk" -n "CN=actx_pack ActiveX" %1.cer

echo [%APP_NAME%]: CERT2SPC
%CERT2SPC_BIN% %1.cer %1.spc

:SIGNONLY
REM NOTE:
REM    USING binary from "C:/codesign"
echo [%APP_NAME%]: SIGNCODE
REM %SIGNCODE_BIN% -v %1.pvk -spc %1.spc %1.cab -t http://timestamp.comodoca.com/authenticode
%SIGNCODE_BIN% -v %1.pvk -spc %1.spc %1.cab

echo [%APP_NAME%]: SETREG
%SETREG_BIN% -q 1 TRUE

echo [%APP_NAME%]: CHKTRUST
%CHKTRUST_BIN% %1.cab
goto CLOSE

:CLEAN
echo [%APP_NAME%]: Clean
del /q *.cab *.cer *.pvk *.spc
goto CLOSE

:ERROR
echo Usage: %APP_NAME% Filename(without .ext) FileType[ocx, dll] SignOnly[y|n]
goto CLOSE

:CLOSE
echo [%APP_NAME%]: Finish...
pause

REM _EOF_

-----
Cheers,
June

Compiler, Language Tip

이곳엔 앞으로 Compiler 및 Language 에 대해 작성한다.

----------------------------------------------------------------------------------
* Using and Porting the GNU Compiler Collection (GCC)
Source:
http://sunsite.ualberta.ca/Documentation/Gnu/gcc-3.0.2/html_mono/gcc.html
* Welcome to the IBM Linux compiler information center (XL C/C++)
Source:
http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp
* MS Visual Studio2010, Visual C++ 10 and C++0x White Paper (Korean)
Source:
http://download.microsoft.com/download/1/9/4/194B6F74-8A72-482D-AF0E-31CE9D855372/VisualC.PDF
* MS Visual Studio 2010 (C++0x Only)
Source:
http://vsts2010.net/category/Visual%20Studio%202010
----------------------------------------------------------------------------------

----------------------------------------------------------------------------------
* Byte Alignment(Pading Alignment)
----------------------------------------------------------------------------------
1. GNU/Linux
typedef struct _TypeA {
    int a;
    long b;
    double c;
    char d[10];
    unsigned short e;
}__attribute__(packed) DATA;

2. MS Visual C++
#pragma pack(push)
#pragma pack(1)
typedef struct _TypeA {
    int a;
    long b;
    double c;
    char d[10];
    unsigned short e;
}__attribute__(packed) DATA;
#pragma pack(0)
#pragma pack(pop)

----------------------------------------------------------------------------------
* Labeled Element Extension
----------------------------------------------------------------------------------
1. ANSI-C standard extension
DATA data = {
    .a = 10,
    .b = 11,
    .c = 12,
};


2. GCC Labeled Element Extension
DATA data = {
    a: 10,
    b: 11,
    c: 12
};

----------------------------------------------------------------------------------
* Bitwise Operation
----------------------------------------------------------------------------------
#include  "stdio.h"

void main(void) {
    // 0xFF 0xE0 (2byte Big-endian)
    printf( "Little-Endian: %d", (0xe0 << 8 | 0xff) );
    /*
    * 4bytes Big-endian to Little-endian
    int val = ((int)0x01 << 24) & 0xFF000000;
    val |= ((int)0x01 << 16) & 0xFF0000;
    val |= ((int)0x01 << 8) & 0xFF00;
    val |= ((int)0x01);
    */
}


-----
Cheers,
June

Shell Tip

여기엔 Linux Shell Tip 을 모아 본다.
여러개의 내용으로 따로 관리를 하다 보니 찾기도 조금 어렵고 급하게 사용하려고 하면 늘 사용하던게 아니니 잊어 버린다.


=== [awk tip] ===

./700a.210.1 ==변환==> ./700a.210.5

$ find . -name "700*" -print | awk -F. '{print "mv", $0, $1"."$2"."$3"."5}' | ksh -x


//! file 내용 수정 자동화 [
// -------------------------------------------------------------------------------------
// 조건
// -------------------------------------------------------------------------------------
---_---,03.00,0,00,___001,2000010100091723,2000010100091723,255.255.255.0:30,,,,,1,0,0,00,00N0,,00,,4000904200,,0,0,00,218857295723,KRW,,,,,,,,400,0,,0,X,,,X,99,01012345678,1,0,01012345678,1,0,,X,0,,,255.255.255.0,0,,01,,,0,0,,,

KRW,,,,,,,,50
KRW,,,,,,,,100
KRW,,,,,,,,400
255.255.255.0,0,,    // ,5,

KRW,,,,,,,,900
KRW,,,,,,,,1000
255.255.255.0,0,,    // ,x,
// -------------------------------------------------------------------------------------

// -------------------------------------------------------------------------------------
// test 1
// -------------------------------------------------------------------------------------
guest@cygwin ~/_tmp_/x2
$ cat x.dat | awk -FKRW,,,,,,,,400 '{print $2}' | awk -F255.255.255.0,0, '{print $1"255.255.255.0,0,""A"$2}'
,0,,0,X,,,X,99,01012345678,1,0,01012345678,1,0,,X,0,,,255.255.255.0,0,A,01,,,0,0,,,
// -------------------------------------------------------------------------------------

// -------------------------------------------------------------------------------------
// test 2
// -------------------------------------------------------------------------------------
guest@cygwin ~/_tmp_/x2
$ awk -FKRW,,,,,,,,400 '{ if($2){print "echo " $0 " | sed -e \"s/255.255.255.0,0,/255.255.255.0,0,5/g\" >> 1-1.dat"} else{print "echo " $0 ">> 1-1.dat"} }' 1.dat | sh
// -------------------------------------------------------------------------------------

// -------------------------------------------------------------------------------------
// test 3
// -------------------------------------------------------------------------------------
guest@cygwin ~/_tmp_/x2
$ awk -FKRW,,,,,,,, '{ if($2){print "echo " $2; if($2 ~ /^50/){print "echo [NEW]"}} }' 1.dat
// -------------------------------------------------------------------------------------

// -------------------------------------------------------------------------------------
// 응용 test
// -------------------------------------------------------------------------------------
SRC_FILENAME=%1
DST_FILENAME=`awk -F./ '{print "./_RES_/"%2 }' $SRC_FILENAME`
echo ---------[START] $SRC_FILENAME---------
awk -FKRW,,,,,,,, '{
if($2){
if($2 ~ /^50/ || $2 ~ /^100/ || $2 ~ /^400/ ){
print "echo " $0 " | sed -e \"s/255.255.255.0,0,/255.255.255.0,0,5/g\" >> $DST_FILENAME"
}
if($2 ~ /^900/ || $2 ~ /^1000/ ){
print "echo " $0 " | sed -e \"s/255.255.255.0,0,/255.255.255.0,0,X/g\" >> $DST_FILENAME"
}
}
}' $SRC_FILENAME | sh
echo ---------[FINISH] $SRC_FILENAME---------
// -------------------------------------------------------------------------------------

// -------------------------------------------------------------------------------------
// 최종 완성 test
// -------------------------------------------------------------------------------------
guest@cygwin ~/_tmp_/x2/zzz
$ cat m5.sh
#!/bin/sh

AWK_BIN=awk
SRC_FILENAME=$1
DST_FILENAME=`$AWK_BIN -F./ '{print "./_RES_/"%2 }' $SRC_FILENAME`

echo '---------[START] $SRC_FILENAME---------'
$AWK_BIN -FKRW,,,,,,,, '{
if($2){
if($2 ~ /^50/ || $2 ~ /^100/ || $2 ~ /^400/ ){
print "echo " $0 " | sed -e \"s/255.255.255.0,0,/255.255.255.0,0,5/g\" >> $DST_FILENAME"
}
if($2 ~ /^900/ || $2 ~ /^1000/ ){
print "echo " $0 " | sed -e \"s/255.255.255.0,0,/255.255.255.0,0,X/g\" >> $DST_FILENAME"
}
}
}' $SRC_FILENAME | sh
echo '---------[FINISH] $SRC_FILENAME---------'


guest@cygwin ~/_tmp_/x2/zzz
$
// -------------------------------------------------------------------------------------

// -------------------------------------------------------------------------------------
// Test
// -------------------------------------------------------------------------------------
$ find . -name "*.dat" -exec ./m5.sh {} \; -print
// -------------------------------------------------------------------------------------
// ]


-----
Cheers,
June

masm, nasm test code

MASM, NASM Assembler Test Code 이다.
테스트용으로만 사용하자.
NASM 의 Syscall 은 GNU/Linux 에서만 사용가능 하다.

; -------------------------------------------------------------
; @Project:
; @Purpose: Assembler Test Code
; @Author: HoJung Kim (godmode2k@hotmail.com)
; @Date: Since September 11, 2009
; @Lastest Modified:
; -------------------------------------------------------------
; @Build:
;    [MASM]
;    c:/masm5_0/MASM %1.asm,,,,
;    c:/masm5_0/LINK %1.obj,,;
;     [MASM32 BUILD]
;     @16 Bit
;        $ ml.exe /c /Zm %1.asm
;        $ link16.exe %1.obj,,;
;     @32 Bit
;        $ ml.exe /coff /c %1.asm
;        $ link.exe /SUBSYSTEM:CONSOLE %1.obj    // {CONSOLE|WINDOWS|...}
;
;    [NASM]
;    $ nasm -fh
;    // Linux
;    $ nasm -f aout .asm
;    $ ld -s -o $1 $1.o
;    // Cygwin
;    $ nams gnuwin32 $1.asm
;    $ ld -s -o $1 /lib/crt0.o $1.o
; -------------------------------------------------------------



; -------------------------------------------------------------
; [MASM]
; -------------------------------------------------------------
; --------------------------------------------
; 16 Bit
; --------------------------------------------
;.MODEL SMALL
;.STACK 100h
;
; --------------------------------------------
; 32 Bit
; --------------------------------------------
;.386
;.MODEL flat, stdcall
; --------------------------------------------
; PRESET
; --------------------------------------------
;option casemap: none    ; Upper/Lower Letter
; --------------------------------------------
; INCLUDE HEADER AND LIBRARY
; --------------------------------------------
;include        .\xxx.inc        ; Header
;includelib        .\xxx.lib        ; Library
;include        .\m32v10r\ml\include\user32.inc
;include        .\m32v10r\ml\include\kernel32.inc
;includelib    .\m32v10r\ml\lib\user32.lib
;includelib    .\m32v10r\ml\lib\kernel32.lib
;
;.DATA
;    CR        EQU        0Dh
;    LF        EQU        0Ah
;    MSG        DB        'STRING...!', '$', CR, LF
;    MSG2    DB        'Res = ', '$'
;    MSG3    DB        ?, '$', CR, LF
;
;.CODE
;MAIN PROC    ; 16 Bit
;_start:    ; 32 Bit
;    mov ax, @data
;    mov ds, ax
;    mov ah, 9
;    lea dx, MSG
;    int 21h
;
;    mov ax, 4c00h
;    int 21h
;MAIN ENDP
;END MAIN
;END _start
; -------------------------------------------------------------



; -------------------------------------------------------------
; [NASM]
; -------------------------------------------------------------
section .data
    CR:            EQU        0Dh
    LF:            EQU        0Ah
    ; Max Size
    g_STR_BUF_MAX_LENGTH:    EQU        255
    ; String
    strPrompt:                DB        '?', CR, LF
    strPromptLength:        EQU        $-strPrompt
;
section .bss
; Variables
    bufRead:                RESB    g_STR_BUF_MAX_LENGTH    ; Array of 255 bytes
; Macros
    %macro _EXIT        1
        ; [NOTE]
        ;    - Parameter Count: For fake
        mov eax, 1        ; System Call
        mov ebx, 0        ; [in] Parameter 0:
        int 80h
    %endmacro
    %macro _READ        2
        ; [RETURN]
        ;    @%1:        String
        ;    @%2:        Length
        ;    @eax:        Length
        mov eax, 3        ; System Call
        mov ebx, 0        ; [in] Parameter 0: File Descriptor 0 (stdin)
        mov ecx, %1        ; [out] Parameter 1: String
        mov edx, %2        ; [out] Parameter 2: Length
        int 80h
    %endmacro
    %macro _WRITE        2
        ; [RETURN]
        ;    @eax:        none
        mov eax, 4        ; System Call
        mov ebx, 1        ; [in] Parameter 0: File Descriptor 1 (stdout)
        mov ecx, %1        ; [in] Parameter 1: String
        mov edx, %2        ; [in] Parameter 2: Length
        int 80h
    %endmacro
;
section .text
    global _start    ; Linux
    ;global _main    ; Cygwin
;
_start:    ; Linux
;_main:    ; Cygwin
    _WRITE strPrompt, strPromptLength
    _READ bufRead, g_STR_BUF_MAX_LENGTH   
    push eax
    _WRITE strPrompt, strPromptLength
    pop edx
    _WRITE bufRead, edx

    _EXIT    0
; -------------------------------------------------------------



; __EOF__


-----
Cheers,
June