IT 취미생활.  
Front Page
Tag | Location | Media | Guestbook | Admin   
 
'Programming'에 해당하는 글(80)
2008.03.12   Code Project에서 지원하는 Licenses 종류들....
2008.03.12   vs2005에서 Data breakpoint 사용하는 방법
2008.03.12   Tiny singleton helper class
2008.03.11   [Dshow] DirectShow Filter Build시 발생하는 Link Error 해결방법
2008.03.10   간단한 Callback Function 예제
2008.03.10   [P]중복된 Header 제거 하는 간단한 방법 중 하나는??
2008.03.10   [펌]Tiny singleton helper class
2008.03.09   Bit 연산을 이용한 Flag 사용하기
2008.03.09   [Dshow] DirectShow SDK Filter Graph Editor
2008.03.09   [Dshow] 연결된 필터 이름 알아오기
2008.03.09   파일명, 라인정보를 보여주는 에러 메세지 박스 만들기 2


Code Project에서 지원하는 Licenses 종류들....

The Licenses

The following is a rough guide to the current licenses supported on The Code Project. Please read them carefully by following the links to the license pages themselves because some categorisations (such as whether code can be used commercially, or whether extensions must be release to the public) depends on the situtation. This is merely a guide: it's up to you to read the actual license carefully before using code licensed by each license or assigned a license to code you submit.

The Code Project Open License (CPOL)

The main points subject to the terms of the License are:

  • Source Code and Executable Files can be used in commercial applications;
  • Source Code and Executable Files can be redistributed; and
  • Source Code can be modified to create derivative works.
  • No claim of suitability, guarantee, or any warranty whatsoever is provided. The software is provided "as-is".
Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: False
Provides an explicit patent license: True
Can be used in closed source applications: True
Is a viral licence: False

Common Development and Distribution License (CDDL)

Based on the Mozilla Public License (MPL) that makes it more applicable for use outside the Mozilla Foundation.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: True
Provides an explicit patent license: True
Can be used in closed source applications: True
Is a viral licence: False

Microsoft Public License (Ms-PL)

Used by Microsoft. Compiled derived code can be distributed, for both commercial and non-commercial use. The source code, however, cannot be redistributed

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: False
Provides an explicit patent license: True
Can be used in closed source applications: True
Is a viral licence: False

Mozilla Public License 1.1 (MPL 1.1)

Used by Mozilla and Firefox, among others. The patent clauses are not acceptable to some.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: True
Provides an explicit patent license: True
Can be used in closed source applications: True
Is a viral licence: False

Common Public License Version 1.0 (CPL)

Derived from the IBM Public License and influenced by the Mozilla Public License, and used by some Microsoft projects on SourceForge.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: True
Provides an explicit patent license: True
Can be used in closed source applications: True
Is a viral licence: False

Eclipse Public License 1.0

A newer version of the Common Public License that is in some cases more acceptable to business.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: True
Provides an explicit patent license: True
Can be used in closed source applications: True
Is a viral licence: False

The MIT License

A very old license with essentially no restrictions on the use of the code. It also provides very little in the way of protection for authors or users. It is the same as the BSD license without the 'no endorsement' clause.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: False
Provides an explicit patent license: False
Can be used in closed source applications: True
Is a viral licence: False

The BSD License

A very old license with essentially no restrictions on the use of the code. It also provides very little in the way of protection for authors or users. It is the same as the MIT license except that it includes a clause preventing the use of the author's name for endorsement.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: False
Provides an explicit patent license: False
Can be used in closed source applications: True
Is a viral licence: False

Apache License, Version 2.0

Slightly more restrictive (but still very open) version of the BSD or MIT license that adds patent clauses. Read carefully.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: False
Provides an explicit patent license: True
Can be used in closed source applications: True
Is a viral licence: False

Creative Commons Attribution-ShareAlike 2.5 License

A license that requires a link be visible on works that use this license. "Share alike" is what it sounds, you can share this work as long as that work has a license similar to this one.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: False
Provides an explicit patent license: False
Can be used in closed source applications: False
Is a viral licence: True

The zlib/libpng License

A license with an emphasis on freedom of use and re-use, with a few restrictions.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: False
Provides an explicit patent license: False
Can be used in closed source applications: True
Is a viral licence: False

GNU Lesser General Public License

A derivative of the GPL that was intended to allow non-GPL code to work with, and call GPL code. The author of this license asks that you only use this license if your are licensing functionality already commonly available.

Provides copyright protection: True
Can be used in commercial applications: True
Bug fixes / extensions must be released to the public domain: True
Provides an explicit patent license: False
Can be used in closed source applications: True
Is a viral licence: True

The GNU General Public License (GPL)

A common but misunderstood license. This allows developers to freely use the software as long as they use the same (or an even less restrictive) license for parts of the program that they wrote themselves. Viral in nature. Read carefully and make sure you understand the implications of using this license. Unacceptable to many.

Provides copyright protection: True
Can be used in commercial applications: False
Bug fixes / extensions must be released to the public domain: True
Provides an explicit patent license: False
Can be used in closed source applications: False
Is a viral licence: True


vs2005에서 Data breakpoint 사용하는 방법

vs2005에서 Data breakpoint 사용하는 방법


이럴때 : 특정 변수 또는 메모리가 변한 상태 --> 어떤 쉐리가 메모리를 밀었을때..!!! 좋음



일단 Data Breakpoint 는 Break 상태에서만 설정할 수 있구요.

1. 일단 변수를 감시하고자 하면 변수의 선언부 정도에다 Breakpoint 를 설정해둡니다.

    혹시 메모리 위치 자체를 감시하실 거라면 아무데나 적절히 거세요 = :)

2. Break 가 걸리면, 메뉴에서(단축키가 없는듯 ?) Debug > New Breakpoint > New Data Breakpoint 를 선택합니다.


3. Address 부분에다가 메모리 주소를 직접 적으시거나 &value 와 같이 변수의 주소를 설정해주시면 알아서 실제 메모리 주소로 치환되어 들어갑니다.

4. Byte Count 는 적절히 감시해야 하는 메모리의 크기를 설정해주시면 되구요.

5. Continue 해서 중단된 녀석을 실행해주면, 실행하다 메모리가 변경되면 냉큼 잡힙니다.

win32 platform에서는 확인 됨




 

확인 해볼 것

1. Smart Device 를 지원하는 확인 해볼 것



Tiny singleton helper class

Introduction

Sometimes we have to code with 'singleton'. If you don't know what Singleton is, you can read about it in many Design Pattern books. Singleton principle is really simple.

As you know, if you use reference pointer for singleton object, then you must delete it when program terminates. But it will be good because it does 'late instance'.

I want to terminate singleton object automatically, and instance lately. So, I coded this.

Good things:

  • Late instance.
  • Safe terminate automatically.
  • Separated code for Object and Singleton.

Here is my tiny singleton helper class - CSingletonT<>, and I hope it helps you.

//
// Using singletonT class
//
#include "SingletonT.h"
// test class
class CObj
{
protected:
    CObj(){ x = 0 ; TRACE("Created CObj\r\n"); }
public:
    virtual ~CObj(){ x = 0 ; TRACE("Deleted CObj\r\n");}
    int x;
};
// Testing
void CTestSingleTDlg::OnButton1()
{
    // TODO: Add your control notification handler code here
    // if first call, then singleton object will instance ( instance lately )
        CObj* o = CSingletonT<CObj>::GetObject();
    // use singletone object
    o->x ++;
    TRACE("o->x = %d\r\n",o->x);
}
------------------------------------------------------------------------------------
싱글톤에 조금은 벗어났지만,활용 할 수 있는 방법은 많다고 생각 됩니다.
원문을 보고 싶으시다면  아래로...
정확한 출처는 CodeProject 입니다.



http://www.codeproject.com/cpp/singlet.asp
우리 나라 분이 작성한 글입니다


[Dshow] DirectShow Filter Build시 발생하는 Link Error 해결방법
Some of the DirectShow samples break if you install Visual Studio 2005 Beta 2. Most of the errors that I found fall into three categories:
  • C4430: Missing type specifier. To conform with C++, undeclared types do not default to int. All types must be declared. Fix: Declare the type, or suppress the warning with the "/wd4430" flag.
  • C4996: ' xxxx' was declared deprecated. You may be including an older version of strsafe.h from the DirectX SDK or the Platform SDK. You should include the version installed with Visual Studio. (But it's probably harmless to ignore this warning.) 
  • C2065: 'xxx': undeclared identifier. To conform with C++, the scope of a variable declared inside a "for" loop is restricted to the loop. Fixes: (a) Move the declaration outside the for loop. (b) Redeclare the variable in multiple scopes, if you don't need it to persist outside the loop. (c) Set the /Zc:forScope flag. (You can find this under Project, Properties, Configuration Properties, C/C++, Language, Force Conformance In For Loop Scope. Set to "No".)

Here are the specific fixes that I made. Warning: I have not thoroughly tested these, and I only tried them under the "Windows XP 32-bit Debug" environment in Platform SDK. You should use your own judgment before making any of these fixes.

  • BaseClasses\ctlutil.h (278)  
       (LONG) operator=(LONG);
  • BaseClasses\wxdebug.cpp (564)
        static DWORD g_dwLastRefresh = 0;
  • BaseClasses\winutil.cpp (2092)
       UINT Count;
       for (Count = 0;Count < Result;Count++) {
  •  BaseClasses\outputq.cpp (635)
       long iDone = 0;
       for (iDone = 0;
  • Capture\AmCap\amcap.cpp (691)
        for(int i = 0; i < NUMELMS(gcap.rgpmAudioMenu); i++)
  • Capture\AmCap\amcap (2795)
        for(int i = 0; i < NUMELMS(gcap.rgpmAudioMenu); i++)
  • DMODemo\dsutil.cpp (686)
        DWORD i = 0;
        for( i=0; i<m_dwNumBuffers; i++ )
  • dmoimpl.h (622)   [In the Platform SDK headers]
        for (DWORD dw = 0; dw < NUMBEROFOUTPUTS; dw++) {
  • DMO\GargleDMO\MedParamBase\param.cpp (91)
        for (DWORD dwIndex = 0; dwIndex < cParams; dwIndex++)
  • DMO\GargleDMO\MedParamBase\param.cpp (309)
        CCurveItem *pCurve = NULL;
        for (pCurve = pCurveHead;
  • DMO\GargleDMO\gargle.cpp (145)
        for (DWORD i = 0; i < cOutputStreams && SUCCEEDED(hr); ++i)
  • Filters\Dump\dump.cpp (426)
        for (int Loop = 0;Loop < (DataLength % BYTES_PER_LINE);Loop++)
  • Filters\Gargle\gargle.cpp (212)
        static int m_nInstanceCount; // total instances
  • Filters\RGBFilters\RateSource\ratesource.cpp (382)
        for( int y = 0 ; y < DEFAULT_HEIGHT ; y++ )
  • Filters\RGBFilters\RateSource\ratesource.cpp (387)
        for( int y = 0 ; y < DEFAULT_WIDTH ; y++ )
  • VMR\VMRXclBasic and VMR\Ticker: LNK1181: cannot open input file 'dxguid.lib'. This was an error in the makefile. Change to read:
        DXLIB="$(DXSDK_DIR)\Lib\x86"  (currently says "x32")
  • VMR\VMRXcl and VMR\VMRMulti: C1083: Cannot open include file: 'd3dxmath.h': No such file or directory. This is an old DX header that is no longer included in DX or in Visual Studio. Unfortunately the only fix is to download an older version of the DirectX SDK.
  • VMR9\MultiVMR9\GamePlayer\character.cpp (383)
        DWORD i = 0;
        for (i = 0; i < pMeshContainer->NumInfl; ++i)
  • VMR9\MultiVMR9\DLL\MixerControl.h (28)
        static const DWORD MultiVMR9Mixer_DefaultFVF = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1;
  • VMR9\VMRAllocator: error LNK2019: unresolved external symbol "wchar_t * __stdcall _com_util::ConvertStringToBSTR(char const *)" (etc).  Add this to the makefile:

        comsuppw.lib \



간단한 Callback Function 예제
간단한 Callback 예제 C / C++

2007/07/28 08:35

복사 http://blog.naver.com/liezzang99/40329125

// TestCallbackFunction.cpp : Defines the entry point for the console application.
//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#define BOOL unsigned int
#define TRUE 1
#define FALSE 0

typedef BOOL (*RonieTest_Callback)( int nValue );

typedef struct
{
 int number;
 char *name;
 RonieTest_Callback bCount_CB;
} WmMyInfo;


BOOL fnConditionCallback_cb( int nValue )
{
 BOOL bRet = 0;
 if( 0 == (nValue % 2) )
 {
   bRet = 1;
 }
 return bRet;
}


WmMyInfo *TestLoopFunction( WmMyInfo *pInfo )
{
 while(1)
 {
  pInfo->number++;
  if( pInfo->number == 10 )
  {
   BOOL bRet = pInfo->bCount_CB( pInfo->number );
   if( bRet == TRUE )
   {
    pInfo->name = new char[5];
    memset( pInfo->name, 0, sizeof(char)*5 );
    strncpy( pInfo->name, "Even", strlen("Even") );
    return pInfo;
   }

   return  pInfo;
  }
 }
}


int main(int argc, _TCHAR* argv[])
{
 WmMyInfo *pMyInfo = new WmMyInfo;
 pMyInfo->number = 0;
 pMyInfo->bCount_CB = fnConditionCallback_cb;

 pMyInfo = TestLoopFunction( pMyInfo );

 printf( "Number : %s", pMyInfo->name );


 delete []pMyInfo->name;
 delete pMyInfo;

 return 0;
}



[P]중복된 Header 제거 하는 간단한 방법 중 하나는??

중복된 헤더 제거 하는 간단한 방법 중 하나는??

Test.h

#ifndef TEST_H
#define TEST_H

// 헤더 내용 기술


#endif



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


Code.h

#ifndef CODE_H

#define CODE_H

// 내용 기술



#endif


두 헤더에서 중복된 형태를 피 할 수 있습니다.

그럼 고운하루.



[펌]Tiny singleton helper class

Introduction

Sometimes we have to code with 'singleton'. If you don't know what Singleton is, you can read about it in many Design Pattern books. Singleton principle is really simple.

As you know, if you use reference pointer for singleton object, then you must delete it when program terminates. But it will be good because it does 'late instance'.

I want to terminate singleton object automatically, and instance lately. So, I coded this.

Good things:

  • Late instance.
  • Safe terminate automatically.
  • Separated code for Object and Singleton.

Here is my tiny singleton helper class - CSingletonT<>, and I hope it helps you.

//
// Using singletonT class
//
#include "SingletonT.h"
// test class
class CObj
{
protected:
    CObj(){ x = 0 ; TRACE("Created CObj\r\n"); }
public:
    virtual ~CObj(){ x = 0 ; TRACE("Deleted CObj\r\n");}
    int x;
};
// Testing
void CTestSingleTDlg::OnButton1()
{
    // TODO: Add your control notification handler code here
    // if first call, then singleton object will instance ( instance lately )
        CObj* o = CSingletonT<CObj>::GetObject();
    // use singletone object
    o->x ++;
    TRACE("o->x = %d\r\n",o->x);
}
------------------------------------------------------------------------------------
싱글톤에 조금은 벗어났지,활용 할 수 있는 방법은 많다고 생각 됩니다.
원문을 보고 싶으시다면  아래로...
http://www.codeproject.com/cpp/singlet.asp
우리 나라 분이 작성한 글입니다.


Bit 연산을 이용한 Flag 사용하기
윈도우에 보면 항상 윈도우 스타일을 설정 할때 | 를 이용하여 여러개의
bit값을 or를 하게 된다.

예를 들어 아래와 처럼 말이다.
WS_POPUP | WS_CHILD | WS_ ... 이런식으로 BIT OR 연산으로 플래그를 사용한다.
어떤 기능을 수행하는 함수를 만들때 여러가지 옵션에 따라서 수행 방법을 달리 하거나 할때 유용하다.
PlatForm API를 만들때 종종 사용이 된다. 위에서도 언급 했듯이 윈도우 스타일 ~ Popup 스타일등


그런 옵션을 만드는 방법은?

1. bool형 인자를 각각의 옵션 갯수대로 만든다.
   이것은 몇개 없을경우(1,2개 정도)에는 괜찮지만 많아 지면 각각의 옵션마다
   전부다 if를 해야하는 관계로 무척 복잡하다.
   초급용.


2. int형 하나를 만들어서 그 값을 if해서 1,2,3,4로 검출한다.
   이것은 하나의 변수로 여러 옵션을 만들 경우 유용하다.
   그러나 #define을 잘 쓰지 않으면 몇번이 어떤 옵션인지 헷갈린다.
   중급용.


3. dw형(DWORD) 윈도우 스타일 플래그를 만든다.
   반드시 #define과 함께 쓰고 비트 연산을 한다.
   무척 유용하다. 윈도우에서 자주 쓰는 스타일이다.
   고급용이다.


1,2 번은 대충 짐작을 할것이고 3번에 대해서 알아보자.
2번의 경우 각각을 if 하는데 어떤 기능인지 헷갈린다고 했다.
3번 같은 플래그는 일단. 기능별로 분리를 하고 #define을 해야한다.

#define FLAG_AAA 0x001
#define FLAG_BBB 0x002
#define FLAG_CCC 0x004
#define FLAG_DDD 0x008
#define FLAG_EEE 0x010

이런식으로 정의 한다.


우리가 함수에서 플래그를 넣을때
dwFlags = FLAG_AAA | FLAG_BBB | FLAG_CCC;
이렇게 넣었다고 가정해보자.

| 는 비트 OR이므로
FLAG_AAA = 00001
FLAG_BBB = 00010
FLAG_CCC = 00100

이렇게 된다. (이진수로)
다 합치면(OR)하면 00111이다.



그러면 그 인자를 받아서 detect해보는 작업을 하겠다.

if( FLAG_BBB & dwFlags )
이렇게 하면 이 값이 true가 된다.

왜냐?
비트 연산을 한번더 해보면
dwFlags는 이진수로 00111이고.
FLAG_BBB는 이진수로 00010이다.(0x002)
& (AND) 연산을 해보자.
AND는 둘다 1일때만 결과가 1이다.
00111
00010
-----
00010 이 결과이다.
이것은 0보다  큰 값이므로 true가 된다.

우리가 처음에 FLAG_AAA | FLAG_BBB | FLAG_CCC를 했으므로
if( FLAG_DDD & dwFlags )를 해보면..
00111
01000
----- &하면
00000

if의 결과는 false이다.

-0- 기억이 가물 가물한데 내가 썼던 글인가????


[Dshow] DirectShow SDK Filter Graph Editor
필요한 파일
-----------------------------------------------
   - 파일명: graphedt.exe
   - 정식명칭: DirectShow SDK Filter Graph Editor
-----------------------------------------------

그래프에디터는 SDK를 설치하지 않아도 동작합니다.
따라서 디버깅할 때 편리합니다.

system에 등록 하기 위해서는 아래와 같이 dll을 등록 해야 합니다.

* proppage.dll
regsvr32로 등록합니다.

실행 창에서
regsvr32.exe proppage.dll


[Dshow] 연결된 필터 이름 알아오기

관련 Site에서 간단하게 도움을 받아서 작성한 Function입니다.

* Wince에서 NullPlayer를 작성하여 OS에서 연결되는 Filter 정보를
확인하고자 하여 아래 함수를 작성하였습니다.

코드 :

HRESULT GetConnectFiltersName( IGraphBuilder *pGraph )
{
 IEnumFilters *pEnumFilter = NULL;
 HRESULT hr =  pGraph->EnumFilters( &pEnumFilter );
 IBaseFilter *pBaseFilter = NULL;
 FILTER_INFO stFilterInfo;

 while(  S_OK == pEnumFilter->Next( 1, &pBaseFilter, NULL ) )
 {
  pBaseFilter->QueryFilterInfo( &stFilterInfo );
  char sztmp[256];
  ::WideCharToMultiByte(CP_ACP, 0, stFilterInfo.achName, -1, sztmp, 256, NULL, NULL);
  ::printf( "%s\r\n", sztmp );
  pBaseFilter->Release();
 }

 pEnumFilter->Release();
 return S_OK;
}


그럼 고운하루 되세요




파일명, 라인정보를 보여주는 에러 메세지 박스 만들기
 #define 스크립트를 이용하면 쉽게 파일명과 줄번호가 출력되는 메세제 박스를
만들 수 있습니다..

아래 코드를 참조 하세요

코드:
#include <stdio.h>
#include <windows.h>
#include <stdarg.h>
void ShowMessage(const char* strFormat, ...)
{
static char strBuff[512];
va_list args;
va_start(args, strFormat);
vsprintf(strBuff, strFormat, args);
va_end(args);
MessageBox(0, strBuff, "Message", MB_ICONERROR);
}





#define SHOW_ERROR(Msg) {

ShowMessage("%s(%d) %s \n", __FILE__, __LINE__, Msg );
}











#define CHEAK_ERROR(Flg)
{
if (!Flg)
ShowMessage("%s(%d) %d \n", __FILE__, __LINE__, Flg );
}



int main()
{
char* pSzString = NULL;
CHEAK_ERROR(pSzString);
if (s == NULL)
{
SHOW_ERROR(" Error NULL Pointer Here");
}
return 0;
}


*  개인적으로는 Debug Level에 따라서 출력이 되도록 수정하는 것도 좋을 것 같습니다
    또한 가변인자를 활용하여 여러가지의 값을 가지도록 만들어 보아요~!


BLOG main image
취미생활
 Notice
 Category
분류 전체보기 (191)
매일매일갱생 (83)
서버개발 (1)
임베디드개발 (12)
Programming (80)
Personal Projects (6)
유용한 프로그램 (0)
 TAGS
개발자 C DVB 영어 이메일 미라지폰 출장 서태지 Algorithm spam mail english email warning Wince5.0 isdbt 군대 ISDB-T MP3 C++ DVB-T M480 Error Case 티스토리초대 DirectShow Java Dshow 1seg 티스토리 초대장 Brazil Windows Mobile6.0 English Linux 퇴사 알고리즘 VC++ project It Debug debugging 벨소리 변경 음식
 Calendar
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
 Recent Entries
 Recent Comments
 Recent Trackbacks
 Archive
 Link Site
zextor
괴짜 프로그래머의 일상사~@@
Gag & Peace, and more..
Kazakhstan Almaty.......
Min-A
Sadgarret
Steve Yoon's log
가슴 뛰는 삶을 살아라
오스틴 파워
GUI sin
melanie parker_Lady
제레미의 TV 2.0 이야기..
 Visitor Statistics
Total :
Today :
Yesterday :
rss