IT 취미생활.  
Front Page
Tag | Location | Media | Guestbook | Admin   
 
'Programming'에 해당하는 글(80)
2008.12.12   error C2787: 'IContextMenu' : no GUID has been associated with this object
2008.12.12   [링크]지적 호기심 없는 20대 노인들
2008.12.12   코드 읽기
2008.12.03   [DshowFilter] PC based Dshow building시 Error
2008.12.03   [DshowFilter]"IQualityControl::Notify not over-ridden from CBasePin. (IGNORE is OK)"
2008.11.29   NetBeans을 이용하여 Hello World작성
2008.11.27   Java 개발 환경 구축하기 2
2008.11.13   warning C4013: 'xxxxxxxxxxxx' undefined; assuming extern returning int
2008.10.18   [알고리즘] Insertion Sort(삽입정렬)
2008.10.17   [알고리즘] Priority Queue (우선 순위큐)
2008.10.17   [알고리즘] Selection Sort


error C2787: 'IContextMenu' : no GUID has been associated with this object
아래와 같은 문제로 인해서 문제가 발생 됩니다.
문제 해결 방법은 2가지가 있습니다.


1. 원론적 문제 해결 방법

------------------------------------------------------------------------------
>I am building a shell extn. project in .net ide which is
>converted from vC++ 6.00.
>
>During buid i am getting the following error
>"error C2787: 'IContextMenu' : no GUID has been associated
>with this object", The same project works fine in VC++6.0.
>
>I have included the following files also
>#include <shlguid.h>
>#include <shobjidl.h>
>#include <shlobj.h>
>
>any help will be appreciated

This is interesting. There are two <comdef.h> header files in VC.NET, one in
Vc7/include and the other in Vc7/PlatformSDK/include. The former splits off
the smart pointer typedefs into comdefsp.h, and it doesn't include
IContextMenu. The latter does. You can try to #include the PlatformSDK
header directly, change your INCLUDE path order, or supply the missing
typedef yourself, e.g.

struct __declspec(uuid("000214e4-0000-0000-c000-000000000046"))
IContextMenu;

_COM_SMARTPTR_TYPEDEF(IContextMenu, __uuidof(IContextMenu));

--
Doug Harrison
Microsoft MVP - Visual C++
------------------------------------------------------------------------------


2. 더 간단한 방법은...

------------------------------------------------------------------------------
The response is for people that find this thread by searching for the same error.

Just define at the top of the stdafx.h file above your includes:
#define _ATL_NO_UUIDOF
------------------------------------------------------------------------------


[링크]지적 호기심 없는 20대 노인들
점점 지적 호기심이 없어지는 개발자들....
놀랍게도 많은 분들이 ~ 보수적인 생각으로 새로운것을 받아 드리는데 거부감을 가지고
있다는 기사 내용이다.

한번쯤은 읽어 볼만한 글이 아닐까 생각 됩니다.




http://www.zdnet.co.kr/itbiz/column/anchor/hsryu/0,39030308,10061549,00.htm





P.s 독일 프랑크프르트에서,.....


코드 읽기
내가 만든 프로그램이 아니면 관심을 가지고 본적이 없었던 것 같습니다.
다른 사람에 코드를 읽는다는 것은 나쁜?짓 처럼 느껴졌기 때문이죠.

아마 대딩 시절 자료구조나 알고리즘 시간에
각 개인의 평가의 요소로 "과제를 언제까지 제출 했냐?"가 큰 몫을 했다 생각 합니다.

만약 이랬다면 얼마나 좋았을까요....
-----------------------------------------------------------------------
알고리즘이나 자료구조 시간에 주어지는 과제는  그룹 단위로 나눠 제출 하도록
하였다면 좋겠다라는 생각 해봅니다.
  • 문제 해결을 위한 방법 고찰
  • 구현 및 효율성

또한 위에 사항에 대해서 고려하고, 과제가 끝난 시점에서
다른 그룹간에 의견 교환이 활발하게 이루어졌으면.....

"시간이 너무 오래 걸릴 것 같다." 라지만
대딩 시절 방황하고 술 마시는 시간을 조금 줄인다면 충분하지 않을까 생각 합니다.
-----------------------------------------------------------------------

지금이라도 대학 학부생 시절로 돌아 갈 수 있다면 팀이나 그룹 단위로 무엇인가?를 해 볼
뜨거운 열정이 생기네요T..T



* 코드리딩에 중요성을 원문입니다.
신입 개발자를 위한 조언
코드 리딩(reading)의 중요성( http://www.jiniya.net/tt/609  )
신영진, codewiz@gmail.com, http://www.jiniya.net



[DshowFilter] PC based Dshow building시 Error


PC 상에서 Dshow 관련 Build시 아래와 같은  Build Error 를 찾아 볼 수 있는데
해결 방법으로 두가지가 있습니다.




>C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(222) : error C2146: syntax error :

missing ';' before identifier 'PVOID64'
1>C:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\winnt.h(222) : error C4430: missing type

specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\winnt.h(5940) : error C2146: syntax error :

missing ';' before identifier 'Buffer'
1>C:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\winnt.h(5940) : error C4430: missing type

specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\winnt.h(5940) : error C4430: missing type


첫번째 해결 방법
-----------
Wiknnt.h안에 포함하고 있는 매크를 아래와 같이 수정 합니다.
 
원본 :
typedef void *PVOID;
typedef void *POINTER_64 PVOID64;


수정 본:
#define POINTER_64 __ptr64
typedef void *PVOID;
typedef void *POINTER_64 PVOID64;


두번째 해결 방법
가장 최신의  platform SDk를 설치 하는 것입니다.



[DshowFilter]"IQualityControl::Notify not over-ridden from CBasePin. (IGNORE is OK)"
Runtime시 아래와 같은 메시리를 뿜으며 대화상자가 뜬다.

"IQualityControl::Notify not over-ridden from CBasePin. (IGNORE is OK)"
At line 2346 of C:\DXSDK\Samples\C++\DirectShow\BaseClasses\amfilter.cpp
Continue? (Cancel to debug)


해결방법 :
이 에러 메시는 런타임시 필터 그래프에서 출력이 된다.
그래서 위 에러를 위해 CBasePin을 상속 받은 Class에서
아래와 같이 코드를 추가 하였다.

STDMETHODIMP Notify(IBaseFilter *pSelf,Quality q ) { return S_OK; }

음 잘 동작한다....


NetBeans을 이용하여 Hello World작성

1. create new project in netbeans

사용자 삽입 이미지



2. Select Project
사용자 삽입 이미지



3. Name and Location
사용자 삽입 이미지

간단한 콘솔 어플리 케이션이 작성이 되었습니다.

코드를 간단하게 source code를 살펴보면 아래와 같은 형태로 되어져 있습니다.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package helloworld;

/**
 *
 * @author roniek
 */
public class HelloWorld
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        System.out.println( "Hello World" );
    }
}


java 독학을 위해 NetBeans를 통해 처음 작성해본 Java Console Application입니다.
이제 할 일들은 java와 c++의 다른 점에 익숙해져야 한다는 것입니다.
native와 java를 모두 다룰줄 안다면 정말 즐거울 것 같습니다.


Java 개발 환경 구축하기
감기가 걸린 오늘 보일러를 크게 틀어놓고, Java 개발환경을 설치 해보고 있다.
Java를 이용해서 이런 저런 프로그램을 해보면 재미 있겠다 생각이 들었다.
특별한 이유는 없다. 지적욕구랄까?



1. Java SDK Download : http://java.sun.com/javase/downloads/index.jsp
    - Java SE Development Kit (JDK) 6 Update xx :를 다운 후 설치
    - Java SE Runtime Environment (JRE) 6 Update xx :를 다운후 설치
    - tools
      + JDK 6 Update 10 with NetBeans (IDE) tool

2. 환경 변수 등록 
    - path에 맨끝에 %JAVA_HOME%\bin 등록
    - JAVA_HOME - c:\program Files\java\jdk1.6.0_10(jdk 버젼에 따라 달라짐)
    - CLASSPATH - ,;%JAVA_HOME%lib\tools.jar
 




warning C4013: 'xxxxxxxxxxxx' undefined; assuming extern returning int
warning C4013: 'xxxxxxxxxxxx' undefined; assuming extern returning int


Error Case 는 아니지만  Warning이 기분이 나빠서 찾아봤습니다.
왜 그럴까?

개발하고 있는 project는 방송용  Middleware로   팀에서 개발할 정도의
규모입니다. 최근 renewal을 하고 있는터라 이것 저것 정리 하다 보니

Header파일이 빠져 있어서 발생한 문제였습니다.
함수는 내부적으로  extern 키워드로 선언이 된 녀석들이라서
실제  Error는 나지 않았습니다.

Header 를 include 시켜주니 문제가 사라졌습니다.


[알고리즘] Insertion Sort(삽입정렬)
간단하게 작성한 삽입 정렬입니다.


간단하게 원리를 설명드리면, 배열에 index는 1에서 부터 시작해서(1 <= x < N ) N까지
정렬을 합니다.  index한 녀석을 집어 넣을 위치를 찾는 것입니다.

코드는 따로 설명 드리지 않겠습니다.

void InsertSort( int *_arrayBuffer, int _bufferSize )
{
  for( int i = 1; i < _bufferSize; i++ )
  {
    int insertionValue= _arrayBuffer[ i ];
    int nInsertPosition = i;
    while( _arrayBuffer[nInsertPosition-1] > insertionValue && nInsertPosition > 0 )
    {
      _arrayBuffer[nInsertPosition ] = _arrayBuffer[ nInsertPosition - 1 ];
      nInsertPosition--;
    }
    _arrayBuffer[ nInsertPosition ] = insertionValue;
  }
}

배열안에 값들이 정렬이 이루어져 있으면 N 에 대한 성능을 가질 수 있다고 하는군요.

그럼 고운하루 되세요.



[알고리즘] Priority Queue (우선 순위큐)

Project에 적용하기 위해서 작성한 Heap을 기반으로한 Priority Queue Class 입니다.
MultiThread-Safe 하긴한데 performance가 따라 줄지는 모르겟습니다.
성능 개선을 위한 부분 있다면 언제든지 코멘트 부탁 드립니다 ㅜㅜ;;;;

딱 보면 아시겠지만, 생각하는 프로그래머에 Code를 그대로 옮겨 놓은 듯 합니다.
^0^ 그럼 고운하루 되세요.

template< class T >
class CPriQueue
{
private:
 int m_nCurIndex, m_nMaxsize;
 CRITICAL_SECTION m_cs;
 T *m_pTemplateArray;

 void swap( int i, int j )
 {  
  T t = m_pTemplateArray[i];
  m_pTemplateArray[i] = m_pTemplateArray[j];
  m_pTemplateArray[j] = t;
 }

public:
 CPriQueue()
 {
  m_pTemplateArray = NULL;
  InitializeCriticalSection( &m_cs );
 }

 ~CPriQueue()
 {
  FlushQueue();
  delete []m_pTemplateArray;
  DeleteCriticalSection( &m_cs );
  m_pTemplateArray = NULL;
 }

 void SetQueueSize( unsigned int QueueSize )
 {
  if( QueueSize <= 0 )
   QueueSize = 1;

  m_pTemplateArray = new T[ QueueSize +1 ];
  if( m_pTemplateArray )
  {
   m_nMaxsize = QueueSize;
   m_nCurIndex = 0;
  }
 }

 void Push( T t )
 {
  if( m_nCurIndex >= m_nMaxsize   )
  {
   FlushQueue();
   printf("******FULL Queue ******* ");
   return;
  }

  int nParentIndex;
  EnterCriticalSection( &m_cs );
  m_pTemplateArray[ ++m_nCurIndex ] = t;


  if(  m_nCurIndex >  1 && m_pTemplateArray[ nParentIndex = m_nCurIndex >> 1  ] > m_pTemplateArray[m_nCurIndex] )
  { 
   for ( int nCurrentIndex = m_nCurIndex;
    nCurrentIndex > 1 && m_pTemplateArray[ nParentIndex = nCurrentIndex >> 1  ] > m_pTemplateArray[nCurrentIndex];
    nCurrentIndex = nParentIndex )
   {
    swap( nParentIndex, nCurrentIndex );
   }
  }
  LeaveCriticalSection( &m_cs );
 }


 T Pop()
 {
  if ( m_nCurIndex == 0 )
  {
   return 0;
  }

  int nChild = 0;
  EnterCriticalSection( &m_cs );
  T  t = m_pTemplateArray[ 1 ];
  m_pTemplateArray[ 1 ] = m_pTemplateArray[ m_nCurIndex-- ];

  for(  int i = 1; ( nChild =  i << 1 ) <= m_nCurIndex ; i = nChild )
  {
   if( nChild + 1 <= m_nCurIndex && m_pTemplateArray[ nChild + 1 ] < m_pTemplateArray[ nChild ] )
   {
    nChild++;
   }

   if( m_pTemplateArray[ i ] <= m_pTemplateArray[ nChild ]  )
   {
    break;
   }
   swap( nChild, i );
  }
  LeaveCriticalSection( &m_cs);
  return t;
 }
 
 void FlushQueue()
 {
  UINT nfreameCount = 0;
  T tFrame  = NULL;
  while( tFrame = Pop() )
  {
   delete tFrame;
   tFrame  = NULL;
   nfreameCount++;
  }
  m_nCurIndex = 0;
  printf("******Flush Queue *******  :: %d \n", nfreameCount );
 }
};



[알고리즘] Selection Sort

프로그래밍 불여일타!!의 프로젝트의 일환으로, 퇴근후 배깔고 하는 알고리즘 공부를 시작!!
그 결과물로 간단 간단한 알고리즘을 작성하고, Blog에 올리기로 했습니다.

오늘은 간단하게 Selection Sort를 만들어 보았습니다.

* 원리는 : 총 1...n개의 정렬 되지 않은 요소에서, 첫번째 놈을 가져다가 가장 작은 값을
              가진다라 가정 하고  나머지 n-1개와 비교를 하게 합니다. 그래서 그중 가장
              작은 녀석을 기억 하고 있다가, 1번째 자리와 바꿉니다. 그리고 index을 하나 더
              증가 해서 두번째 요소를 가지고  n-2 만큼 loop를 돌아서 다시 최소값을 찾고
              바꿔 줍니다. 이렇게 반복하면 정렬이 됩니다.( 사실 그림으로 보면 아무것도
              아닙니다. 그림은 귀찮아서 안그렸습니다.)

* 성능 :  O(N^2)

* 코드

void swap( int *a, int *b )
{
     int dump = *a;
     *a = *b;
     *b = dump;
}

void SelectionSort( int *_arrayBuffer, const unsigned int _arraySize )
{
     for( int i = 0; i < _arraySize; i++ )
     {
          int nMinIndex = i;
          for( int j = i + 1; j < _arraySize; j++ )
          {
               if( _arrayBuffer[j] < _arrayBuffer[nMinIndex] )
               {
                   nMinIndex = j;
               }
          }
          swap( _arrayBuffer[nMinIndex], _arrayBuffer[ i ] );
      }  
}


BLOG main image
취미생활
 Notice
 Category
분류 전체보기 (191)
매일매일갱생 (83)
서버개발 (1)
임베디드개발 (12)
Programming (80)
Personal Projects (6)
유용한 프로그램 (0)
 TAGS
영어 이메일 Dshow 퇴사 project MP3 출장 벨소리 변경 English M480 DVB VC++ Debug Java Brazil Windows Mobile6.0 1seg 알고리즘 warning DVB-T 음식 Algorithm DirectShow english email ISDB-T 개발자 spam mail 티스토리초대 debugging It Error Case Wince5.0 미라지폰 isdbt 군대 티스토리 초대장 서태지 C Linux C++
 Calendar
«   2024/05   »
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