Saturday, December 20, 2014

윈도우폰 8.1 개발 시작

윈도우폰 8.1 개발을 시작하였다.
먼저 Visual Studio 2013 Update 4를 설치해야 한다.
그리고 에뮬레이터를 실행하려면 Hyper-V를 CMOS를 셋팅해야한다.
전부다 셋팅 했더니 에뮬레이터가 잘돌아간다.
안드로이드 에뮬레이터보다 훨씬 낫고 거의 Xcode의 아이폰 시뮬레이터급이다.



Friday, December 12, 2014

Android NDK jstring char*로 변환

JNIEXPORT void JNICALL Java_ClassName_MethodName(JNIEnv *env, jobject obj, jstring javaString)
{
    const char *nativeString = (*env)->GetStringUTFChars(env, javaString, 0);
    // use your string
    (*env)->ReleaseStringUTFChars(env, javaString, nativeString);
}

Thursday, December 11, 2014

PHP json_decode후 데이터 접근하기

다음과 같이 데이터를 json_decode한 후에 그 내용을 접근하려면 다음과 같이 한다.

$json_result = json_decode($rawPost);
$serviceId = $json_result->{'serviceId'};

문제는 배열 접근하듯이 []가 아니라 {}라는 점이다. 예전 버전에는 그냥 $json_result->serviceId 이렇게 하면 되었었는데 지금은 그게 안되는 것 같다.

PHP 에러메세지 표시하기

요즘 PHP버전은 에러메세지가 표시하지 않게 되어 있다. 그래서 다음과 같이 PHP문 처음에명시하면 모든 에러메세지를 받을 수 있다.

error_reporting(E_ALL);
ini_set("display_errors", 1);

Wednesday, December 10, 2014

PHP JSON POST data stream 받기

http://stackoverflow.com/questions/4369759/how-to-recieve-post-data-sent-using-application-octet-stream-in-php

같이 일하는 회사에서 JSON 포맷을 data stream 형태로 POST 방식으로 보내준다고 하였다. 그런데 PHP를 한지 하도 오래되어서 몰랐는데 이런 것이 있었다. 정식 명칭은 application/octet-stream이다.

$rawPost = file_get_contents('php://input');

Wednesday, December 3, 2014

Windows 실행파일 패스 알아보기(where)

유닉스에서는 어떤 명령어(프로그램)의 바이너리 위치를 알기위해서는 whereis를 사용했다. 윈도우 cmd에서는 where를 사용한다.(is가 빠짐) 아래에서 msbuild.exe의 패스 위치를 알아보자. 현재 패스 우선순위상으로는 MSBuild 2.0이 4.0보다 높은 순위에 있다. 이러면 msbuild를 입력하면 4.0대신에 2.0이 호출된다.

예제)where msbuild
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe

Tuesday, December 2, 2014

Android 5.0 호환성 문제 - sprintf 직접 구현

예전에 안드로이드 5.0에서 sprintf를 NDK에서 사용했더니 로케일이 달라서 씹히던 문제가 있었다. 그래서 로케일을 상관하지 않는 ANSI용 sprintf를 직접 구현한 소스를 조립해서 NDK에서 기존 sprintf를 대체하니 문제가 말끔히 해결되었다. 다음은 sprintf를 직접 구현한 소스이다. 물론 vsprintf도 직접 구현하였다. 구분 하기 위해서 새로 구현한 sprintf는 대문자로 SPRINTF2라고 명명하였다.

//
// sprintf.c
//
// Print formatting routines
//
// Copyright (C) 2002 Michael Ringgaard. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
// 3. Neither the name of the project nor the names of its contributors
//    may be used to endorse or promote products derived from this software
//    without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.
//

#include <sys/types.h>
#include <stdarg.h>
//#include <string.h>
#include <stdlib.h>
//#include <malloc.h>

#ifdef KERNEL
#define NOFLOAT
#endif

#define CVTBUFSIZE 1024
//#ifndef NOFLOAT
//#include <os.h>
//#endif

#define ZEROPAD 1               // Pad with zero
#define SIGN    2               // Unsigned/signed long
#define PLUS    4               // Show plus
#define SPACE   8               // Space if plus
#define LEFT    16              // Left justified
#define SPECIAL 32              // 0x
#define LARGE   64              // Use 'ABCDEF' instead of 'abcdef'

#define is_digit(c) ((c) >= '0' && (c) <= '9')

static char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
static char *upper_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

static size_t strnlen2(const char *s, size_t count) {
const char *sc;
for (sc = s; *sc != '\0' && count--; ++sc);
return sc - s;
}

static int skip_atoi(const char **s) {
int i = 0;
while (is_digit(**s)) i = i * 10 + *((*s)++) - '0';
return i;
}

static char *number(char *str, long num, int base, int size, int precision, int type) {
char c, sign, tmp[66];
char *dig = digits;
int i;

if (type & LARGE)  dig = upper_digits;
if (type & LEFT) type &= ~ZEROPAD;
if (base < 2 || base > 36) return 0;

c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
}
else if (type & PLUS) {
sign = '+';
size--;
}
else if (type & SPACE) {
sign = ' ';
size--;
}
}

if (type & SPECIAL) {
if (base == 16) {
size -= 2;
}
else if (base == 8) {
size--;
}
}

i = 0;

if (num == 0) {
tmp[i++] = '0';
}
else {
while (num != 0) {
tmp[i++] = dig[((unsigned long)num) % (unsigned)base];
num = ((unsigned long)num) / (unsigned)base;
}
}

if (i > precision) precision = i;
size -= precision;
if (!(type & (ZEROPAD | LEFT))) while (size-- > 0) *str++ = ' ';
if (sign) *str++ = sign;

if (type & SPECIAL) {
if (base == 8) {
*str++ = '0';
}
else if (base == 16) {
*str++ = '0';
*str++ = digits[33];
}
}

if (!(type & LEFT)) while (size-- > 0) *str++ = c;
while (i < precision--) *str++ = '0';
while (i-- > 0) *str++ = tmp[i];
while (size-- > 0) *str++ = ' ';

return str;
}

static char *eaddr(char *str, unsigned char *addr, int size, int precision, int type) {
char tmp[24];
char *dig = digits;
int i, len;

if (type & LARGE)  dig = upper_digits;
len = 0;
for (i = 0; i < 6; i++) {
if (i != 0) tmp[len++] = ':';
tmp[len++] = dig[addr[i] >> 4];
tmp[len++] = dig[addr[i] & 0x0F];
}

if (!(type & LEFT)) while (len < size--) *str++ = ' ';
for (i = 0; i < len; ++i) *str++ = tmp[i];
while (len < size--) *str++ = ' ';

return str;
}

static char *iaddr(char *str, unsigned char *addr, int size, int precision, int type) {
char tmp[24];
int i, n, len;

len = 0;
for (i = 0; i < 4; i++) {
if (i != 0) tmp[len++] = '.';
n = addr[i];

if (n == 0) {
tmp[len++] = digits[0];
}
else {
if (n >= 100) {
tmp[len++] = digits[n / 100];
n = n % 100;
tmp[len++] = digits[n / 10];
n = n % 10;
}
else if (n >= 10) {
tmp[len++] = digits[n / 10];
n = n % 10;
}

tmp[len++] = digits[n];
}
}

if (!(type & LEFT)) while (len < size--) *str++ = ' ';
for (i = 0; i < len; ++i) *str++ = tmp[i];
while (len < size--) *str++ = ' ';

return str;
}

#ifndef NOFLOAT

char *ecvtbuf(double arg, int ndigits, int *decpt, int *sign, char *buf);
char *fcvtbuf(double arg, int ndigits, int *decpt, int *sign, char *buf);

static void cfltcvt(double value, char *buffer, char fmt, int precision) {
int decpt, sign, exp, pos;
char *digits = NULL;
char cvtbuf[CVTBUFSIZE];
int capexp = 0;
int magnitude;

if (fmt == 'G' || fmt == 'E') {
capexp = 1;
fmt += 'a' - 'A';
}

if (fmt == 'g') {
digits = ecvtbuf(value, precision, &decpt, &sign, cvtbuf);
magnitude = decpt - 1;
if (magnitude < -4 || magnitude > precision - 1) {
fmt = 'e';
precision -= 1;
}
else {
fmt = 'f';
precision -= decpt;
}
}

if (fmt == 'e') {
digits = ecvtbuf(value, precision + 1, &decpt, &sign, cvtbuf);

if (sign) *buffer++ = '-';
*buffer++ = *digits;
if (precision > 0) *buffer++ = '.';
memcpy(buffer, digits + 1, precision);
buffer += precision;
*buffer++ = capexp ? 'E' : 'e';

if (decpt == 0) {
if (value == 0.0) {
exp = 0;
}
else {
exp = -1;
}
}
else {
exp = decpt - 1;
}

if (exp < 0) {
*buffer++ = '-';
exp = -exp;
}
else {
*buffer++ = '+';
}

buffer[2] = (exp % 10) + '0';
exp = exp / 10;
buffer[1] = (exp % 10) + '0';
exp = exp / 10;
buffer[0] = (exp % 10) + '0';
buffer += 3;
}
else if (fmt == 'f') {
digits = fcvtbuf(value, precision, &decpt, &sign, cvtbuf);
if (sign) *buffer++ = '-';
if (*digits) {
if (decpt <= 0) {
*buffer++ = '0';
*buffer++ = '.';
for (pos = 0; pos < -decpt; pos++) *buffer++ = '0';
while (*digits) *buffer++ = *digits++;
}
else {
pos = 0;
while (*digits) {
if (pos++ == decpt) *buffer++ = '.';
*buffer++ = *digits++;
}
}
}
else {
*buffer++ = '0';
if (precision > 0) {
*buffer++ = '.';
for (pos = 0; pos < precision; pos++) *buffer++ = '0';
}
}
}

*buffer = '\0';
}

static void forcdecpt(char *buffer) {
while (*buffer) {
if (*buffer == '.') return;
if (*buffer == 'e' || *buffer == 'E') break;
buffer++;
}

if (*buffer) {
int n = strlen(buffer);
while (n > 0) {
buffer[n + 1] = buffer[n];
n--;
}

*buffer = '.';
}
else {
*buffer++ = '.';
*buffer = '\0';
}
}

static void cropzeros(char *buffer) {
char *stop;

while (*buffer && *buffer != '.') buffer++;
if (*buffer++) {
while (*buffer && *buffer != 'e' && *buffer != 'E') buffer++;
stop = buffer--;
while (*buffer == '0') buffer--;
if (*buffer == '.') buffer--;
while (*++buffer = *stop++);
}
}

static char *flt(char *str, double num, int size, int precision, char fmt, int flags) {
char cvtbuf[CVTBUFSIZE];
char c, sign;
int n, i;

// Left align means no zero padding
if (flags & LEFT) flags &= ~ZEROPAD;

// Determine padding and sign char
c = (flags & ZEROPAD) ? '0' : ' ';
sign = 0;
if (flags & SIGN) {
if (num < 0.0) {
sign = '-';
num = -num;
size--;
}
else if (flags & PLUS) {
sign = '+';
size--;
}
else if (flags & SPACE) {
sign = ' ';
size--;
}
}

// Compute the precision value
if (precision < 0) {
precision = 6; // Default precision: 6
}
else if (precision == 0 && fmt == 'g') {
precision = 1; // ANSI specified
}

// Convert floating point number to text
cfltcvt(num, cvtbuf, fmt, precision);

// '#' and precision == 0 means force a decimal point
if ((flags & SPECIAL) && precision == 0) forcdecpt(cvtbuf);

// 'g' format means crop zero unless '#' given
if (fmt == 'g' && !(flags & SPECIAL)) cropzeros(cvtbuf);

n = strlen(cvtbuf);

// Output number with alignment and padding
size -= n;
if (!(flags & (ZEROPAD | LEFT))) while (size-- > 0) *str++ = ' ';
if (sign) *str++ = sign;
if (!(flags & LEFT)) while (size-- > 0) *str++ = c;
for (i = 0; i < n; i++) *str++ = cvtbuf[i];
while (size-- > 0) *str++ = ' ';

return str;
}

#endif

int vsprintf(char *buf, const char *fmt, va_list args) {
int len;
unsigned long num;
int i, base;
char *str;
char *s;

int flags;            // Flags to number()

int field_width;      // Width of output field
int precision;        // Min. # of digits for integers; max number of chars for from string
int qualifier;        // 'h', 'l', or 'L' for integer fields

for (str = buf; *fmt; fmt++) {
if (*fmt != '%') {
*str++ = *fmt;
continue;
}

// Process flags
flags = 0;
repeat:
fmt++; // This also skips first '%'
switch (*fmt) {
case '-': flags |= LEFT; goto repeat;
case '+': flags |= PLUS; goto repeat;
case ' ': flags |= SPACE; goto repeat;
case '#': flags |= SPECIAL; goto repeat;
case '0': flags |= ZEROPAD; goto repeat;
}

// Get field width
field_width = -1;
if (is_digit(*fmt)) {
field_width = skip_atoi(&fmt);
}
else if (*fmt == '*') {
fmt++;
field_width = va_arg(args, int);
if (field_width < 0) {
field_width = -field_width;
flags |= LEFT;
}
}

// Get the precision
precision = -1;
if (*fmt == '.') {
++fmt;
if (is_digit(*fmt)) {
precision = skip_atoi(&fmt);
}
else if (*fmt == '*') {
++fmt;
precision = va_arg(args, int);
}
if (precision < 0) precision = 0;
}

// Get the conversion qualifier
qualifier = -1;
if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
qualifier = *fmt;
fmt++;
}

// Default base
base = 10;

switch (*fmt) {
case 'c':
if (!(flags & LEFT)) while (--field_width > 0) *str++ = ' ';
*str++ = (unsigned char)va_arg(args, int);
while (--field_width > 0) *str++ = ' ';
continue;

case 's':
s = va_arg(args, char *);
if (!s) s = "<NULL>";
len = strnlen2(s, precision);
if (!(flags & LEFT)) while (len < field_width--) *str++ = ' ';
for (i = 0; i < len; ++i) *str++ = *s++;
while (len < field_width--) *str++ = ' ';
continue;

case 'p':
if (field_width == -1) {
field_width = 2 * sizeof(void *);
flags |= ZEROPAD;
}
str = number(str, (unsigned long)va_arg(args, void *), 16, field_width, precision, flags);
continue;

case 'n':
if (qualifier == 'l') {
long *ip = va_arg(args, long *);
*ip = (str - buf);
}
else {
int *ip = va_arg(args, int *);
*ip = (str - buf);
}
continue;

case 'A':
flags |= LARGE;

case 'a':
if (qualifier == 'l') {
str = eaddr(str, va_arg(args, unsigned char *), field_width, precision, flags);
}
else {
str = iaddr(str, va_arg(args, unsigned char *), field_width, precision, flags);
}
continue;

// Integer number formats - set up the flags and "break"
case 'o':
base = 8;
break;

case 'X':
flags |= LARGE;

case 'x':
base = 16;
break;

case 'd':
case 'i':
flags |= SIGN;

case 'u':
break;

#ifndef NOFLOAT

case 'E':
case 'G':
case 'e':
case 'f':
case 'g':
str = flt(str, va_arg(args, double), field_width, precision, *fmt, flags | SIGN);
continue;

#endif

default:
if (*fmt != '%') *str++ = '%';
if (*fmt) {
*str++ = *fmt;
}
else {
--fmt;
}
continue;
}

if (qualifier == 'l') {
num = va_arg(args, unsigned long);
}
else if (qualifier == 'h') {
if (flags & SIGN) {
num = va_arg(args, short);
}
else {
num = va_arg(args, unsigned short);
}
}
else if (flags & SIGN) {
num = va_arg(args, int);
}
else {
num = va_arg(args, unsigned int);
}

str = number(str, num, base, field_width, precision, flags);
}

*str = '\0';
return str - buf;
}

int SPRINTF2(char *buf, const char *fmt, ...) {
va_list args;
int n;

va_start(args, fmt);
n = vsprintf(buf, fmt, args);
va_end(args);

return n;
}

/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details
fcvtbuf.c */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <float.h>
#include <alloc.h>
#ifdef WIN32
#include <malloc.h>
#endif

// #include <crtdll/locale.h>

void __ecvround(char *, char *, const char *, int *);

char *
fcvtbuf(double value, int ndigits, int *decpt, int *sign, char *buf)
{
static char INFINITY[] = "Infinity";
char decimal = '.' /* localeconv()->decimal_point[0] */;
int digits = ndigits >= 0 ? ndigits : 0;
char *cvtbuf = (char *)alloca(2 * DBL_MAX_10_EXP + 16);
char *s = cvtbuf;
char *dot;

SPRINTF2(cvtbuf, "%-+#.*f", DBL_MAX_10_EXP + digits + 1, value);

/* The sign.  */
if (*s++ == '-')
*sign = 1;
else
*sign = 0;

/* Where's the decimal point?  */
dot = strchr(s, decimal);
*decpt = dot ? dot - s : strlen(s);

/* SunOS docs says if NDIGITS is 8 or more, produce "Infinity"
instead of "Inf".  */
if (strncmp(s, "Inf", 3) == 0)
{
memcpy(buf, INFINITY, ndigits >= 8 ? 9 : 3);
if (ndigits < 8)
buf[3] = '\0';
return buf;
}
else if (ndigits < 0)
return ecvtbuf(value, *decpt + ndigits, decpt, sign, buf);
else if (*s == '0' && value != 0.0)
return ecvtbuf(value, ndigits, decpt, sign, buf);
else
{
memcpy(buf, s, *decpt);
if (s[*decpt] == decimal)
{
memcpy(buf + *decpt, s + *decpt + 1, ndigits);
buf[*decpt + ndigits] = '\0';
}
else
buf[*decpt] = '\0';
__ecvround(buf, buf + *decpt + ndigits - 1,
s + *decpt + ndigits + 1, decpt);
return buf;
}
}

/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details 
ecvtbuf.c */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <float.h>
#include <locale.h>

#ifdef WIN32
#include <malloc.h>
#endif

void __ecvround(char *, char *, const char *, int *);

void
__ecvround(char *numbuf, char *last_digit, const char *after_last, int *decpt)
{
char *p;
int carry = 0;

/* Do we have at all to round the last digit?  */
if (*after_last > '4')
{
p = last_digit;
carry = 1;

/* Propagate the rounding through trailing '9' digits.  */
do {
int sum = *p + carry;
carry = sum > '9';
*p-- = sum - carry * 10;
} while (carry && p >= numbuf);

/* We have 9999999... which needs to be rounded to 100000..  */
if (carry && p == numbuf)
{
*p = '1';
*decpt += 1;
}
}
}

char *
ecvtbuf(double value, int ndigits, int *decpt, int *sign, char *buf)
{
static char INFINITY[] = "Infinity";
/*char decimal = localeconv()->decimal_point[0];*/
char decimal = '.'; 
char *cvtbuf = (char *)alloca(ndigits + 20); /* +3 for sign, dot, null; */
/* two extra for rounding */
/* 15 extra for alignment */
char *s = cvtbuf, *d = buf;

/* Produce two extra digits, so we could round properly.  */
SPRINTF2(cvtbuf, "%-+.*E", ndigits + 2, value);
*decpt = 0;

/* The sign.  */
if (*s++ == '-')
*sign = 1;
else
*sign = 0;

/* Special values get special treatment.  */
if (strncmp(s, "Inf", 3) == 0)
{
/* SunOS docs says we have return "Infinity" for NDIGITS >= 8.  */
memcpy(buf, INFINITY, ndigits >= 8 ? 9 : 3);
if (ndigits < 8)
buf[3] = '\0';
}
else if (strcmp(s, "NaN") == 0)
memcpy(buf, s, 4);
else
{
char *last_digit, *digit_after_last;

/* Copy (the single) digit before the decimal.  */
while (*s && *s != decimal && d - buf < ndigits)
*d++ = *s++;

/* If we don't see any exponent, here's our decimal point.  */
*decpt = d - buf;
if (*s)
s++;

/* Copy the fraction digits.  */
while (*s && *s != 'E' && d - buf < ndigits)
*d++ = *s++;

/* Remember the last digit copied and the one after it.  */
last_digit = d > buf ? d - 1 : d;
digit_after_last = s;

/* Get past the E in exponent field.  */
while (*s && *s++ != 'E')
;

/* Adjust the decimal point by the exponent value.  */
*decpt += atoi(s);

/* Pad with zeroes if needed.  */
while (d - buf < ndigits)
*d++ = '0';

/* Zero-terminate.  */
*d = '\0';

/* Round if necessary.  */
__ecvround(buf, last_digit, digit_after_last, decpt);
}
return buf;
}

Monday, December 1, 2014

Android 5.0 호환성 문제 - SoundPool 유사한 AudioPool 만듬

Android 5.0 호환성 문제로 SoundPool이 제대로 동작하지 않아서 AudioPool을 직접 만들었다. 반복되는 사운드와 반복되지 않는 사운드를 따로 저장하였다. 파일이름으로 ID기반으로 관리하며, 반복되지 않는 사운드의 경우 같은 사운드를 동시에 여러게 Play 가능하다.

package com.beyond;

import java.util.HashMap;

import android.media.AudioManager;
import android.media.MediaPlayer;
import android.util.Log;

public class AudioPool implements MediaPlayer.OnCompletionListener {
    private final static String TAG = "AudioPool";

    private int mPosition = 0;

    private HashMap<Integer, String> mMediaResNameMap = new HashMap<Integer, String>();
    private HashMap<Integer, MediaPlayer> mMediaPlayerMap = new HashMap<Integer, MediaPlayer>();// Loop만 저장하자.
    private HashMap<MediaPlayer, Integer> mSoundIDMap = new HashMap<MediaPlayer, Integer>();// Loop만 저장하자.

    private void load(String resName, MediaPlayer mp) {
        mp.reset();
        mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
        mp.setOnCompletionListener(this);
        try {
            android.content.res.AssetFileDescriptor afd = BeyondActivity.context.getAssets().openFd(resName);
            mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
            mp.prepare();
            afd.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private final MediaPlayer load(String resName) {
        final MediaPlayer mp = new MediaPlayer();
        load(resName, mp);
        return mp;
    }

    private void load(int soundID, final MediaPlayer mp) {
        String resName = mMediaResNameMap.get(soundID);
        load(resName, mp);
    }

    public int load(String resName, int priority) {
        mPosition++;

        // 1. 파일이름은 저장해 놓고
        mMediaResNameMap.put(mPosition, resName);
        Log.d(TAG, "load " + mPosition + " " + resName);

        return mPosition;
    }

    final int play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate) {
        Log.d(TAG, "play " + soundID + " loop " + loop);

        boolean looping = loop == -1 ? true : false;
        if (looping) {
            Log.e(TAG, "play looping " + soundID);
            MediaPlayer mp = mMediaPlayerMap.get(soundID);
            if (mp != null) {// 이미 플레이되고 있으니깐 그냥 리턴
                return 0;
            }
        }
        final String resName = mMediaResNameMap.get(soundID);

        MediaPlayer mp = null;

        mp = load(resName);
        Log.d(TAG, "play " + soundID + " load");

        mp.start();
        Log.d(TAG, "play " + soundID + " start");

        if (looping) {
            Log.e(TAG, "play " + soundID + " looping start");
            mMediaPlayerMap.put(soundID, mp);
            mSoundIDMap.put(mp, soundID);
        }

        return 0;
    }

    final public void stop(int soundID) {
        Log.e(TAG, "stop " + soundID);
        MediaPlayer mp = mMediaPlayerMap.get(soundID);
        if (mp != null) {
            Log.e(TAG, "stop " + soundID + " remove");
            mp.stop();
            mp.reset();
            mp.release();
            mp = null;
            mMediaPlayerMap.remove(soundID);
        }
    }

    @Override
    public void onCompletion(MediaPlayer mp) {
        // TODO Auto-generated method stub
        // 플레이가 다 끝난건 제거 하자.
        Log.d(TAG, "onCompletion");
        if (mp != null) {
            if (mSoundIDMap.containsKey(mp)) {// looping
                int soundID = mSoundIDMap.get(mp);
                Log.d(TAG, "onCompletion " + soundID + " looping");
                load(soundID, mp);
                Log.d(TAG, "onCompletion " + soundID + " looping prepare");
                mp.start();
                Log.d(TAG, "onCompletion " + soundID + " looping start");
            } else
            {
                Log.d(TAG, "onCompletion else");
                mp.stop();
                mp.reset();
                mp.release();
                mp = null;
            }
        }
    }
}

Sunday, November 30, 2014

iOS Xcode에서 윈도우에서 작성한 소스코드의 한글(CP949)이 깨지는 현상 해결

윈도우에서 작성한 소스코드를 xcode에서 불러올때 한글이 깨지는 경우가 있다. 물론 UTF-8로 작성했다면 깨지지 않지만, 구형 소스의 경우는 한글 CP949(이하 CP949)로 작성된 경우가 많다.

일일이 UTF-8로 소스코드의 인코딩을 변경하여 사용하면 되지만, 데이터가 CP949기반으로 작성했다면 UTF-8로 인코딩을 변경하면 깨지는 경우가 있어서 바로 CP949를 읽어야 한다.

프로젝트에서 CP949 소스코드를 열면 한글이 깨져있다. 오른쪽에서 Text Settings에서 Text Encoding을 선택한다.

그 다음에 여러가지 Korean이 있는데 EUC나 다른 것을 선택하지 말고 반드시 Korean (Windows, DOS)를 선택하자.


그러면 텍스트를 변환한다는 다이얼로그가 뜨는데 여기서 반드시 Reinterpret를 선택하자. 그러면 다시 저장하지 않아도 된다.



Saturday, November 29, 2014

Android 5.0 호환성 문제 - Nexus5에서 MediaPlayer 소리가 나지 않는 버그

Android 5.0 호환성 문제를 해결하는 중이다. 그런데 넥서스5에서 MediaPlayer에 버그가 있다.

1. setLooping(true)로 설정하였음에도 불구하고, onCompletion이 호출되면서 1번만 플레이하고 끝난다. 안드로이드 4.4.4에서는 이렇게 되지 않고 무한 플레이 된다.

2. setLooping(true) 설정된 MediaPlayer의 최초 플레이시에는 소리가 전혀나지 않는다.

따라서 나는 MediaPlayer에서 setLooping을 믿지 않기로 했고, OnCompletionListener에서 looping을 수동으로 제어하기로 했다.

Friday, November 28, 2014

Android 5.0 호환성 문제 - AUDIO_OUTPUT_FLAG_FAST denied by client

넥서스7(1세대)에서는 잘돌아가는 사운드 부분이 넥서스5에서는 안나오면서 다음과 같은 에러메세지를 냈다.

11-28 00:43:09.547: W/AudioTrack(8259): AUDIO_OUTPUT_FLAG_FAST denied by client

아직 어떤 부분인지 자세히 모르겠지만 확인해 봐야겠다. 그런데 아무리 찾아봐도 답이 없다. 내가 사용하고 있는 것은 SoundPool인데 저 메세지가 7개 이상의 mp3, ogg를 로딩하면 나오는거 같은데... 어쩔수 없이 SoundPool을 대체하는 클래스를 만들어야 겠다.

Thursday, November 27, 2014

Android 5.0 호환성 문제 - sprintf 인코딩 에러

안드로이드 5.0 호환성 문제를 해결하고 있다.

NDK로 만든 소스가 있는데 sprintf가 동작을 안하는 것이다.

이 cpp소스는 한국어(CP949)로 제작되어 있고, format에 들어가는 문자열 데이터는 중국어(GB1232)이다.

이때 안드로이드 5.0에서는 sprintf에서 인코딩이 맞지 않는 문자열을 무시해 버리고 0바이트를 복사해 버린다.

그래서 수동으로 sprintf를 제작해야 한다.

Tuesday, November 25, 2014

Visual Studio 2013에서 MFC가 컴파일되지 않을때

Visual Studio 2013에서 다음과 같은 에러 메세지를 내면서 MFC 프로젝트가 컴파일 되지 않을때가 있다. 이는 2013에서는 MFC를 유니코드만 지원하기 때문에 추가적으로 non-Unicode 라이브러리를 다운 받으라는 말이다. 여러모로 귀찮다.

error MSB8031: Building an MFC project for a non-Unicode character set is deprecated. You must change the project property to Unicode or download an additional library. See http://go.microsoft.com/fwlink/p/?LinkId=286820 for more information.

Friday, November 21, 2014

Visual Studio 2013 설치

Visual Studio 2013을 설치하였다. 기존까지는 Visual Studio 2012를 사용하고 있었는데 이번에는 완전하게 한글화가 되었다. 추가적으로 뭐가 바뀌었는지는 모르겠지만, 2012와 비슷하고 속도가 더욱 빨라진것 같다.

iOS MAC 주소 알아내기

iOS에서 MAC 주소를 알아내는 소스이다.

//MAC
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <net/if_dl.h>
#include <ifaddrs.h>

char*  getMacAddress(char* macAddress, char* ifName) {
   
    int  success;
    struct ifaddrs * addrs;
    struct ifaddrs * cursor;
    const struct sockaddr_dl * dlAddr;
    const unsigned char* base;
    int i;
   
    success = getifaddrs(&addrs) == 0;
    if (success) {
        cursor = addrs;
        while (cursor != 0) {
            if ( (cursor->ifa_addr->sa_family == AF_LINK)
                && (((const struct sockaddr_dl *) cursor->ifa_addr)->sdl_type == 0x06) && strcmp(ifName,  cursor->ifa_name)==0 ) {
                dlAddr = (const struct sockaddr_dl *) cursor->ifa_addr;
                base = (const unsigned char*) &dlAddr->sdl_data[dlAddr->sdl_nlen];
                strcpy(macAddress, "");
                for (i = 0; i < dlAddr->sdl_alen; i++) {
                    char partialAddr[3];
                    sprintf(partialAddr, "%02x", base[i]);
                    strcat(macAddress, partialAddr);
                   
                }
            }
            cursor = cursor->ifa_next;
        }
       
        freeifaddrs(addrs);
    }
    return macAddress;
}

사용법은 다음과 같다. 내부에서 buf의 메모리를 할당하지 않기 때문에 함수 외부에서 할당을 해서 넘겨줘야 한다.
        // buf에 MAC주소를 넣음
        getMacAddress(buf, "en0");

iOS Xcode에서 iOS 7.1 시뮬레이터가 동작하지 않을때

최신버전의 Xcode인 6.1에서는 기본적으로 iOS 7.1 시뮬레이터가 깔려있지 않다. 그래서 7.1을 테스트 하려면 다음과 같이 추가적으로 시뮬레이터를 설치하여야 한다.

메뉴에서 [Xcode] - [Preferences] - [Downloads]로 가서 Components에서 iOS 7.1 Simulator를 다운로드 한다.


Monday, November 17, 2014

금융기관별 ActiveX 설치 현황 목록

[은행: 21개사]
1. KB국민은행 : http://www.kbstar.com/
   설치되는 ActiveX
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - XecureWeb Control V7.2(XecureWeb ClientSM 4.1.1.0) : SoftForum
   - INISAFEWeb v6 : Initech
   - INIIE8Assist : Initech
   - Secure KeyStroke 4.0  : Softcamp
2. 우리은행 : http://www.wooribank.com/
   설치되는 ActiveX
   - XecureWeb Control V7.2(XecureWeb ClientSM 4.1.1.0) : SoftForum
   - ClientKeeper KeyPro Keyboard Protecter : SoftForum
   - Ahnlan Online Security : AhnLab
   - XecureWeb UCA Update Control : SoftForum
   - WRebw : Interzen
3. 신한은행 : http://www.shinhan.com/
   설치되는 ActiveX
   - INISAFEWeb 7.0 Updater : Initech
   - Secure KeyStroke 4.0  : Softcamp
   - Secure KeyStroke Elevation COMDLL  : Softcamp
   - ProWorksGrid : Iniswave
   - Ahnlan Online Security : AhnLab
4. 외환은행 : http://www.keb.co.kr/
   설치되는 ActiveX
   - VeraPort : WIZVERA
   - VeraPort Main : WIZVERA
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - ClientKeeper KeyPro Keyboard Protecter : SoftForum
   - XecureWeb Control V7.2(XecureWeb ClientSM 4.1.1.0) : SoftForum
5. 기업은행 http://www.ibk.co.kr/
   설치되는 ActiveX
   - XecureWeb Control V7.2(XecureWeb ClientSM 4.1.1.0) : SoftForum
   - ClientKeeper KeyPro Keyboard Protecter : SoftForum
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
6. 하나은행 http://www.hanabank.com/
   설치되는 ActiveX
   - INISAFEWeb 7.0 Updater : Initech
   - Secure KeyStroke Elevation COMDLL  : Softcamp
   - Printmade : Designmade
   - Ahnlan Online Security : AhnLab
7. 한국산업은행 http://www.kdb.co.kr/
   설치되는 ActiveX
   - nProtect Securelog Client : INCA
   - nProtect KeyCrypt : INCA
   - nProtect Service Updater : INCA
   - npz ActiveX Control Module : INCA
   - nProtect Security Center : INCA
   - INISAFEWeb v6 : Initech
8. SC제일은행 http://www.scfirstbank.com/
   설치되는 ActiveX
   - SC FirstBank TrustSite ActiveX Module : SC 제일은행(Initech OEM)
   - Microsoft Visual C++ 2005 Redistributable Package : Microsoft
   - INISAFEWeb 7.0 : Initech
   - Ahnlan Online Security : AhnLab
9. 한국씨티은행 http://www.citibank.co.kr/
   설치되는 ActiveX
   - INISAFEWeb 7.0 Updater : Initech
   - Secure KeyStroke 4.0  : Softcamp
   - Ahnlan Online Security : AhnLab
10. HSBC http://www.kr.hsbc.com/
   설치되는 ActiveX
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - nProtect KeyCrypt : INCA
   - XecureWeb Control V7.2(XecureWeb ClientSM 4.1.1.0) : SoftForum
11. 부산은행 http://www.pusanbank.co.kr/
   설치되는 ActiveX
   - nProtect KeyCrypt : INCA
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - Banktown CxCtl20 Module : Initech
   - Pusan Bank MYBCard Module : BankTown
   - BtShellPsb20 Module: Banktown
   - PKICube Admin Module : Banktown
12. 대구은행 http://www.daegubank.co.kr/
   설치되는 ActiveX
   - nProtect KeyCrypt : INCA
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - INISAFEWeb v6 : Initech
13. 광주은행 http://www.kjbank.com/
   설치되는 ActiveX
   - INISAFEWeb v6 : Initech
   - Secure KeyStroke 4.0  : Softcamp
   - Ahnlan Online Security : AhnLab
14. 경남은행 http://www.kyongnambank.co.kr/
   설치되는 ActiveX
   - INISAFEWeb v6 : Initech
   - ClientKeeper KeyPro Keyboard Protecter : SoftForum
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
15. 전북은행 http://www.jbbank.co.kr/
   설치되는 ActiveX
   - nProtect Security Center (nProtect Netizen V4.0) : INCA (설치 않함)
   - ClientKeeper KeyPro Keyboard Protecter : SoftForum
   - XecureWeb Control V7.2(XecureWeb ClientSM 4.1.1.0) : SoftForum
16. 제주은행 http://www.e-jejubank.com/
   설치되는 ActiveX
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - nProtect KeyCrypt : INCA
   - INISAFEWeb v6 : Initech
   - 휴대폰 인증서 보관 서비스 : Infovine
17. 농협 http://banking.nonghyup.com/
   설치되는 ActiveX
   - INISAFEWeb 7.0 Updater : Initech
   - Secure KeyStroke 4.0  : Softcamp
   - Ahnlan Online Security : AhnLab
18. 수협 :  http://www.suhyup-bank.com/
   설치되는 ActiveX
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - INISAFEWeb v6 : Initech
   - Secure KeyStroke 4.0  : Softcamp
   - Printmade : Designmade
   - iTrustSite Module : BankTown
19. 신협 :  http://www.cu.co.kr/
   설치되는 ActiveX
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - nProtect KeyCrypt : INCA
   - INISAFEWeb v6 : Initech
   - nProtect KeyCrypt ActiveX Contol : INCA
20. 새마을금고 :  http://www.kfcc.co.kr/
   설치되는 ActiveX
   - nProtect KeyCrypt : INCA
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - INISAFEWeb v6 : Initech
21. 우체국 : http://www.epostbank.go.kr/
   설치되는 ActiveX
   - EWS Client : 한국정보인증
   - K-Defense 8 : Kings Information&amp;Network
   - OPISASXU : 알수없음
   - Mead Co's Script : Mead &amp; Company
   - Persnal PC Firewall i-Defense : Kings Information&amp;Network

[카드: 10개사]
1. KB카드  http://card.kbstar.com/quics?page=s_crd
   설치되는 ActiveX
   - XecureWeb Control V7.2 : SoftForum
   - XecureWeb UCA Update Control : SoftForum
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - Secure KeyStroke 4.0  : Softcamp
   - Secure KeyStroke Elevation COMDLL  : Softcamp
2. 신한카드  http://www.shinhancard.com/
   설치되는 ActiveX
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - XecureWeb Control V7.2 : SoftForum
   - nProtect KeyCrypt : INCA
3. 우리카드  http://card.wooribank.com/
   설치되는 ActiveX
   - XecureWeb Control V7.2 : SoftForum
   - ClientKeeper KeyPro Keyboard Protecter : SoftForum
   - Ahnlan Online Security : AhnLab
4. 외환카드  http://www.yescard.co.kr/
   설치되는 ActiveX
   - XecureWeb Control V7.2(XecureWeb ClientSM 4.1.1.0) : SoftForum
   - VeraPort : WIZVERA
   - ClientKeeper KeyPro Keyboard Protecter : SoftForum
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
5. 씨티카드  http://www.citibank.co.kr/kor/card/card_index.jsp
   설치되는 ActiveX
   - INISAFEWeb 7.0 Updater : Initech
   - Secure KeyStroke 4.0  : Softcamp
   - Ahnlan Online Security : AhnLab
6. 하나카드  http://www.hanabank.com/contents/ccd/index.jsp
   설치되는 ActiveX
   - Secure KeyStroke 4.0  : Softcamp
   - INISAFEWeb 7.0 Updater : Initech
   - Ahnlan Online Security : AhnLab
7. 삼성카드  http://www.samsungcard.co.kr/
   설치되는 ActiveX
   - nProtect KeyCrypt : INCA
   - XecureWeb Control V7.2(XecureWeb ClientSM 4.1.1.0) : SoftForum
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
8. 현대카드  http://www.hyundaicard.com/
   설치되는 ActiveX
   - XecureWeb Control V7.2(XecureWeb ClientSM 4.1.1.0) : SoftForum
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - nProtect KeyCrypt : INCA
9. 비씨카드  http://www.bccard.com/
   설치되는 ActiveX
   - INISAFEWeb v6 : Initech
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - nProtect KeyCrypt : INCA
10. 롯데카드  http://www.lottecard.co.kr/
   설치되는 ActiveX
   - XecureWeb Control V7.0 : SoftForum
   - nProtect Security Center (nProtect Netizen V4.0) : INCA
   - K-Defense 8 : Kings Information&amp;Network

Saturday, November 15, 2014

Android NDK __android_log_print 에러나는 경우

undefined reference to `__android_log_print'에러가 나는 경우는
Android.mk에다가 아래 줄을 추가하면 문제가 해결된다.

LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog

Android NDK 버전 번호 구하기

NDK에서 안드로이드 버전 번호를 구하는 소스코드

int success = 1;

// VERSION is a nested class within android.os.Build (hence "$" rather than "/")
jclass versionClass = (*env)->FindClass(env, "android/os/Build$VERSION");
if (NULL == versionClass)
success = 0;

jfieldID sdkIntFieldID = NULL;
if (success)
success = (NULL != (sdkIntFieldID = (*env)->GetStaticFieldID(env, versionClass, "SDK_INT", "I")));

jint sdkInt = 0;
if (success)
{
sdkInt = (*env)->GetStaticIntField(env, versionClass, sdkIntFieldID);
LOGI("sdkInt = %d", sdkInt);
}

Thursday, November 13, 2014

Visual C++ MAC 주소 알아내기

윈도우 Win32에서 MAC 주소를 알아내려면 다음과 같이 하면된다.
노트북을 사용한다고 가정하여 어댑터들 중에 "Wi-Fi"를 검색한다.

// 윈속 2를 반드시 include해야 한다.
#include <winsock2.h>
#pragma comment(lib, "ws2_32.lib")

#include <iphlpapi.h>
#include <iptypes.h>
// Link with Iphlpapi.lib
#pragma comment(lib, "IPHLPAPI.lib")

#define WORKING_BUFFER_SIZE 15000
#define MAX_TRIES 3

char* get_mac_adress()
{
int family = AF_INET;
PIP_ADAPTER_ADDRESSES pAddresses = NULL;
ULONG outBufLen = 0;
ULONG Iterations = 0;

// Allocate a 15 KB buffer to start with.
outBufLen = WORKING_BUFFER_SIZE;
DWORD dwRetVal = 0;

// Set the flags to pass to GetAdaptersAddresses
ULONG flags = GAA_FLAG_INCLUDE_PREFIX;

pAddresses = (IP_ADAPTER_ADDRESSES *)malloc(outBufLen);
dwRetVal = GetAdaptersAddresses(family, flags, NULL, pAddresses, &outBufLen);

char *ret = new char[128];
memset(ret, 0, 128);

while (pAddresses) {
if (wcsstr(pAddresses->FriendlyName, L"Wi-Fi")) {
for (int i = 0; i < 6; i++) {
sprintf(ret, "%s%02x", ret, pAddresses->PhysicalAddress[i]);
}
}
pAddresses = pAddresses->Next;

}
return ret;
}

int _tmain(int argc, _TCHAR* argv[])
{
char *mac = get_mac_adress();
printf("mac address: %s\n", mac);
delete[] mac;

return 0;
}



Sunday, November 2, 2014

C# Bitmap 픽셀 처리(읽기/쓰기)

C# Bitmap에서 SetPixel, GetPixel을 사용하게 되면 매우 느리게 된다.(전체 픽셀을 다룰 경우) 그럴경우 다음과 같이 픽셀 포인터를 얻어서 사용하면 매우 빠르기 픽셀 처리를 할수 있다. 이를 위해서는 unsafe옵션을 켜주어야 한다.

private Image _image = null;

// 비트맵 픽셀 처리
        private void Form1_Load(object sender, EventArgs e)
        {
            Bitmap bitmap = new Bitmap(100, 100);
            BitmapData bmpData = bitmap.LockBits(new Rectangle(0, 0, 100, 100), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            unsafe
            {
                byte* ptr = (byte* )bmpData.Scan0.ToPointer();
                for (int i = 0; i < bmpData.Height; i++)
                {
                    for (int j = 0; j < bmpData.Width; j++)
                    {
                        ptr[bmpData.Stride * i + 3 * j + 0] = 0;// B
                        ptr[bmpData.Stride * i + 3 * j + 1] = 0;// G
                        ptr[bmpData.Stride * i + 3 * j + 2] = 255;// R
                    }
                }
                bitmap.UnlockBits(bmpData);
            }
            _image = bitmap;
        }

// 비트맵 그리기
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            if (_image != null)
            {
                g.DrawImage(_image, 0, 0, _image.Width * _imageScale, _image.Height * _imageScale);
            }
        }

Saturday, November 1, 2014

C# OutputDebugString 사용하기

C#에서 OutputDebugString이 안될때는 다음과 같이 [Project] - [Properties] - [Debug]탭에서 Enable native code debugging을 활성화 시키면 된다.
OutputDebugString을 Managed C++에서 써도 마찬가지 방법으로 활성화 시킨다.


C# C++ char* 문자열 전달하기

C++ 함수가 다음과 같은 것이 있고, MBCS 문자열 인코딩을 사용할 때
void encoding_test(const char* pstr);

다음과 같이 C#에서 작성하면 char* 형으로 문자열을 전달할 수 있다.

        unsafe private sbyte[] get_sbyte_string(string s)
        {
// 51949는 EUC-KR이다.
            byte[] b2 = Encoding.GetEncoding(51949).GetBytes(s);
            sbyte[] sb = (sbyte[])((Array)b2);
            for (int i = 0; i < sb.Length; i++)
            {
                Console.WriteLine(sb[i]);
            }
            return sb;
        }

            string s = "하이";
            unsafe
            {
                fixed (sbyte* psb = get_sbyte_string(s))
                {
                    encoding_test(psb);
                }
            }


Thursday, October 30, 2014

C# 파일 drag and drop

Form properties에서 AllowDrop을 true로 설정

        private void Form1_DragEnter(object sender, DragEventArgs e)
        {
            // 드래그 시작 처리
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
                e.Effect = DragDropEffects.Copy;
        }

        private void Form1_DragDrop(object sender, DragEventArgs e)
        {
            // 드래그된 모든 파일 얻기
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
            foreach (string file in files)
                Console.WriteLine(file);
        }

C# unsafe 컴파일러 옵션 사용하기

Visual Studio 개발 환경에서 이 컴파일러 옵션을 설정하려면

  1. 프로젝트의 속성 페이지를 엽니다.
  2. 빌드 속성 페이지를 클릭합니다.
  3. 안전하지 않은 코드 허용 확인란을 선택합니다.