2011/07/28

[C#] Form 디자이너 클래스는 가장 먼저 선언 되어야 하네...

메인 폼의 클래스 위에 습관처럼 다른 클래스는 선언 하였다. 그리고 Form 디자인 창을 열었더니 아래와 같은 에러 메시지를 만났다.



"The class frmMain can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again."



C++에서의 습관으로 메인 클래스 위에 다른 작은 구조체나 클래스를 선언하여 사용하였는데 Windows Form을 사용하는 C# 프로그래밍에서는 Visual Studio에서 지원하는 디자이너를 사용하려면 그렇게 사용할 수가 없다. 좀 불편

Original Post : http://neodreamer-dev.tistory.com/558

[C#] 경로 요소 분리하기


C++ 에는 _splitpath 라는 멋진 함수가 있어서 전체 경로에서 구성 요소(드라이브, 패스, 파일명, 확장자)를 분리할 수 있었다.


C#에서 이용할 수 있는 함수가 있나 찾아 보았는데 함수는 없고 보다 많은 기능을 포함하고 있는 객체를 찾았다.


System.IO.Path 인데 이 녀석은 경로에 관련한 많은 기능을 담고 있다.






아래 코드는 MSDN에서 발췌해 온 예제 코드 이다.

public static void Main() 
{
string path1 = @"c: emp\MyTest.txt";
string path2 = @"c: emp\MyTest";
string path3 = @"temp";

if (Path.HasExtension(path1))
{
Console.WriteLine("{0} has an extension.", path1);
}

if (!Path.HasExtension(path2))
{
Console.WriteLine("{0} has no extension.", path2);
}

if (!Path.IsPathRooted(path3))
{
Console.WriteLine("The string {0} contains no root information.", path3);
}

Console.WriteLine("The full path of {0} is {1}.", path3, Path.GetFullPath(path3));
Console.WriteLine("{0} is the location for temporary files.", Path.GetTempPath());
Console.WriteLine("{0} is a file available for use.", Path.GetTempFileName());

/* This code produces output similar to the following:
* c: emp\MyTest.txt has an extension.
* c: emp\MyTest has no extension.
* The string temp contains no root information.
* The full path of temp is D:\Documents and Settings\cliffc\...\Debug emp.
* D:\Documents and Settings\cliffc\Local Settings\Temp...\ is the location for temporary files.
* D:\Documents and Settings\cliffc\Local Settings\Temp... temp3D.tmp is a file available for use.
*/
}



 

MSDN의 Path 클래스 설명 페이지 <

Original Post : http://neodreamer-dev.tistory.com/557

No symbols are loaded for any call stack frame... 에러

갑자기 "No symbols are loaded for any call stack frame. The source code cannot be displayed." 에러에 부딪쳤다. 작업한 것도 없는데...


인터넷을 찾아보니 Debug 설정을 변경하면 해결 할 수 있다고 한다. Debug 설정을 수정하는 것으로 봐서는 Debug 모드에서 발생하는 예외사항 같다.


설정 방법은 Debug 메뉴의  Exceptions 메뉴의 Managed Debugging Assistants 항목의 ContextSwitchDeadlock 항목을 설정 해제해 준다.




&

Original Post : http://neodreamer-dev.tistory.com/556

[C#] Drag&Drop 으로 파일 받기


특정 컨트롤에서 Drag&Drop 으로 파일을 받으려면 우선 해당 컨트롤의 AllowDrop 옵션을 True로 설정한다.


그리고 컨트롤의 DragOver 와 DragDrop 이벤트 핸들러를 작성한다.






아래 코드는 간단하게 구현 해본 Drag&Drop 이다.



private void lvFiles_DragOver(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.All;
}

private void lvFiles_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);

for (int i = 0; i < files.Count(); ++i)
{
lvFiles.Items.Add(files[i]);
}

string strMsg = files.Count().ToString() + " File(s) dropped!!";
MessageBox.Show(strMsg);
}

 <

Original Post : http://neodreamer-dev.tistory.com/555

OpenCV 2.3 32/64비트 분리 컴파일

OpenCV 2.3 버전을 컴파일 하는 방법은 앞서 작성한 글에서 기록한 방법과 차이가 없다.


2010/10/17 - [Dev Story] - OpenCV 2.1 + TBB 를 Visual Studio 2010 에서 컴파일하기


이번 글에서는 32비트와 64비트가 구분되도록 라이브러리를 만드는 것이다.

Visual Studio 2005 버전에서는 CMake 에서 만들어진 프로젝트 파일 중에서 *.vcproj 파일들(ALL_BUILD, INSTALL, PACKAGE 제외)에서 아래 파일들을 변경하고 컴파일 한다.



opencv_calib3d230.dll

opencv_calib3d230.lib

opencv_contrib230.dll

opencv_contrib230.lib

opencv_core230.dll

opencv_core230.lib

opencv_createsamples.exe

opencv_createsamples.lib

opencv_features2d230.dll

opencv_features2d230.lib

opencv_flann230.dll

opencv_flann230.lib

opencv_gpu230.dll

opencv_gpu230.lib

opencv_haartraining.exe

opencv_haartraining.lib

opencv_haartraining_engine.lib

opencv_highgui230.dll

opencv_highgui230.lib

opencv_imgproc230.dll

opencv_imgproc230.lib

opencv_legacy230.dll

opencv_legacy230.lib

opencv_ml230.dll

opencv_ml230.lib

opencv_objdetect230.dll

opencv_objdetect230.lib

opencv_ts230.dll

opencv_ts230.lib

opencv_video230.dll

opencv_video230.lib


본인의 경우 64비트 프로젝트는 각각의 파일명에  _x64를 붙였다.


Visual Studio 2010 버전의 경우 *.vcxproj 파일들 중에서 아래 사항을 변경한다. 



opencv_calib3d230</TargetName>

opencv_calib3d230.lib

opencv_contrib230</TargetName>

opencv_contrib230.lib

opencv_core230</TargetName>

opencv_core230.lib

opencv_createsamples</TargetName>

opencv_createsamples.lib

opencv_features2d230</TargetName>

opencv_features2d230.lib

opencv_flann230</TargetName>

opencv_flann230.lib

opencv_gpu230</TargetName>

opencv_gpu230.lib

opencv_haartraining</TargetName>

opencv_haartraining.lib

opencv_haartraining_engine</TargetName>

opencv_haartraining_engine.lib

opencv_highgui230</TargetName>

opencv_highgui230.lib

opencv_imgproc230</TargetName>

opencv_imgproc230.lib

opencv_legacy230</TargetName>

opencv_legacy230.lib

opencv_ml230</TargetName>

opencv_ml230.lib

opencv_objdetect230</TargetName>

opencv_objdetect230.lib

opencv_ts230</TargetName>

opencv_ts230.lib

opencv_video230</TargetName>

opencv_video230.lib


아래 파일목록은 생성된 파일들 이다.

opencv_calib3d230_x64.dll

opencv_contrib230_x64.dll

opencv_core230_x64.dll

opencv_features2d230_x64.dll

opencv_ffmpeg_64.dll

opencv_flann230_x64.dll

opencv_gpu230_x64.dll

opencv_highgui230_x64.dll

opencv_imgproc230_x64.dll

opencv_legacy230_x64.dll

opencv_ml230_x64.dll

opencv_objdetect230_x64.dll

opencv_ts230_x64.dll

opencv_video230_x64.dll



opencv_calib3d230_x64.lib

opencv_contrib230_x64.lib

opencv_core230_x64.lib

opencv_features2d230_x64.lib

opencv_flann230_x64.lib

opencv_gpu230_x64.lib

opencv_haartraining_engine_x64.lib

opencv_highgui230_x64.lib

opencv_imgproc230_x64.lib

opencv_legacy230_x64.lib

opencv_ml230_x64.lib

opencv_objdetect230_x64.lib

opencv_ts230_x64.lib

opencv_video230_x64.lib 

<

Original Post : http://neodreamer-dev.tistory.com/554

2011/07/27

Editplus에 C# 설정하기

C#을 잠깐 보면서 어는 서적이든 처음에 Console 프로그래밍에 대해서 언급을 하고 있는데 이 때문에 덩치큰 Visual Studio를 실행하는 것이 싫어 일반 편집기에서 하는 방법을 알아보았다. 물론 명령줄을 이용하면 되는데 조금 편리하게 사용하기 위해 편집기 옵션을 이용하였다.



Editplus 의  사용자 툴을 등록하고 사용하므로써 편하게 컴파일과 실행을 할 수 있다.

아래 두 툴 설정을 추가하면 된다.




Menu Text: C# Compile

Command: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe

Argument: $(FileName)

Initial Directory:  $(FileDir)





Menu Text: C# Run

Command: cmd

Argument: /c $(FileNameNoExt)

Initial Directory:  $(FileDir)




위와 같이 설정하면 다른 설정이 없을 경우 Ctrl + 1과 Ctrl + 2로 할당된다.

설정을 마치고 C# 파일을 생성하고 아래와 같은 코드를 입력하였다.

using System;

class MyCSharpApp
{
public static void Main()
{
Console.WriteLine("Hello! C# World");
}
}






코드를 작성하고 Ctrl + 1로 컴파일하고 Ctrl + 2로 실행을하면 간단한 C# 프로그램을 테스트할 수 있다.

<

Original Post : http://neodreamer-dev.tistory.com/553

2011/07/23

Eclipse 편집기 색상 Theme 모음 사이트

Visual Studio 의 편집기 글자색을 변경하다가 찾은 사이트 이다. 


Eclipse에 적용 할 수 있는 다양한 Theme를 모아 둔 사이트 인데 이 곳에서도 Obsidian 이 높은 순위에 랭크되어 있다. 요즘은 모든 개발툴에 Obsidian 계열을 색상을 적용하여 사용하고 있다.





http://www.eclipsecolorthemes.org

Original Post :
http://neodreamer-dev.tistory.com/552

2011/07/21

Visual Studio의 편집기 Color 설정을 입맛대로 골라쓰자!

Visual Studio의 Color 설정을 올려 놓고 사용자 편가를 받아 순위를 정하는 사이트(studiosyl.es)를 발견 했다.





기존에는 어두운 파란색 배경으로 사용하고 있었는데 이번에  에서 현재 1위로 올라와 있는 테마를 적용하였는데 상당히 맘에 든다.



이 사이트 에서는 각각의 색상표에 대하여 2005 버전 부터 2010 버전까지 지원을 하여 손쉽게 색상 설정을 사용할 수 있도록 하였다.


그리고 손 쉽게 Color 설정을 할 수 있는 기능 또한 제공하고 있어 자신만의 설정을 만들어 볼 수 있다.



Studio Styles - Visual Studio color schemes
Original Post : http://neodreamer-dev.tistory.com/551

2011/07/07

OpenCV 2.3 Superpack for Windows

이번에 OpenCV 2.3 버전이 공개되면서 함께 공개 된 SuperPack 이 있다. 윈도우즈용만 있으며 이 SuperPack 에는 다양한 Platform 과 컴파일러를 지원하는 동적, 정적라이브러리와 DLL 파일들이 포함 되어 있다.


아래는 SuperPack 이 갖고 있는 디렉토리 구조이다.

 


예전에는 OpenCV 새 버전이 나오면 컴파일러와 Platform에 맞는 라이브러리와 DLL 을 만드느나 고생을 하여야 했지만 이번 버전에는 대부분이 이 Superpack 에 포함되어 있다. 


아쉬운 점은 현재 Visual Studio 2005 버전을 사용하고 있는데 이 버전에 대한 파일들이 포함되어 있지 않은 것이다. 그래도 다행인 것은 vc9 버전의 파일로 테스트를 하고 있는데 기본 기능에는 문제가 없어 보인다. 좀 더 확인을 해 보아야 겠지만...&

Original Post : http://neodreamer-dev.tistory.com/550

2011/07/05

OpenCV 2.3 Released!!

얼마전 RC 꼬리표들 달고 공개 되었던 OpenCV가 금새 꼬리표를 떼었다.



2.3 정식 버전에서 달라진 사항


  • A few more bugs reported in the OpenCV bug tracker have been fixed.

  • Documentation has been improved a lot! The new reference manual combines information for C++ and C interfaces, the OpenCV 1.x-style Python bindings and the new C++-style Python bindings. It has also been thoroughly checked for grammar, style and completeness. Besides, there are new and updated tutorials.

    The up-to-date online documentation is available at http://opencv.itseez.com.

  • [Windows] The new binary package includes various pre-compiled libs:

    https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3/ Unfortunately, it's not a full-scale installation package, but simply a self-extracting archive with a readme.txt supplied. The installation package is probably to come in the next version.

  • [Windows] VS2005 should builds OpenCV 2.3 out of the box, including DirectShow support.

  • [Windows] ffmpeg bindings are now available for all Windows users via compiler- and configuration- and version-independent opencv_ffmpeg.dll (for 32-bit compilers) and opencv_ffmpeg_64.dll (for 64-bit compilers).







OpenCV Project


OpenCV Change Logs&

Original Post : http://neodreamer-dev.tistory.com/549