Programming/C Win32 MFC2017. 3. 27. 14:54

어라 이거 적은적이 없었나?

대개 비트 구조체라고 했었는데 원래는 비트 필드 인듯

[링크 : https://en.wikipedia.org/wiki/Bit_field]

[링크 : http://lab.cliel.com/entry/C-C-비트필드Bit-Field]


아무튼 얘를 x86에서 쓰려면 대개 아래의 선언문을 통해서 바이트 align을 맞춰야 하는데

컴파일러 별로 사용가능한 선언문이 다르다.

#pragma pack is a Microsoft syntax that has been ported to GCC for compatibility reasons.

__attribute__((aligned)) is a GCC-specific syntax (unsupported by MSVC). 

[링크 : http://stackoverflow.com/.../whats-the-difference-between-pragma-pack-and-attribute-aligned]


'Programming > C Win32 MFC' 카테고리의 다른 글

MFC 라디오버튼 사용하기  (0) 2017.04.05
mfc cstring 문자열 관련(유니코드)  (0) 2017.04.04
MFC CButton 마우스 클릭시 작동하기  (0) 2017.03.08
GetHttpConnection()  (0) 2017.03.03
만능의 tokenizer?!  (0) 2017.03.03
Posted by 구차니
Programming/php2017. 3. 14. 19:02

php 에서는 삽입후 해당 id값을 받을수 있는데

mysql에서 sql로 할때는 어떻게 해야 하려나?


[링크 : http://php.net/manual/kr/function.mysql-insert-id.php]


http://adgw.tistory.com/m/entry/%EA%B3%84%EC%B8%B5%ED%98%95-%EA%B2%8C%EC%8B%9C%ED%8C%90-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EB%8C%93%EA%B8%80-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98


5.20

http://stackoverflow.com/questions/15821532/get-current-auto-increment-value-for-any-table

'Programming > php' 카테고리의 다른 글

php 세션주의사항(?)  (0) 2017.04.13
php mvc 구현(+ PDO)  (2) 2017.04.07
php zend guard ?  (2) 2017.03.14
php -> exe (윈도우)  (0) 2017.03.14
php $_REQUEST  (0) 2017.01.25
Posted by 구차니
Programming/php2017. 3. 14. 15:04

외주 주었던 회사 홈페이지를

다른 경로에 올리면 작동하지 않아서 어떤 원리로 돌아가는지 분석해보려다 막혔었는데

다시 찾아 보니.. 매우 간단(?)한 원리인듯


index.html에서

include.inc.html을 include once로 불러오고

해당 파일은 zend guard로 난독화(?) 처리 되어 있는데

그 안에서 무언가 hostname이라던가 도메인을 확인 후 아니면 return false 해서

프로세싱을 멈춰버리는 듯?


$ file *.html

include.inc.html: PHP script Zend Optimizer data


[링크 : http://www.zend.com/en/products/zend-guard]

[링크 : http://stackoverflow.com/questions/4298001/decode-a-php-encoded-with-zend-guard]

[링크 : http://stackoverflow.com/questions/12226890/this-is-not-a-text-filezend-optimizer]



잘 찾아 보면 dezend도 있네

[링크 : http://jobdahan.net/language_php/1498450]

[링크 : http://ziumb.tistory.com/41] << dezend

[링크 : http://egloos.zum.com/zzong75/v/2813381]

[링크 : https://sir.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=24083]



zend 암호화 한걸 풀어서 보니 호스트를 비교하는게 맞았군!

$_SERVER['HTTP_HOST']

[링크 : http://php.net/manual/en/reserved.variables.server.php]

[링크 : http://pro.thinkangel.com/10]


+

자세한건 모르겠지만 호스팅 업체는 PHP5.2 + Zend Optimizer v3.3.9를 돌리고 있어서

별도의 Zend Loader 없이 돌리는것 같긴한데.. Zend Optimizer 조차도 없는 PHP 5.6에서는 작동하려나?

[링크 : http://www.zend.com/en/products/zend-guard#OptimizerL]


+

라즈베리에 올려서 해보니.. 얘가 그냥 뱉어내네?!

5.6이라 그런가 zend optimizer가 없어서 그런가?


+

5.6용으로 나왔는데 가입안하면 못 받음 크리

물론.. x86 linux용일거 같은데 arm용도 있을려나?

'Programming > php' 카테고리의 다른 글

php mvc 구현(+ PDO)  (2) 2017.04.07
php mysql 자동증가값 받기  (0) 2017.03.14
php -> exe (윈도우)  (0) 2017.03.14
php $_REQUEST  (0) 2017.01.25
php global  (0) 2017.01.23
Posted by 구차니
Programming/php2017. 3. 14. 14:57


[링크 : https://sourceforge.net/projects/bamcompile/]

[링크 : http://www.bambalam.se/bamcompile/]


[링크 : http://blog.naver.com/mirazi9/140157951251]

'Programming > php' 카테고리의 다른 글

php mysql 자동증가값 받기  (0) 2017.03.14
php zend guard ?  (2) 2017.03.14
php $_REQUEST  (0) 2017.01.25
php global  (0) 2017.01.23
html+php login form  (0) 2017.01.18
Posted by 구차니
Programming/ffmpeg2017. 3. 9. 13:09

av_opt_set() 으로 buffer_size 하려는데 안되길래 버전을 올리니.. 으헉?

1>cmdutils.obj : error LNK2001: _avcodec_default_release_buffer 외부 기호를 확인할 수 없습니다.

1>ffplaycore.obj : error LNK2001: _avcodec_alloc_frame 외부 기호를 확인할 수 없습니다.

1>ffplaycore.obj : error LNK2001: _avcodec_get_frame_defaults 외부 기호를 확인할 수 없습니다.

1>ffplaycore.obj : error LNK2001: _avcodec_free_frame 외부 기호를 확인할 수 없습니다. 



-void avcodec_free_frame(AVFrame **frame)

-{

-    av_frame_free(frame);

-} 

[링크 : https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2015-September/093338.html]



#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 45, 101)

      av_frame_alloc()

#else

    avcodec_alloc_frame()

#endif 

[링크 : https://www.bountysource.com/issues/6093496-replace-avcodec_alloc_frame-with-av_frame_alloc]


-void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)

-{

-    av_frame_unref(pic);

-} 

[링크 : https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2015-September/093320.html


The comment around the function declaration for avcodec_get_frame_defaults says that you should use av_frame_unref and the code seems to be doing just that: 

[링크 : http://stackoverflow.com/questions/27686064/ffmpeg-avcodec-get-frame-defaults-was-declared-deprecated


빌드는 어찌했는데 실행이 안되네 ㅠㅠ

dll 신버전 맞춰줘도 왜 안되니 ㅠㅠ

'Programming > ffmpeg' 카테고리의 다른 글

vlc "network-caching" / ffmpeg "buffer_size" 소스 검색  (0) 2017.03.07
ffplay.c  (0) 2017.03.06
ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
Posted by 구차니
Programming/C Win32 MFC2017. 3. 8. 17:08

MFC에서 버튼은 마우스 릴리즈 시에 이벤트가 발생하는데

버튼을 클릭하는 시점에서 실행하도록 하려면 또 애증의


PreTranslateMessage()를 쓸 수 밖에 없나...


[링크 : http://www.tipssoft.com/bulletin/tb.php/FAQ/648]

[링크 : http://blog.naver.com/1004kiwoo/60128691649]



+

2017.10.17

버튼에서 LBUTTON_DOWN 이벤트 발생시(왼쪽 버튼을 누르는 시점)

행동을 하도록 해보니.. Focus는 누른 이후에 이동하는 거라

버튼에 대해서 포커스로 하기에는 무리..


CButton *pButton;

pButton = (CButton *)GetDlgItem(IDC_BUTTON3);

pButton->GetWindowRect(rect);

if(rect.PtInRect(pMsg->pt))

{

// TODO

}


다만, 키 입력 자체는 이미 클릭하거나 탭키로 포커스를 바꾼 이후에 입력하는 거라 문제가 되지 않을 듯 하다.

if(pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE)

{

if(GetDlgItem(IDC_EDIT1) == GetFocus())

{

// TODO

}


'Programming > C Win32 MFC' 카테고리의 다른 글

mfc cstring 문자열 관련(유니코드)  (0) 2017.04.04
bit field와 컴파일러별 byte align  (0) 2017.03.27
GetHttpConnection()  (0) 2017.03.03
만능의 tokenizer?!  (0) 2017.03.03
mfc md5  (2) 2017.03.03
Posted by 구차니
Programming/ffmpeg2017. 3. 7. 19:27

vlc

Search ""network-caching"" (23 hits in 21 files)

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\avio.c (1 hit)

Line 442:         *delay = INT64_C(1000) * var_InheritInteger(access, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\file.c (1 hit)

Line 409:                 *pi_64 = var_InheritInteger (p_access, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\ftp.c (1 hit)

Line 899:                    * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\http.c (1 hit)

Line 995:                 * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\live555.cpp (1 hit)

Line 1683:                   * var_InheritInteger( p_demux, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\mms\mmsh.c (1 hit)

Line 253:                    * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\mms\mmstu.c (1 hit)

Line 257:                    * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\rtp\rtp.c (1 hit)

Line 384:             *v = INT64_C(1000) * var_InheritInteger (demux, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\rtsp\access.c (1 hit)

Line 325:                 * var_InheritInteger(p_access, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\sftp.c (1 hit)

Line 360:                * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\smb.c (1 hit)

Line 329:             * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\tcp.c (1 hit)

Line 178:                    * var_InheritInteger( p_access, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\udp.c (1 hit)

Line 220:                    * var_InheritInteger(p_access, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\access\vnc.c (1 hit)

Line 301:                   * var_InheritInteger( p_demux, "network-caching" );

  D:\Download\ffmpeg\vlc-2.2.4\modules\gui\macosx\simple_prefs.m (2 hits)

Line 761:     TestCaC("network-caching", 10/3);

Line 1074:             CaC("network-caching", 10/3);

  D:\Download\ffmpeg\vlc-2.2.4\modules\gui\qt4\components\open_panels.cpp (1 hit)

Line 705:     emit methodChanged( qfu( "network-caching" ) );

  D:\Download\ffmpeg\vlc-2.2.4\modules\gui\qt4\components\simple_preferences.cpp (2 hits)

Line 728:             TestCaC( "network-caching", 10/3 );

Line 1074:             CaC( "network-caching", 10/3 );

  D:\Download\ffmpeg\vlc-2.2.4\modules\stream_filter\dash\dash.cpp (1 hit)

Line 291:                 var_InheritInteger(p_stream, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\stream_filter\httplive.c (1 hit)

Line 2758:                 var_InheritInteger(s, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\modules\stream_filter\smooth\smooth.c (1 hit)

Line 796:                 var_InheritInteger(s, "network-caching");

  D:\Download\ffmpeg\vlc-2.2.4\src\libvlc-module.c (1 hit)

Line 1823:     add_integer( "network-caching", CLOCK_FREQ / 1000, 


ffmpeg

Search ""buffer_size"" (7 hits in 5 files)

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavdevice\pulse_audio_enc.c (1 hit)

Line 766:     { "buffer_size",     "set buffer size in bytes",         OFFSET(buffer_size),     AV_OPT_TYPE_INT,    {.i64 = 0}, 0, INT_MAX, E },

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavformat\rtpproto.c (1 hit)

Line 68:     { "buffer_size",        "Send/Receive buffer size (in bytes)",                              OFFSET(buffer_size),     AV_OPT_TYPE_INT,    { .i64 = -1 },    -1, INT_MAX, .flags = D|E },

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavformat\rtsp.c (2 hits)

Line 79:     { "buffer_size",        "Underlying protocol send/receive buffer size",                  OFFSET(buffer_size),           AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC } \

Line 125:     av_dict_set(&opts, "buffer_size", buf, 0);

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavformat\rtspdec.c (1 hit)

Line 294:             av_dict_set(&opts, "buffer_size", buf, 0);

  D:\Download\ffmpeg\ffmpeg-3.2.4\libavformat\udp.c (2 hits)

Line 122:     { "buffer_size",    "System data size (in bytes)",                     OFFSET(buffer_size),    AV_OPT_TYPE_INT,    { .i64 = -1 },    -1, INT_MAX, .flags = D|E },

Line 750:         if (av_find_info_tag(buf, sizeof(buf), "buffer_size", p)) {


'Programming > ffmpeg' 카테고리의 다른 글

ffmpeg deprecated 수정  (0) 2017.03.09
ffplay.c  (0) 2017.03.06
ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
Posted by 구차니
Programming/ffmpeg2017. 3. 6. 16:57

비슷하면서도 많이 다르네..

옛날 소스와 요즘 소스의 차이일려나?


[링크 : https://www.ffmpeg.org/doxygen/0.6/ffplay_8c-source.html]

[링크 : https://www.ffmpeg.org/doxygen/0.6/ffplay_8c.html]


[링크 : http://blog.csdn.net/leixiaohua1020]


[링크 : https://ffmpeg.zeranoe.com/builds/]

'Programming > ffmpeg' 카테고리의 다른 글

ffmpeg deprecated 수정  (0) 2017.03.09
vlc "network-caching" / ffmpeg "buffer_size" 소스 검색  (0) 2017.03.07
ffmpeg 예제 소스 분석  (0) 2017.02.10
ffmpeg 3.2 소스관련  (0) 2017.02.10
ffmpeg - vlc cache 설정관련  (0) 2017.02.10
Posted by 구차니
Programming/C Win32 MFC2017. 3. 3. 18:14

아놔...

대충 검색하고 하다 보니.. username / password가 있는지도 몰랐네

한마디로 하루 작업한거 괜히 뻘짓 되는 저 마법의 두 인자.. -_ㅠ


CHttpConnection* GetHttpConnection(

   LPCTSTR pstrServer,

   INTERNET_PORT nPort = INTERNET_INVALID_PORT_NUMBER,

   LPCTSTR pstrUserName = NULL,

   LPCTSTR pstrPassword = NULL 

);


CHttpConnection* GetHttpConnection(

   LPCTSTR pstrServer,

   DWORD dwFlags,

   INTERNET_PORT nPort = INTERNET_INVALID_PORT_NUMBER,

   LPCTSTR pstrUserName = NULL,

   LPCTSTR pstrPassword = NULL 

); 


[링크 : https://msdn.microsoft.com/ko-kr/library/59kzsz14(v=vs.71).aspx]




---

수동으로.... 구현 -_ㅠ 아놔..

아무튼 AddRequestHeaders()는 제대로 된 형태가 아니면 삽입이 되지 않고

해당 HTTPConnection은 재사용해도 문제가 되진 않는다.


pHttpFile->SendRequest();

pHttpFile->QueryInfoStatusCode(m_dwStatusCode);

pHttpFile->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF, szHeaders);


switch(m_dwStatusCode)

{

case HTTP_STATUS_OK:

{

CString strResult;

while(pHttpFile->ReadString(strResult))

{

strResult.ReleaseBuffer();

}

}

break;


case HTTP_STATUS_DENIED: // unauthorized

{

CString realm;

CString nonce;

CString cnonce("0000000000");

CString str;


pHttpFile->QueryInfo(HTTP_QUERY_WWW_AUTHENTICATE, szHeaders);

delete pHttpFile;


int curPos = 0;

CString resToken;

CString key;

CString val;


resToken = szHeaders.Tokenize(_T(" "), curPos);

while(!resToken.IsEmpty())

{

// Obtain next token

key = resToken = szHeaders.Tokenize(_T("="), curPos);

val = resToken = szHeaders.Tokenize(_T("\""), curPos);

resToken = szHeaders.Tokenize(_T(" "), curPos);

if(0 == key.Compare(_T("nonce"))) nonce = val;

if(0 == key.Compare(_T("realm"))) realm = val;

}


CString HA1,HA2,RES;

HA1 = md5gen(str = id+":"+realm+":"+pw);

HA2 = md5gen(str = CString("GET:")+query);

RES = md5gen(str = HA1+":"+nonce+":00000001:"+cnonce+":auth:"+HA2);


pHttpFile = pHttpConnect->OpenRequest(CHttpConnection::HTTP_VERB_GET, strObject);

auth.Append(_T("Authorization: "));

auth.Append(szHeaders);

auth.Append(_T(",username=\""));

auth.Append(id+"\",");

auth.Append(_T("uri=\""));

auth.Append(query+"\",");

auth.Append(_T("cnonce=\""));

auth.Append(cnonce+"\",");

auth.Append(_T("nc=00000001,response=\""));

auth.Append(RES+"\",");

pHttpFile->AddRequestHeaders(auth);

pHttpFile->SendRequest();

pHttpFile->QueryInfoStatusCode(m_dwStatusCode);

pHttpFile->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF, szHeaders);

pHttpFile->Read(content, pHttpFile->GetLength());

}

break;

default:

break;

}


if(pHttpFile) {pHttpFile->Close(); delete pHttpFile; pHttpFile = NULL; }

if(pHttpConnect) {pHttpConnect->Close(); delete pHttpConnect; pHttpConnect = NULL; }

if(pSession) {pSession->Close(); delete pSession; pSession = NULL;


'Programming > C Win32 MFC' 카테고리의 다른 글

bit field와 컴파일러별 byte align  (0) 2017.03.27
MFC CButton 마우스 클릭시 작동하기  (0) 2017.03.08
만능의 tokenizer?!  (0) 2017.03.03
mfc md5  (2) 2017.03.03
ms c++ 관련 신규 문법(?)  (0) 2017.03.03
Posted by 구차니
Programming/C Win32 MFC2017. 3. 3. 12:40

HTTP 파싱하려는데

키와 값을 ,로 분리해서 쓰는녀석이라

고민을 해보는데.. 아무리 생각해도 토크나이저가 짱짱인듯


[링크 : http://codereview.stackexchange.com/questions/107899/converting-a-string-to-a-list-of-key-value-pairs]


[링크 : http://stackoverflow.com/questions/12581169/cstring-tokenization-issue]

'Programming > C Win32 MFC' 카테고리의 다른 글

MFC CButton 마우스 클릭시 작동하기  (0) 2017.03.08
GetHttpConnection()  (0) 2017.03.03
mfc md5  (2) 2017.03.03
ms c++ 관련 신규 문법(?)  (0) 2017.03.03
MFC HTTP POST + 인증  (0) 2017.03.02
Posted by 구차니