월요일, 7월 12, 2010

[Android] Android builds app(apk) without Eclipse then keystore (Key Sign) & Verify & Deploy

Android builds app(apk) without Eclipse then keystore (Key Sign) & Verify & Deploy


#
# i'm installed JDK, Android SDK, ANT already.
#

# NOTE:
# e.g., base directory: C:/testApp1/
# Your libraries (*.jar) are may need to copy into C:/testApp1/libs/

# STEP1: builds without Eclipse
C:/testApp1> android update project --path C:/testApp1
...
SEE build.xml
...
c:/testApp1> ant
... usage ...
c:/testApp1> ant compile
...
c:/testApp1> ant release
...
SEE testApp1-unsigned.apk into c:/testApp1/bin>
...

# STEP2: Keystore (Key Sign) & Verify




// JDK: keytool, jarsigner

c:/testApp1> keytool -genkey -v -keystore testApp1.keystore -alias testApp1 -keyalg RSA -validity 10000
...
c:/testApp1> jarsigner -verbose -keystore testApp1.keystore bin/testApp1-unsigned.apk testApp1
...
c:/testApp1> jarsigner -verify -verbose bin/testApp1-unsigned.apk
...

# SETP3: Deploy to device
c:/testApp1> adb -d install testApp1-unsigned.apk
...

That's it!



****
Note:

1. keytool Country Code (kr)
 - What is the two-letter country code for this unit?

C:/testApp1> keytool -genkey -v -keystore testApp1.keystore -alias testApp1 -keyalg RSA -validity 10000
...
이 조직의 두 자리 국가 코드를 입력하십시오.
  [Unknown]:  kr
CN=a, OU=a, O=a, L=a, ST=a, C=kr이(가) 맞습니까?
  [아니오]:  y

다음에 대해 유효 기간이 10,000일인 1,024비트 RSA 키 쌍 및 자체 서명된 인증서(SHA1withRSA) 생성 중
        : CN=a, OU=a, O=a, L=a, ST=a, C=kr
에 대한 키 암호를 입력하십시오.
        (keystore 암호와 같은 경우 Enter를 누르십시오):
[testApp1.keystore 저장 중]
C:/testApp1>

2. Files
:: build.properties
# This file is used to override default values used by the Ant build system.
#
# This file must be checked in Version Control Systems, as it is
# integral to the build system of your project.

# The name of your application package as defined in the manifest.
# Used by the 'uninstall' rule.
application-package=com.test.testApp1
sdk-location=C:/android/android-sdk-windows/platforms/android-7

# hjkim
# KeyStore/Alias
key.store=testApp1.keystore
key.alias=testApp1
key.store.password=MyPassword
key.alias.password=MyPassword

# The name of the source folder.
#source-folder=src

# The name of the output folder.
#out-folder=bin


:: local.properties
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked in Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=C:\\android\\android-sdk-window

*** Checks you using SDK Version for deploy
:: default.properties
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.

# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-7



-----
Cheers,
June

토요일, 7월 10, 2010

삼겹 김치 두부 말이~~

삼겹 김치 두부 말이~~
Source: http://blog.daum.net/bono-bono/17039254


<재료>
삼겹 9장(얇게 썰은것으로 준비하세요)
묵은지 넓은것으로 3장 (익은김치도 좋아요)
두부 반모


두부도 함께 올려서 감아줍니다.
두부는 김치,돼지고기와 너무 잘 어울리잖아요...
제가 두부를 넣는 이유는 삼겹살은 얇고 김장김치의 경우 조금 짭니다...
그렇게 되면 요리하고 난뒤...짤수가 있거등요...
두부를 넣어 조절하면 간이 딱이랍니다...^^




한입에 넣기 먹기 딱 좋은 사이즈로 썰어줍니다.
이걸 응용해서....향긋한 깻잎을 함께 넣어도 좋고!!
김치대신...홈그레인 머스터드를 발라서 감아줘도 좋답니다.


처음엔 쎈불에서 굴려가며 겉면을 익힌다음... 약불에서~~~
그래야 육즙이 덜빠져 나오고....속까지 다 익을거 같아요...




-----
꼭 한 번 이렇게 먹어 볼테닷!!!

Cheers,
June

화요일, 6월 29, 2010

[Android] Android porting

Android porting

Source: http://www.aesop.or.kr/?document_srl=46778
---------------------------------------

계속 삼성 bsp에 의존하다가

몇년만에 직접 포팅하려고 하니.. 옛생각도 나면서..  (집나가면 개고생이라는... CF문구가 생각나네요)

주말에 Aesop에서 Android를 공개한다고 하니.. 기다려 보렵니다.

공개전에 한번 해보고 싶었는데...  인내하고 기다려야 겠네요.. ^^

작업했던 내용 간단하게 적어보겠습니다.

1. kernel
    kandroid의 소스를 다운 받았습니다.
   git clone git://www.kandroid.org/samsung-s3c6410-android.1.0

2. config 파일은  다음 파일을 기본으로 사용했습니다.
   samsung-s3c6410-android.1.0/arch/arm/configs/smdk6410mtd_android.081213
  
3. 컴파일러
   aesop에서 제공한 gcc 4.2.4 와
   삼성에서 제공한 gcc 4.2.2 아무거나 사용해도 됩니다.
   단 삼성에서 제공한 gcc 4.3.1은 link에서 error가 발생되더군요..

4. root file system
    이거 고생좀 했습니다. 어느 업체에서 얻어논 file system을 사용했다가...

    고현철님께서 알려주신곳에서 참고해서 만들었습니다.

    4.1 http://benno.id.au/blog/2007/11/14/android-busybox            android용으로 컴파일된 busybox를 다운 받습니다.
          (처음에.. pull 로 파일을 다 받아야 하나 생각했었는데... 역시 잔머리가..)

    4.2 emulator  (저는 Windows PC에서 작업했습니다.)
           working location  "android-sdk-windows-1.0_r2\tools"

          4.2.1 sd card image 생성  ( emulator의 파일 시스템이 read only가 많아서.. 이렇게 했습니다.)
                    #makesdcard 128M sd.img

          4.2.2 emulator 실행 (dos 창 1)
                   #emulator --sdcard sd.img
                   menu --> Dev Tools --> Media Scanner  ( sd.img 인식)

          4.2.3 adb  (dos 창 2)
                    #adb push busybox  /sdcard   (sd.img에 4.1에서 받은 busybox를 push)
                    #adb shell   <-- 접속)

                    #chmod  777 /sdcard/busybox
                    #/sdcard/busybox tar -cf /sdcard/system.tar /system               
                    #/sdcard/busybox tar -cf /sdcard/data.tar /data
                    #/sdcard/busybox tar -cf /sdcard/dev.tar /dev
                    # exit

     4.3 sd.img,  ramdisk.img  가져오기
              "android-sdk-windows-1.0_r2\tools\sd.img"
              "android-sdk-windows-1.0_r2\tools\lib\ramdisk.img"

      4.4 ramdisk 통합하기
             위에서 생성된 모든 파일을 linux PC에서 작업
             ramdisk.img ,  sd.img

            #mkdir sd
            #mount -o loop sd.img sd

            #mkdir root_disk
            # gzip -cd ramdisk.img > ramdisk
            # cp ramdisk root_disk
            # cpio -iv -F ramdksk
            # rm ramdisk
            # cd ..

            # tar xvf sd\system.tar -C root_disk
            # tar xvf sd\data.tar  -C root_disk
            # tar xvf sd\dev.tar  -C root_disk

      4.5 init.rc 수정 (최종환님께서 얄려주셨습니다.)
            loglevel 3  -->   loglevel 6

            아래사항 주석처리
            #mount yaffs2 mtd@system /system
            #mount yaffs2 mtd@system /system ro remount
            #mount yaffs2 mtd@userdata /data nosuid nodev

            #mount yaffs2 mtd@cache /cache nosuid nodev
          
여기 까지...
혹시 빠진 부분이 있으면 지적해 주세요.. 

---------------------------------------


-----
Cheers,
June

emacs org-mode

emacs org-mode

Source:

http://orgmode.org/
http://jmjeong.com/index.php?display=Emacs/OrgMode

-----
Cheers,
June

A Cross-Platform Memory Leak Detector

Source: http://wyw.dcweb.cn/leakage.htm



A Cross-Platform Memory Leak Detector

Memory leakage has been a permanent annoyance for C/C++ programmers. Under MSVC, one useful feature of MFC is report memory leaks at the exit of an application (to the debugger output window, which can be displayed by the integration environment or a debugger). Under GCC, current available tools like mpatrol are relatively difficult to use, or have a big impact on memory/performance. This article details the implementation of an easy-to-use, cross-platform C++ memory leak detector (which I call debug_new), and discusses the related technical issues.

Basic usage

Let’s look at the following simple program test.cpp:

int main()
{
    int* p1 = new int;
    char* p2 = new char[10];
    return 0;
}
Our basic objectives are, of course, report two memory leaks. It is very simple: just compile and link debug_new.cpp. For example:

cl -GX test.cpp debug_new.cpp(MSVC)
g++ test.cpp debug_new.cpp -o test(GCC)
The running output is like follows:

Leaked object at 00341008 (size 4, )
Leaked object at 00341CA0 (size 10, )
If we need clearer reports, it is also trivial: just put this at the front of test.cpp:

#include "debug_new.h"
The output after adding this line is:

Leaked object at 00340FB8 (size 10, test5.cpp:5)
Leaked object at 00340F80 (size 4, test5.cpp:4)
Very simple, isn’t it?

Background knowledge

In a new/delete operation, C++ compilers generates calls to operator new and operator delete (allocation and deallocation functions) for the user. The prototypes of operator new and operator delete are as follows:

void* operator new(size_t) throw(std::bad_alloc);
void* operator new[](size_t) throw(std::bad_alloc);
void operator delete(void*) throw();
void operator delete[](void*) throw();
For new int, the compiler will generate a call to “operator new(sizeof(int))”, and for new char[10], “operator new(sizeof(char) * 10)”. Similarly, for delete ptr and delete[] ptr, the compiler will generate calls to “operator delete(ptr)” and “operator delete[](ptr)”. When the user does not define these operators, the compiler will provide their definitions automatically; when the user do define them, they will override the ones the compiler provides. And we thus get the ability to trace and control dynamic memory allocation.
In the meanwhile, we can adjust the behaviour of new operators with new-placements, which are to supply additional arguments to the allocation functions. E.g., when we have a prototype

void* operator new(size_t size, const char* file, int line);
we may use new ("hello", 123) int to generate a call to “operator new(sizeof(int), "hello", 123)”. This can be very flexible. One placement allocation function that the C++ standard ([C++1998]) requires is

void* operator new(size_t size, const std::nothrow_t&) throw();
in which nothrow_t is usually an empty structure (defined as “struct nothrow_t {};”), whose sole purpose is to provide a type that the compiler can identify for overload resolution. Users can call it via new (std::nothrow) type (nothrow is a constant of type nothrow_t). The difference from the standard new is that when memory allocation fails, new will throw an exception, butnew(std::nothrow) will return a null pointer.
One thing to notice is that there is not a corresponding syntax like delete(std::nothrow) ptr. However, a related issue will be mentioned later in this article.
For more information about the above-mentioned C++ language features, please refer to [Stroustrup1997], esp. sections 6.2.6, 10.4.11, 15.6, 19.4.5, and B.3.4. These features are key to understanding the implementation described below.

Principle and basic implementation

Similar to some other memory leakage detectors, debug_new overrides operator new, and provides macros to do substitues in user’s programs. The relevant part in debug_new.h is as follows:

void* operator new(size_t size, const char* file, int line);
void* operator new[](size_t size, const char* file, int line);
#define DEBUG_NEW new(__FILE__, __LINE__)
#define new DEBUG_NEW
Let’s look at the test.cpp after including debug_new.hnew char[10] will become “new("test.cpp", 4) char[10]” after preprocessing, and the compiler will generate a call to “operator new[](sizeof(char) * 10, "test.cpp", 4)” accordingly. If I define “operator new(size_t, const char*, int)” and “operator delete(void*)” (as well as “operator new[]...” and “operator delete[]...”; for clarity, my discussions about operator new and operator delete also cover operator new[] and operator delete[] without mentioning specifically, unless noted otherwise) indebug_new.cpp, I can trace all dynamic memory allocation/deallocation calls, and check for unmatched news and deletes. The implementation may be as simple as using just a map: add a pointer to map in new, and delete the pointer and related information in delete; report wrong deleting if the pointer to delete does not exist in the map; report memory leaks if there are still pointers to delete in the map at program exit.
However, it will not work if debug_new.h is not included. And the case that some translation units include debug_new.h and some do not are unacceptable, for although two operator news are used — “operator new(size_t, const char*, int)” and “operator new(size_t)” — there is only one operator delete! The operator delete we define will consider it an invalid pointer, when given a pointer returned by “operator delete(void*)” (no information about it exists in the map). We are facing a dilemma: either to misreport in this case, or not to report when deleting a pointer twice: none is satisfactory behaviour.
So defining the global “operator new(size_t)” is inevitable. In debug_new.h, I have

void* operator new(size_t size)
{
    return operator new(size, "", 0);
}
Implement the memory leak detector as I have described, you will find it works under some environments (say, GCC 2.95.3 w/ SGI STL), but crashes under others (MSVC 6 is among them). The reason is not complicated: memory pools are used in SGI STL, and only large chunks of memory will be allocated by operator new; in STL implementations which do not utilize such mechanisms, adding data to map will cause a call to operator new, which will add data to map, and this dead loop will immediately cause a stack overflow that aborts the application. Therefore I have to stop using the convenient STL container and resort to my own data structure:

struct new_ptr_list_t
{
    new_ptr_list_t*     next;
    const char*         file;
    int                 line;
    size_t              size;
};
Every time one allocates memory via newsizeof(new_ptr_list_t) more bytes will be allocated when calling malloc. The memory blocks will be chained together as a linked list (via the nextfield), the file name, line number, and object size will be stored in the fileline, and size fields, and return (pointer-returned-by-malloc + sizeof(new_ptr_list_t)). When one deletes a pointer, it will be matched with those in the linked list. If it does match — pointer-to-delete == (char*)pointer-in-linked-list + sizeof(new_ptr_list_t) — the linked list will be adjusted and the memory deallocated. If no match is found, a message of deleting an invalid pointer will be printed and the application will be aborted.
In order to automatically report memory leaks at program exit, I construct a static object (C++ ensures that its constructor will be called at program initialization, and the destructor be called at program exit), whose destructor will call a function to check for memory leaks. Users are also allowed to call this function manually.
Thus is the basic implementation.

Improvements on usability

The above method worked quite well, until I began to create a large number of objects. Since each delete needed to search in the linked list, and the average number of searches was a half of the length of the linked list, the application soon crawled. The speed was too slow even for the purpose of debugging. So I made a modification: the head of the linked list is changed from a single pointer to an array of pointers, and which element a pointer belongs to depends on its hash value. — Users are allowed to change the definitions of _DEBUG_NEW_HASH and _DEBUG_NEW_HASHTABLESIZE (at compile-time) to adjust the behaviour of debug_new. Their current values are what I feel satisfactory after some tests.
I found in real use that under some special circumstances the pointers to file names can become invalid (check the comment in debug_new.cpp if you are interested). Therefore, currently the default behaviour of debug_new is copying the first 20 characters of the file name, instead of storing the pointer to the file name. Also notice that the length of the original new_ptr_list_t is 16 bytes, and the current length is 32 bytes: both can ensure correct memory alignments.
In order to ensure debug_new can work with new(std::nothrow), I overloaded “void* operator new(size_t size, const std::nothrow_t&) throw()” too; otherwise the pointer returned by anew(std::nothrow) will be considered an invalid pointer to delete. Since debug_new does not throw exceptions (the program will report an alert and abort when memory is insufficient), this overload just calls operator new(size_t). Very simple.
It has been mentioned previously that a C++ file should include debug_new.h to get an accurate memory leak report. I usually do this:

#ifdef _DEBUG
#include "debug_new.h"
#endif
The include position should be later than the system headers, but earlier than user’s own header files if possible. Typically debug_new.h will conflict with STL header files if included earlier. Under some circumstances one may not want debug_new to redefine new; it could be done by defining _DEBUG_NEW_REDEFINE_NEW to 0 before including debug_new.h. Then the user should also useDEBUG_NEW instead of new. Maybe one should write this in the source:

#ifdef _DEBUG
#define _DEBUG_NEW_REDEFINE_NEW 0
#include "debug_new.h"
#else
#define DEBUG_NEW new
#endif
and use DEBUG_NEW where memory tracing is needed (consider global substitution).
Users might choose to define _DEBUG_NEW_EMULATE_MALLOC, and debug_new.h will emulate malloc and free with debug_new and delete, causing malloc and free in a translation unit includingdebug_new.h to be traced. Three global variables are used to adjust the behaviour of debug_newnew_output_fp, default to stderr, is the stream pointer to output information about memory leaks (traditional C streams are preferred to C++ iostreams since the former is simpler, smaller, and has a longer and more predictable lifetime); new_verbose_flag, default to false, will cause everynew/delete to output trace messages when set to truenew_autocheck_flag, default to true (which will cause the program to call check_leaks automatically on exit), will make users have to callcheck_leaks manually when set to false.
One thing to notice is that it might be impossible to ensure that the destruction of static objects occur before the automatic check_leaks call, since the call itself is issued from the destructor of a static object in debug_new.cpp. I have used several techniques to better the case. For MSVC, it is quite straightforword: “#pragma init_seg(lib)” is used to adjust the order of object construction/destruction. For other compilers without such a compiler directive, I use a counter class as proposed by Bjarne ([Stroustrup1997], section 21.5.2) and can ensure check_leaks will be automatically called after the destruction of all objects defined in translation units that include debug_new.h. For static objects defined in C++ libraries instead of the user code, there is a last resort:new_verbose_flag will be set to true after the automatic check_leaks call, so that all later delete operations along with number of bytes still allocated will be printed. Even if there is a misreport on memory leakage, we can manually confirm that no memory leakage happens if the later deletes finally report that “0 bytes still allocated”.
Debug_new will report on deleteing an invalid pointer (or a pointer twice), as well as on mismatches of new/delete[] or new[]/delete. A diagnostic message will be printed and the program willabort.
Exception safety and thread safety are worth their separate sections. Please read on.

Exception in the constructor

Let’s look at the following simple program:

#include 
#include 

void* operator new(size_t size, int line)
{
    printf("Allocate %u bytes on line %d\n", size, line);
    return operator new(size);
}

class Obj {
public:
    Obj(int n);
private:
    int _n;
};

Obj::Obj(int n) : _n(n)
{
    if (n == 0) {
        throw std::runtime_error("0 not allowed");
    }
}

int main()
{
    try {
        Obj* p = new(__LINE__) Obj(0);
        delete p;
    } catch (const std::runtime_error& e) {
        printf("Exception: %s\n", e.what());
    }
}
Any problems seen? In fact, if we compile it with MSVC, the warning message already tells us what has happened:

test.cpp(27) : warning C4291: 'void *__cdecl operator new(unsigned int,int)' : no matching operator delete found; memory will not be freed if initialization throws an exception
Try compiling and linking debug_new.cpp also. The result is as follows:

Allocate 4 bytes on line 27
Exception: 0 not allowed
Leaked object at 00341008 (size 4, )
There is a memory leak!
Of course, this might not be a frequently encountered case. However, who can ensure that the constructors one uses never throw an exception? And the solution is not complicated; it just asks for a compiler that conforms well to the C++ standard and allows the definition of a placement deallocation function ([C++1998], section 5.3.4; drafts of the standard might be found on the Web, such as here). Of compilers I have tested, GCC (2.95.3 or higher) and MSVC (6.0 or higher) support this feature quite well, while Borland C++ Compiler 5.5.1 and Digital Mars C++ compiler (all versions up to 8.38) do not. In the example above, if the compiler supports, we should declare and implement an “operator delete(void*, int)” to recycle the memory allocated by new(__LINE__); if the compiler does not, macros need to be used to make the compiler ignore the relevant declarations and implementations. To make debug_new compile under such a non-conformant compiler, users need to define the macro HAS_PLACEMENT_DELETE (Update: The macro name is HAVE_PLACEMENT_DELETE from Nvwa version 0.8) to 0, and take care of the exception-in-constructor problem themselves. I wish you did not have to do this, since in that case your compiler is really out of date!

Thread safety

My original version of debug_new was not thread-safe. There were no synchronization primitives in the standard C++ language, and I was unwilling to rely on a bulky third-party library. At last I decided to write my own thread-transparency layer, and the current debug_new relies on it. This layer is thin and simple, and its interface is as follows:

class fast_mutex
{
public:
    void lock();
    void unlock();
};
It supports POSIX threads and Win32 threads currently, as well as a no-threads mode. Unlike Loki ([Alexandrescu2001]) and some other libraries, threading mode is not to be specified in the code, but detected from the environment. It will automatically switch on multi-threading when the -MT/-MD option of MSVC, the -mthreads option of MinGW GCC, or the -pthread option of GCC under POSIX environments, is used. One advantage of the current implementation is that the construction and destruction of a static object using a static fast_mutex not yet constructed or already destroyed are allowed to work (with lock/unlock operations ignored), and there are re-entry checks for lock/unlock operations when the preprocessing symbol _DEBUG is defined.
Directly calling lock/unlock is error-prone, and I generally use an RAII (resource acquisition iinitialization; [Stroustrup1997], section 14.4.1) helper class. The code is short and I list it here in full:

class fast_mutex_autolock
{
    fast_mutex& _M_mtx;
public:
    explicit fast_mutex_autolock(fast_mutex& __mtx) : _M_mtx(__mtx)
    {
        _M_mtx.lock();
    }
    ~fast_mutex_autolock()
    {
        _M_mtx.unlock();
    }
private:
    fast_mutex_autolock(const fast_mutex_autolock&);
    fast_mutex_autolock& operator=(const fast_mutex_autolock&);
};
I am quite satisfied with this implementation and its application in the current debug_new.

Special improvement with gcc/binutils

Using macros has intrinsic problems: it cannot work directly with placement new, for it is not possible to expand an expression like “new(special) MyObj” to record file/line information without prior knowledge of the “special” stuff. What is more, the definition of per-class operator new will not work since the preprocessed code will be like “void* operator new("some_file.cpp", 123)(size_t ...)” — the compiler will not love this.
The alternative is to store the instruction address of the caller of operator new, and look up for the source line if a leak is found. Obviously, there are two things to do:

  • Get the caller address of operator new;
  • Convert the caller address to a source position.
There is no portable way to achieve these, but the necessary support has already been there for ready use if the GNU toolchain is used. Let’s just look at some GNU documentation:

`__builtin_return_address (LEVEL)'
     This function returns the return address of the current function,
     or of one of its callers.  The LEVEL argument is number of frames
     to scan up the call stack.  A value of `0' yields the return
     address of the current function, a value of `1' yields the return
     address of the caller of the current function, and so forth.

     The LEVEL argument must be a constant integer.

     On some machines it may be impossible to determine the return
     address of any function other than the current one; in such cases,
     or when the top of the stack has been reached, this function will
     return `0'.
(gcc info page)
addr2line
*********

     addr2line [ -b BFDNAME | --target=BFDNAME ]
               [ -C | --demangle[=STYLE ]
               [ -e FILENAME | --exe=FILENAME ]
               [ -f | --functions ] [ -s | --basename ]
               [ -H | --help ] [ -V | --version ]
               [ addr addr ... ]

   `addr2line' translates program addresses into file names and line
numbers.  Given an address and an executable, it uses the debugging
information in the executable to figure out which file name and line
number are associated with a given address.

   The executable to use is specified with the `-e' option.  The
default is the file `a.out'.
(binutils info page)
So the implementation is quite straightforward and like this:

void* operator new(size_t size) throw(std::bad_alloc)
{
    return operator new(size, __builtin_return_address(0), 0);
}
When a leak is found, debug_new will try to convert the stored caller address to the source position by popening an addr2line process, and display it if something useful is returned (it should be the case if debugging symbols are present); otherwise the stored address is displayed. One thing to notice is that one must tell debug_new the path/name of the process to make addr2line work. I have outlined the ways in the doxygen documentation.
If you have your own routines to get and display the caller address, it is also easy to make debug_new work with it. You may check the source code for details. Look for _DEBUG_NEW_CALLER_ADDRESSand print_position_from_addr.

Important update in 2007

With an idea coming from Greg Herlihy’s post in comp.lang.c++.moderated, a better solution is implemented. Instead of defining new to “new(__FILE__, __LINE__)”, it is now defined to “__debug_new_recorder(__FILE__, __LINE__) ->* new”. The most significant result is that placement new can be used with debug_new now! Full support for new(std::nothrow) is provided, with its null-returning error semantics (by default). Other forms (like “new(buffer) Obj”) will probably result in a run-time warning, but not compile-time or run-time errors — in order to achieve that, magic number signatures are added to detect memory corruption in the free store. Memory corruption will be checked on freeing the pointers and checking the leaks, and a new functioncheck_mem_corruption is added for your on-demand use in debugging. You may also want to define _DEBUG_NEW_TAILCHECK to something like 4 for past-end memory corruption check, which is off by default to ensure performance is not affected.
The code was heavily refactored during the modifications. I was quite satisfied with the new code, and I released Nvwa 0.8 as a result.

Summary

So I have presented my small memory leakage detector. I’ll make a summary here, and you can also consult the online doxygen documentation for the respective descriptions of the functions, variables, and macros.
This implementation is relatively simple. It is lacking in features when compared with commercial applications, like Rational Purify, or even some open-source libraries. However, it is

  • Cross-platform and portable: Apart from the code handling threading (which is separated from the main code) and providing special GCC support (which is automatically on when GCC is detected), only standard language features are used. It should compile under modern C++ compilers. It is known to work with GCC (2.95.3 and later), MSVC 6/7.1, and Borland C++ Compiler 5.5.1.
  • Easy to use: Because “void* operator new(size_t)” is overloaded too, memory leaks could be detected without including my header file. — I myself use it this way habitually in nearly every C++ program. — Generally, I check for the leak position only after I see memory leaks reported by debug_new.
  • Flexible: Its behaviour can be tailored by macros at compile time.
  • Efficient: It has a very low overhead, and it can be used in debugging applications that require high performance.
  • Open-source: It is released in the zlib/libpng licence and you have the freedom to use, change, or redistribute as you like.
With the recent improvements, some of the old restrictions are gone. The macro new or DEBUG_NEW in debug_new.h can mostly work if the newed object has operator news as class member functions, or if new(std::nothrow) is used in the code, though the macro new must be turned off when defining any operator news. Even in the worst case, linking only debug_new.cpp should always work, as long as the allocation operation finally goes to the global operator new(size_t) or operator new(size_t, std::nothrow_t).
Source is available, for your programming pleasure, in the CVS (most up to date) or download of Stones of Nvwa.
May the Source be with you!

Bibliography

[Alexandrescu2001] Andrei Alexandrescu. Modern C++ Design: Generic Programming and Design Patterns Applied. Addison-Wesley, 2001.
[C++1998] ISO/IEC. Programming Languages — C++. Reference Number ISO/IEC 14882:1998(E), 1998.
[Stroustrup1997] Bjarne Stroustrup. The C++ Programming Language (Third Edition). Addison-Wesley, 1997.

HTML for code syntax highlighting is generated by Vim

-----
Cheers,
June

월요일, 6월 21, 2010

원더걸스 뮤직디렉터 이승환이 말하는 ‘작곡가의 길’

간만에 좋은 글 posting 한다. ^^

Source: http://culturenori.tistory.com/957

원더걸스 뮤직디렉터 이승환이 말하는 ‘작곡가의 길’

작곡가 이승환
아름다움을 표현하고 싶어서 발라드 곡을 쓰는 작곡가 이승환 씨는 그 마음을 담아 ‘바람의 화원’, ‘시월애’, ‘연애편지’ OST 등 친숙한 멜로디로 우리의 가슴 속에 다가왔다. 가수가 자신의 곡을 더 잘 불러주었을 때 감동을 받는다는 이승환 씨를 만나 작곡의 세계에 대해 들어봤다.


이  름 : 이승환 (現 상명대학교 음악대학원 컴퓨터음악과 초빙교수)
학  력 1998년 l 서울대학교 음악대학 작곡과 학사(B.M.)/2003년 l New York University 작곡과 영화음악전공(Film Scoring) 석사(M.A.)
수상경력 2004년 l New York Lincoln Center Film Music Festival - Finalist /1993년 l ‘유재하 가요제’ 은상 수상
작품 및 연주활동 경력 (본인 앨범출반 리스트) 2002년2월 l 그룹 ‘스토리’ 앨범 2집 (대영 AV), 솔로 독립, 프로듀서 겸 가수로 활동/1999년3월 l 그룹 ‘스토리’ 앨범 1집 (대영 AV) : 앨범 프로듀서 겸 가수로 활동

대학 시절 가수 박정현의 앨범 수록곡 ‘이제 넌’을 계기로 김형중, 성시경, 이소라, 차태현 등 유명 가수들의 곡을 쓰고, 박진영, 원더걸스 해외 공연 Music Director로 활동영역을 넓혀 가고 있는 작곡가 이승환 씨는, 다양한 작곡 활동뿐만 아니라 현재 대중 음악을 가르치는 교수로도 활동하고 있다. “클래식이 혼자만의 만족감을 얻을 수 있다면, 대중 음악은 소통하는 데 목적을 두고 있어요. 대중과 소통하는 음악을 하고 싶었습니다.”

작 곡가 이승환은 원더걸스 해외 공연 Music Director로 활동하고 있다.

음악적 소양 바탕, Composer의 길로
클래식 피아노를 6살 때부터 시작했다는 그는 음악가 집안이라는 백그라운드도 없고 작곡가가 되고자 꿈꿔온 것도 아니었다. 부모님에 따르면 어린 시절 다른 것에 비해 피아노 치는 것만큼은 싫다는 말을 하지 않았던 것이 계기가 되어, 대회 출전과 입상경력을 통해 음악적 소양을 쌓아왔다.
“어린 시절부터 그렇게 피아노 연주를 계속해왔었는데 중학교 1학년 때 갑자기 그만하고 싶어졌어요. 사춘기의 고민과 더불어 공부도 제대로 할 시간이 없었는데, 피아노를 치려면 손을 보호해야 하기 때문에 좋아하던 농구 등의 거친 운동도 포기해야만 했죠. 그 때는 피아노 연주가 저의 인생에서 그렇게 대단하지는 않다는 생각이 들었어요. 게다가 매일 5~6시간씩 연습을 해야 대학 진학을 바라볼 수 있었는데 학업과 병행하기에는 무리라는 판단이 섰죠.”



그 동안 대학 교수님께 개인 레슨을 받는 등 투자한 비용과 시간 등이 많아 더 고민이 됐지만 길이 아니다 싶어서 그만 두고 공부에만 몰두했다. 그렇게 고등학교에 진학하고 1학년 말 즈음, 문과, 이과를 선택하는 갈림길에 섰을 때 문득 ‘음악을 다시 해보고 싶다’라는 생각이 들기 시작했다.
“음악을 안 한다고 선언했었는데 다시 시작한다고 말을 번복하는 것이 힘들었지만, 결심을 부모님께 털어놓고 양해를 다시 구했죠. 다시 음악학도의 길로 접어들기로 했지만, 피아노를 다시 시작하기에는 3년 간의 공백 때문에 늦은 감이 있었어요. 고민 끝에 음악적인 여러 가지 기본이 양분 될 수 있는 작곡을 선택하기로 했어요. 특히 작곡과는 피아노를 기본으로 해야 하는데 공백 기간은 있었지만, 기본은 다져져 있어 해볼만하지 않을까라는 생각으로 작곡과에 지망하게 되었습니다.”

클래식 작곡가에서 대중적인 인기를 얻기까지
서울대학교 작곡과에 재학하면서 2학년 때까지 클래식 작곡을 전공하던 때, 이승환 씨는 계속 해오던 고전적인 것 말고 다른 부분에 대해서도 고민을 하고 시작했다. “클래식은 다른 사람들과 호흡을 같이 맞출 수 있는 것이 별로 없었죠. 그래서 대중과 호흡할 수있는 것이 어떤 것이 있을까 생각을 많이 했어요. 평소 대중 음악, 영화, 뮤지컬 등에 관심을 두고 있어서 대중 음악 분야는 어떨까 생각을 많이 하고 있었던 터였죠.”
그는 당시 인기 있던 싱어송라이터 유재하에 대해 관심을 두고 있었는데 대학교 1학년 때 대학로를 지나가다 유재하 가요제가 진행 중인 것을 보고 관객으로 참석하게 되었다. 그 때 같은 학과 유희열 선배가 연주하는 것을 보게 되면서, 나도 한 번 나가보고 싶다는 생각으로 준비를 시작 해 1년 후 나가게 되었고 ‘우산과 아이(1993)’로 수상의 영광을 안았다. 몇 달 후 군입대를 하면서 ‘제대 후 하고 싶었던 대중 음악을 꼭 해봐야겠다’는 결심을 하게 되었다고 한다.



“제가 음악을 배울 때는 환경이 지금과는 많이 달랐어요. 요즘처럼 대중 음악을 공부할 수 있는 여건이 안 돼 제대 후 좋아하는 음악을 많이 들으며 혼자 공부하는 시간을 1년 정도 가졌죠. 독학을 하다 알게 된 선배가 녹음실 엔지니어로 일하고 있었는데, 선배를 만나러 갔던 날 우연히 가수 김현철 씨와 만나게 되면서 인연을 맺어 함께 작업하게 되었어요. 그 인연이 오버그라운드(Over ground)로 발을 들여놓게 된 계기가 된 셈이었죠.” 그 후 지금처럼 컴퓨터나 인터넷이 발달하지 않았던 시절이라 그는 자신을 알리기 위해 1996년부터 1997년까지 1년 동안 작업을 해 데모 테이프를 만들어 기획사에 돌리기 시작했다. 그러던 중 한 레코드 사에서 데모 테이프의 노래 중 하나가 좋아 앨범에 쓰고 싶다고 전화가 왔고, 그 곡이 바로 박정현 1집 ‘PIECE’에 수록된 ‘요즘 넌…’이라는 곡이다. 이 곡이 그가 대중 음악을 작곡하면서 처음으로 대중에게 선보인 계기가 되었다. 타이틀 곡은 아니었지만 처음으로 정식 음반에 자신의 곡이 실린다는 것, 이승환 씨는 그것에 감동했다.

“박정현 씨 앨범 작업 이후 다른 가수들의 작업 제의가 많이 들어와 인연을 맺고 작업하는 데 큰 바탕을 마련할 수 있었습니다.”

작곡이란 감성을 교감하는 작업
작곡가가 작사까지 할 수 있는 경우를 제외하고는 보통 노래가 나오기까지 곡을 먼저 쓰고 작사를 하게 된다. 좋은 시의 경우 나중에 곡으로 붙이는 경우는 있으나 이는 극히 드문 경우라고 한다.
클래식 음악을 했던 것 때문에 대중 음악 작곡가로 들어서면서도, 록 보다는 클래식에 바탕을 둔 감성적인 발라드를 지향하게 됐고, 이는 자신이 추구하는 아름다움, 감성적인 부분을 더 돋보이게 할 수 있었다.
“어떤 아티스트들도 마찬가지겠지만 감성들이 중간에 바뀌지는 않아요. 대개 자신이 추구하고자 하는 방향과 맞는 부류와 어울리게 되죠. 그리고 악기를 많이 다룰 줄 아는 것이 작곡가에게는 유리하지만, 건반 오케스트라고 비유되는 피아노를 연주할 줄 아는 것은 화성, 멜로디, 반주 모든 것을 통합하는 기초가 되는 것입니다.”



무에서 유를 창조하는 직업
아무리 좋아서 하는 일이라도 누구에게나 힘든 부분은 있다. 특히, 국내뿐 아니라 세계적으로도 새로운 곡이 매일 쏟아져 나오는 가운데 매번 새로운 곡을 쓴다는 것이 쉽지만은 않은 작업이다.
“대중 음악을 작곡한다는 것은 저를 위해 곡을 쓰는 것이 아닙니다. 가수를 위해서, 다른 악기연주를 위해 곡을 쓰는 것이죠. 작곡을 할 때마다 가수에 어울리는 곡을 만들어야 하는데 이 때 작곡가와 가수의 교감이 절대적으로 필요합니다. 그리고 교감을 나누려면 음악적인 것 외에 감성적인 부분에서도 공통점을 찾아야 하는데 이런 부분이 가장 힘들지요.”
창작의 어려움 속에 요즘 사회적 이슈인 표절과 저작권 등의 문제는 어떻게 해결하는지 물어봤다.
“표절의 경우 의도적으로 한 것과 곡을 썼는데 어떤 부분이 비슷하게 느껴지는 것은 분명히 차이가 나죠. 음악을 하는 사람이라면 음을 들었을 때 표절인지 아닌지 정도는 판단할 수 있어요. 개인적으로 작곡을 끝내고 무엇인가 의심이 들면 다른 작곡가들의 곡과 비교해보곤 합니다. 저작권의 경우 저작권 협회에 등록을 해서 관리하는데, 가끔 가수 이승환 씨와 이름이 같아 곡이 엇갈려서 등록된 적이 있어요. 곡을 쓰겠다고 전화 왔을 때 우연히 알게 되는데 그 때마다 수정하고 있는데 크게 문제가 된 적은 없어요(웃음).”
이승환 씨는 우리 나라는 대중음악 역사가 오래되지 않아서 각 장르별로 마니아 층의 폭이 협소하고 스타일이 빨리 변하는 편이어서, ‘빨리빨리 유행에 맞춰 음악을 쓴다’는 느낌이 힘들게 느껴지기도 한다고 덧붙였다.


요즘 학생들은 좋은 여건 속에서 열정도 많아
대중 음악 작곡가 외에 영화 OST 작곡, 가수 음반 디렉터 등 다양한 영역에서 활동하고 있는 그는, 현재 상명대학교 초빙 교수로 작곡을 가르치고 있다.

“과거에는 하드웨어 장비를 많이 필요로 해서 작곡을 시작하려면 초기 자본이 많이 필요했지만, 요즘에는 소프트웨어가 잘 나와서 4분의 1정도로 가격이 낮아졌어요. 또, 정규앨범이 아니더라도 대중과 접촉할 수 있는 블로그, 홈페이지 등을 통해 대중과 호흡하는 시간이 단축되고 자신의 실력을 공개해 대중과 공감할 수 있는 기회가 더 많아졌죠. 과거보다 시간과 비용이 많이 절감돼 대중에게 접근이 쉬워진 거죠.”
그렇지만 좋아진 여건만큼 안 좋은 점도 있다. 온라인 마켓의 대두로 CD앨범은 거의 구입하지 않고 온라인의 3분의 1정도로 축소된 점, 특히 음반을 발매하기 위해 숨어있는 조역자들, 음반 프로듀서, 음향 기술자 등이 거의 드러나지 않게 된 것이다. 또, 한 번의 클릭으로 쉽게 곡을 선정할 수 있다는 것 때문에 약 4분 정도 재생되는 곡을 만들기 위해 얼마나 많은 수고가 들어가는지에 대해 알아주는 사람이 없다는 것도 현존하는 음반 시장의 문제라고 꼬집었다.

handwriting
handwriting by Flowery *L*u*z*a* 저작자 표시

“작곡은 공부해서 잘 할 수 있는 분야가 아닙니다. 감각을 필요로 하는데, 음악을 사랑하고 음악을 들었을 때 자신도 공감하고 감동을 받아야 하죠. 작곡가가 되고 싶다면 되도록 많은 음악을 접하는 것이 좋습니다. 특히, 편협하게 음악을 골라 듣지 말고 폭 넓게 접해 보고 자신이 좋아하는 것을 골라간다면 작곡가로 성장할 수 있는 밑바탕을 마련할 수 있을 것입니다.”
소망도 하나씩 이룰 때마다 단계적으로 높아진다고 이야기하는 이승환 씨는 무명 시절 가졌던 ‘내 곡이 히트하면 얼마나 좋을까’, ‘내 이름이 실린 앨범을 낸다면 얼마나 좋을까’ 등의 소망을 늘 품고 살았다. 그리고 현재 가졌던 소망을 다 이루었다. “그런 생각들이 나를 움직이는 원동력이 되었어요. 이 모든 것을 이룬 후에도 여전히 소망들이 있고, 대중음악뿐 아니라 뮤지컬, 영화 등을 통해 제가 할 수 있는 역량을 키워보고 싶어요.”
이승환 씨는 피아노는 5시간 연습하면 그 만큼 노력의 수확을 거둘 수 있지만 작곡은 5시간 동안 고민한다고 해서 좋은 곡이 나올 수는 없다는 것이 작곡이라고 말한다. “어떤 때는 1시간 쓴 곡이 좋은 곡으로 나올 수도 있는 것이죠. 그렇지만 1시간의 좋은 곡을 쓰기 위해서는 정서적으로 준비가 되어 있어야 해요. 작곡가가 되고 싶다면 공연, 연극, 뮤지컬, 영화, 여행 등 문화 생활을 많이 경험하면서 내면적인 정서를 기르는 것이 중요합니다.”

틈만 나면 여행을 다니고 영화, 전시 등도 꼭 찾아본다는 이승환 씨처럼 무엇보다도 감성을 더 풍부하게 만들고 대중과 공감하는 노력을 한다면, 작곡가의 길은 그리 멀지 않아 보인다. 앞으로 대중 음악 작곡가뿐만이 아닌 다른 영역에서도 그의 감성적인 활동을 기대해 본다.


글. 최선희 기자 archy77@naver.com
사진. 박준기 기자 marcbymarc@naver.com
출처 : 한국콘텐츠진흥원

-----
Cheers,
June

월요일, 5월 03, 2010

일기 (2010.05.04) 오늘은 내 생일...

오늘은 내 생일이다. 그래서 기분이 좋다. ^^ 헤헤...

오늘이 생일 이라서 지난 주 토요일에 엄마가 올라 오셨다.
맛있는 것도 해주시고 미역국도 끓여주셔서 너무 맛있게 먹었다.

엄마와 같이 쇼핑을 하러 하루는 백화점 (내 생일 선물 사러),
하루는 엄마를 위한 쇼핑으로 여러곳을 다녔다.

그렇다. 하루하루 다리가 남아나질 않았다. 너무 아팠다. ㅠ.ㅠ
너무 많이 걸어서 엄마도 다리가 많이 아프셨을텐데...
그래도 엄마는 즐거워 보이셨다. ^^


음...
5월달 한 달 동안 전 사원이 모두 저녁 9시에서 10시에 퇴근을 하게 될 것이라는 것이다.
다른 부서직원들은 매일 밤 늦게 퇴근하는데에 대한 형평성? 같은 문제 및 기강? 을
잡기 위한 것으로 협조를 부탁할 것이라는 건데...

좋은 취지로 생각을 하신거라 생각은 되지만 (누가 얘기 했는지는 생략한다. -_-;)
뭐가 되었던 강제적인 것은 조금 문제가 있다고 생각이 된다.

학생들에게 미래를 위해 또는 그 시기에 공부를 하게 하기 위해서 강제하는 것은 수긍이
되지만 어린 애도 아니고 엄연히 임금을 받고 정규시간을 지키며(대부분 초과하며) 일하는 직장인이다.
칼퇴근은 해도 중간이 일찍 퇴근하는 사람은 아마도 없을 것이다.

만약 다른 부서에서 일이 많아 늦어지면 여러사람이 분담을 해서 처리하면 되는 것이다.
허나 이것을 다른 직원들은 일찍 퇴근 한다는 것 (물론 다른 이유도 포함되어 있겠지만)으로
모두가 한 달만이라도 야근에 동참?하라고 하는 것은,

이런 부탁이나 요청(사실 의미상 강제가 되겠다.)에 앞서 그 부서에 문제가 있을 뿐 아니라
이를 manage 하는 부분/요인들에 문제가 있다는 것이다.

그나마 다행인 것은 임원들도 같이 동참 한다는 것이다.

내가 얘기하고 싶은 것은,
managing 을 잘 했다면 직원들이 왜 매일 밤 야근에 시달리겠는가? 이다.
분명 문제가 있는 것이다. 직원이 능력이 없어서 그렇다? 물론 그럴수도 있다.
하지만 관리라는 것이 무엇인가?
이러한 상황들을 잘 manage 해서 보다 효율적으로 돌아갈 수 있도록 하는 것 아닌가?
하지만 대부분은 개발자의 입장과 생각을 잘 모른다.

그렇지 않아도 우리나라에서는 대우가 좋지 않은 4D 업종인 IT 에서 일하는
software developer/engineer 인데 너무 좋지 않은 대우를 받는 것이 안타깝다.

과거를 보면 현재를 알 수 있듯이, 오늘날의 현재가 미래의 과거가 되었을 때를 한 번 상상해보게 된다.

,,,
음... 사실 이런 얘기를 쓰려고 한 건 아닌데...
오늘 회사에서 있던 일 중, 괜히 기분이 조금 그래서 조금 적어봤다.


-----
Cheers,
June

일요일, 4월 18, 2010

Urban Dictionary

Urban Dictionary

Source: http://www.urbandictionary.com/define.php?term=Chick%20Check

to chick check (undefined): to stop, stare at a womens body (mainly theirs boobs and ass) and judge it on matter of quality.

[Dialogue]
Alonso: " Chick Check".
David : "that whoe had a whole load of ass".

-----

Cheers,
June

일요일, 4월 04, 2010

Prank Video - Young Chinese girl freaking the hell out of people walking into a building

ㅋㅋㅋ
this is a really great prank video footage...
enjoy!

Young Chinese girl freaking the hell out of people walking into a building


-----
Cheers,
June

월요일, 3월 15, 2010

일기 (2010. 03.15), 꺼내 입은 옷 (고도원의 아침편지)

새로 꺼내 입은 옷


같은 옷을 자주 입다 보면
아무리 멋진 옷이라도 싫증이 나기 마련입니다.
그럴 때는 그 옷을 1~2년 묵혀둡니다.
잊고 있다 1~2년 후에 다시 꺼내 보면
마치 새로 장만한 옷처럼 신선하게 느껴지니
신기한 일입니다. 마치 오랜 친구처럼
다시 어울리니 말입니다.


- 오오하시 시즈코의《멋진 당신에게》중에서 -


* 사람도 옷과 같습니다.
처음에는 반짝했다가도 차츰 시들해지기 쉽습니다.
그때는 잠시 떨어져 지내는 것이 좋습니다.
따로 여행을 떠나는 것도 한 방법입니다.
그러면 다시 소중하고 귀한 존재로
다가옵니다. 옷은 버릴 수 있지만
사람은 버릴 수 없습니다.


-----
이 글귀... 완전 공감한다.
주위의 사람에 대해 얘기를 하지만, 나 자신에 대해서도 적용을 하면,
나 또한 더욱 사랑 스러우며 뭔가 말할 수 없는 에너지를 찾는 느낌이랄까?

이 때문에 그냥 관광이 아닌 나를 위한 여행을 떠나 보는 것도 인생에서 큰 경험이 될 것이다.
혼자서 하는 여행... 외롭게 보일지 모르나, (위험한 곳은 off-topic 이다. -_-;)
이 보다 더 멋지고 많은 것을 경험 해볼 수 있는게 또 있나 싶다.

여행가고 싶다. 부모님과 동생과 함께... ^___^

Cheers,
June

일요일, 3월 07, 2010

Daft Punk: Harder, Better, Faster, Stronger

Daft Punk: Harder, Better, Faster, Stronger

UCC Video footage, long time ago but just enjoy ㅋㅋㅋ

Source: http://www.youtube.com/watch?v=bl6RJyZdBSU


daft punk bodies epic failure
Source: http://www.youtube.com/watch?v=aa_I_KaozEM


-----
I like Daft Punk Style... enjoy~  ㅋㅋㅋ


Cheers,
June

Android Troubleshooting

Android Troubleshooting

Q: "Error generating final archive: Debug certificate expired on ..."
Source: http://www.mail-archive.com/android-beginners@googlegroups.com/msg14319.html

A:
Go to "C:/Documents and Settings//.android" OR
"C:/Documents and Settings//Local Settings/Application Data/Android" and
delete debug.keystore file.
Recompile the proj and the error is gone !!


Android Troubleshooting
Source: http://developer.android.com/guide/appendix/faq/troubleshooting.html

Q: "Please execute 'adb uninstall com.android.myProject' in a shell."
A:
To resolve the issue, you need to fully uninstall the preinstalled and then reinstall it using the adb tool. Here's how to do that:
   1. In a terminal, change to the tools directory of the SDK.
   2. If no emulator instance is running, start an emulator using using the command emulator &.
   3. Uninstall the preinstalled app using the command adb uninstall com.android.samples.
   4. Reinstall the app using the command adb install . If you are working in Eclipse/ADT, you can just compile and run the app in the normal way.
c:/android/sdk/tools> adb uninstall com.android.myProject

Q: "Can't run Emulator (AVD)."
A: if your username is non-english then you have to move your AVD to other directory like this.
C:/Documents and Settings/(_한글_username_)/.android/avd> Android move avd -n avdTest -p C:/android/AVD/avdTest
AVD 'avdTest' moved.
-----
I've faced that problems in my old source tree, but resolved...


Cheers,
June

MIT 두 공대생이 148달러로 우주와 대기권을 찍은 영상

MIT 두 공대생이 148달러로 우주와 대기권을 찍은 영상

Source:
http://space.1337arts.com/
http://www.youtube.com/watch?v=MCBBRRp9DOQ&feature=player_embedded




-----
Great! good job guys...

Cheers,
June

금요일, 3월 05, 2010

[謹弔] 2010년 3월 2일, 사촌동생의 갑작스러운 죽음...

엊그제 일이다...
어제 3일 오전에 집에 전화를 했더니, 갑자기 사촌동생(고모네)이 죽었다는 것이다.
정말 뭐라 말할 수도 없고 그냥 답답했다. 잘못 알았거나 거짓말 이라 생각했다.

오후에 다시 집에 전화를 걸어 엄마께 여쭤보니 맞다고 하셨다.
멀리 타지에서 일하던 아이인데, 이런 갑작스러운 소식에
부모님도 많이 슬퍼 하시고 우셨던것 같다.

자세히 알아보니 사실 세상을 떠난건 2010년 3월 2일 밤이라고 한다.
그날 병원에 다녀와서 약 먹고 잠을 잤는데 다음날 일어나지 않아서
병원에 데려가니 이미 전날 밤에 숨을 거두었다고 한다.

회사 기숙사에서 일어난 일이라서 현재 부검을 끝내고 장례식을 치르는 중이다.
부검 결과는 6주 후에 나온다고 하며, 내일 발인(發靷)을 한다고 한다.
화장한 후 가족묘에 (납골당) 안장할 줄 알았는데 바다에 뿌려준다고 한다.

광주로 데려와서 할 줄 았았는데 그곳(거제도)에서 치른다고 하신다.
때문에 부모님과 동생이 거제도로 가셨다.

같이 많이 어울리지는 않았지만, 애가 착하고 듬직하며 솔직한 아이인걸로 기억한다.
평소 보았을 때 참 건강해 보였는데 하루 아침에 이렇게 되니 참으로 가슴 아픈일이다.

오래전에 외할머니를 하늘나라로 보내 드릴때 가슴이 너무 아팠는데,
하물며 자식을 먼저 보내는 고모와 고모부의 마음은 얼마나 아플지 조금은 와 닿는다.

어렸을때는 몰랐지만, 나이를 먹어 감으로써 노환으로 친할머니도 돌아 가시고,
이번에 젊은 나이로 세상을 떠난 사촌동생을 떠나 보내니 건강한 것과
가족과 항상 함께 하는것이 얼마나 소중하고 중요한지 다시한번 깨닫게 된다.

몇번이고 서울을 떠나 집으로 내려가려고 했으나 현실은 쉽지 않았다.
가족이 생각나면 당장 이라도 내려가고 싶지만, 매일 전화만 드린다.

엄마도 걱정이 많이 되셨는지 내 건강을 많이 살피신다. 나는 그런 나 보다도
엄마 아빠와 내 동생이 항상 다치지 않고 건강하기를 더 바란다.


아직도 사실을 받아 들이기가 힘들다. 그냥 말이 안 된다고 생각한다.
가는 길 배웅이라도 해야 한는데, 너무 멀리 떨어져 있어서... 그냥 미안 하기만 하다.
제대로 된 기도는 아니지만 하늘나라에서 평안 하도록 기도를 하는 것 밖엔
내가 해줄 수 있는게 아무것도 없는 것 같다. 그래서 더 안타깝다.



사랑하는 재욱아,
명절이나 기타 다른 이유로 만나는 것 외에는
많이 만나지 못해서 더 가슴이 아프구나...
함께했던 시간이 많지는 않았지만, 너를 포함한 다른 손주들 모두
친 형제였고 어렴풋이 나마 어렸을 때 기억들도 생각이 난다.
아직 인생에 꽃도 피워 보지도 못한 채 왜 이렇게 먼저 급하게 간 거니?
나 뿐만 아니라 다른 형제들도 모두 사실을 받아 들이기 힘들거야...
왜 이렇게 벌써 갔어야 했니?
멀리 떨어져 있다는 핑계로 만나지도 않고 서로 안부 전화도 하지 않은게
이제와 너무 후회가 된다.
많이 그리울거야... 가는 길 배웅 해줘야 하는데 그러지 못해서 너무 미안해...

재욱아... 하늘나라에서 편히 보내길 바라며,
너를 사랑하는 가족, 고모와 고모부,
그리고 너에 동생을 항상 지켜주고 돌봐주길 바란다.

주제 넘는 말이지만,
너에 몫까지 항상 열심히, 성실하게 그리고 몸 건강하게 살아가도록 할게...

Haiku 로 마지막 인사 할게...
미안하다 / 사랑한다 / 그리울거야...

김호중 拜上

토요일, 2월 27, 2010

Registry Tip



Registry Tip
 - These code are let you show how to use API which relevant Windows Registry.
 - Registry 에 관련된 것은 이곳에 정리를 해놓는다.


//
// Registry Usage
//

// Visual C++
// ...

// Delphi
uses
..., Registry;

procedure TEST_RegistryRW;
var
    __REG: TRegistry;
    str: string;
    strREGKeyVal: string;
    strNewKey: string;
begin
    str := 'SOFTWARE\TEST' + '\REG_TEST';
    strNewKey := 'TestKey';

    __REG := TRegistry.Create( KEY_WRITE );
    try
        //__REG.RootKey := HKEY_LOCAL_MACHINE;
        __REG.RootKey := HKEY_CURRENT_USER;
        __REG.OpenKey( str, True );
        __REG.WriteString( strNewKey, 'can you see this?' );
    finally
        __REG.Free;
        ShowMessage( 'WRITE: finish' );
    end;

    __REG := TRegistry.Create( KEY_READ );
    try
        //__REG.RootKey := HKEY_LOCAL_MACHINE;
        __REG.RootKey := HKEY_CURRENT_USER;  
        __REG.OpenKey( str, True );
        strREGKeyVal := __REG.ReadString( strNewKey );

        if( strREGKeyVal <> '' ) then ShowMessage( 'String: ' + strREGKeyVal );
    finally
        __REG.Free;
        ShowMessage( 'READ: finish' );
    end;
end;

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

//
// Checks Registered Object
//


// Visual C++
#include // Ole32.lib, Ole32.dll
CLSID ClsID;
char* pStrProgID = "Object.InterfaceName"; // Hello.Application
RESULT hr = CLSIDFromProgID( pStrProgID, &ClsID);
if( hr == S_OK )
// Registered
else
// Not Registered



// Delphi
uses
..., ActiveX;
procedure TEST_ChecksRegisteredObject
var
    ClassID: TGUID;
    strObject: string;
begin
    strObject := 'Object.InterfaceName'; // Hello.Application
    if( CLSIDFromProgID(PWideChar(WideString(strObject)), ClassID) = S_OK ) then begin
      ShowMessage( 'Registered' );
    end
    else begin
      ShowMessage( 'Not Registered' );
    end;
end;



-----
Cheers,
June

일요일, 2월 21, 2010

Fingerprint Requirement For a Work-Study Job?

Fingerprint Requirement For a Work-Study Job?
Source: http://ask.slashdot.org/story/10/02/20/233200/Fingerprint-Requirement-For-a-Work-Study-Job

BonesSB writes:
QUOTE: "I'm a student at a university in Massachusetts, where I have a federal work-study position. Yesterday, I got an email from the office that is responsible for student run organizations (one of which I work for) saying that I need to go to their office and have my finger prints taken for the purposes of clocking in and out of work. This raises huge privacy concerns for me, as it should for everybody else. I am in the process of contacting the local newspaper, getting the word out to students everywhere, and talking directly to the office regarding this. I got an email back with two very contradictory sentences: 'There will be no image of your fingerprints anywhere. No one will have access to your fingerprints. The machine is storing your prints as a means of identifying who you are when you touch it.' Does anybody else attend a school that requires something similar? This is an obvious slippery slope, and something I am not taking lightly. What else should I do?"

-----
What the fuck is going on? requires fingerprint for a federal work-study?
i think this makes privacy violation.
although
QUOTE: 'There will be no image of your fingerprints anywhere. No one will have access to your fingerprints. The machine is storing your prints as a means of identifying who you are when you touch it.'
who know? ;)

Cheers,
June

외국 대학 동영상 강의 (continued...)

외국 대학 동영상 강의

* 여러 대학 강의를 한 곳에 모음
 - Academic Earth: http://www.academicearth.org/


* 기타
동영상 강의
2007/07/12 14:25:27

전과목

오른쪽 위 Other Semasters라고 적힌 combo box를 클릭하면 다른 학기 과목도 볼 수 있다.
내가 보고 있는 거: machine structures, OS, 신호및시스템, 일반생물1, 심리학, 영양학, 해부학,
보고 싶은 거: 프로그램이해(?), 영상처리, DSP, 미시경제, 거시경제, 전자회로, 세포생물학, 일반화학,
mit에서는 http://ocw.mit.edu/index.html 에 대부분 강의를 공유한다. 위 링크는 그 중 동영상강의를 공개하는 과목 목록.
내가 보는 거: 알고리즘, 컴퓨터시스템, 전자회로, 선형대수, 미분방정식, 응용수학, 일반물리1,2,3, 일반생물, 일반화학
보고 싶은 거: 16.885J Aircraft Systems Engineering, Fall 2005, 3.091 Introduction to Solid State Chemistry, Fall 2004
3. 강의 정리한 블로그: http://freescienceonline.blogspot.com/
각종 과학과목을 죄다 정리해두었다. 난 대부분의 강의 사이트 링크를 여기서 얻었다. 일부는 동으로부터, 일부는 google 검색, google video 검색 http://video.google.com/videosearch?q=lecture+genre%3Aeducational 으로부터.
블로거는 물리 전공이지만 theoretical cs랑 math에 관심이 많단다.
4. 플로리다 대학교

Computer

종합
mit사람들이 가르치던데, 대학인지 아닌지도 모르겠다.
내가 보는 거: 프로그램이해(?), OOP(자바강의), 이산수학, 확률
보고 싶은 거: 전산수학, 계산이론, DBMS, AI
대학원 과정의 강의를 일부 동영상으로 공개한다. 2003년 이후의 강의는 워싱턴대에서 배포하는 프로그램을 설치하고 사용하면, 동영상+ppt+필기를 동시에 볼 수 있어서 좋다.
내가 보는 거: 프로그래밍언어론, 컴파일러, AI, HCI, 보안, DBMS, 전자거래
보고 싶은 거: 암호학, 컴퓨터구조, DBMS,


낱개
1. 연세대 마이크로프로세서 강좌: http://mpu.yonsei.ac.kr/Lecture/main_video_lect.htm
무슨 국가지원 사업의 일환으로 찍어뒀단다. 한국말 강의가 많다. 동영상에는 ppt파일만 보인다.
선진 대학에는 이런 과목이 있더라. structures and interpretation of computer programs.
프 로그래밍 언어론의 선수과목이라고 해야 할까_ 프로그래밍언어를 멋있게 수학적으로 배운다. lisp이나 scheme같은 학교용 언어를 단계적으로 배운다. 이 강의에서는 lisp. 이건 1986년에 HP사람들 가르친 강좌래. 책도 온라인에 공개돼있다. http://www-mitpress.mit.edu/sicp/full-text/book/book.html
3. Prof. Shiv가 공개하는 네트워킹 강좌 3개: http://www.ecse.rpi.edu/Homepages/shivkuma/teaching/video_index.html
Instructor는 인도사람같아 보이는데, 영어발음은 적당하면서도 빨라서 괜찮다.
4. 퍼듀대 영상처리1 강좌: http://cobweb.ecn.purdue.edu/~bouman/ee637/lectures05/
5. 하버드대 컴퓨터입문 강좌: http://www.fas.harvard.edu/~cscie1/?page=podcast&type=static
6. 전북대 알고리즘 강좌: http://internet512.chonbuk.ac.kr

Machine Learning
Hi there, I thought you might be interested in reading my shared items using Google Reader. Click the link below to view these items:

Or, if you use a feed reader, you can subscribe to their feed by copying and pasting this feed URL into your feed reader:

Hi there, I thought you might be interested in reading my shared items using Google Reader. Click the link below to view these items:

Or, if you use a feed reader, you can subscribe to their feed by copying and pasting this feed URL into your feed reader:

1. Video Lectures
2. Free Science and Video Lectures Online!

Mathematics
2. 아이다호대: http://www.sci.uidaho.edu/polya/
3. 미국용 공짜교육사이트 대수학강좌: http://www.free-ed.net/free-ed/Math/Algebra/Algebra01_VidLect.asp

다른 과목도 많은데, 모두 미국 시민한테만 보여주나보다.

Physics
3. 짧은 quantum physics

Medicine

세미나

전과목
1. mitworld

Computer
Physics
물리강좌 비디오 모음. 버클리, 칼텍, 프린스턴, 하버드, 스탠포드, 코넬 등 학교 링크가 보인다.
링크를 따라가보면 물리 강좌 외 다른 강의도 많이 보인다.
2. 양자역학: http://bethe.cornell.edu/

Medicine

기타


-----
Cheers,
June