2011/10/25

[MFC] CDialogEx

Visual Studio 2010 버전에서 대화상자를 만들다. 2010 버전에서는 기본적으로 CDialogEx를 상속받아 대화상자를 만드는 것을 보았다.



MFC 9.0 부터 지원하고있는 CDialogEx라는 녀석을 찾아 보았다. 기본제공하는 클래스라 MSDN에서 쉽게 찾을 수 있었다.

CDiglogEx는 CDialog에서 배경을 제어하는 함수만 추가된 클래스였다. 추가된 함수는 아래 두 개이다.

// Control Background color
void SetBackgroundColor(
COLORREF color,
BOOL bRepaint=TRUE
);

// Control Background Image
void SetBackgroundImage(
HBITMAP hBitmap,
BackgroundLocation location=BACKGR_TILE,
BOOL bAutoDestroy=TRUE,
BOOL bRepaint=TRUE
);
BOOL SetBackgroundImage(
UINT uiBmpResId,
BackgroundLocation location=BACKGR_TILE,
BOOL bRepaint=TRUE
);




SetBackgroundColor 는 배경색을 설정하는 것으로 원하는 색상을 파라메터로 넘기면 쉽게 대화상자의 배경색을 변경할 수 있다. 기본 제공하는 클래스 에서는 체크박스와의 사소한 버그가 있다고 한다.


SetBackgroundImage 는 비트맵 객체나 비트맵 리소스로 배경 채워 준다.

채우는 방법은 기본 적으로 타일(BACKGR_TILE)형태로 하며 몇 가지 형태(BACKGR_TILE, BACKGR_TOPLEFT, BACKGR_TOPRIGHT, BACKGR_BOTTOMLEFT, BACKGR_BOTTOMRIGHT)로 설정할 수 있다.


배경색 변경의 사소한 버그도 있고 배경이미지를 컨트롤 하는 것에도 유연성이 많이 부족해 보인다. 제대로 배경을 설정하고자 한다면 다시 만들어야 할 듯 하다.


CDialogEx on MSDN 

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

[SVN] Can't find a temporary directory: Internal error



바로 어제 저녁에 SVN에 커밋한 프로젝트를 업데이트 받으려 했는데 위 이미지 처럼 Can't find a temporary directory: Internal error 에 마주쳤다.별다른 작업을 한 것도 없는데 황당항 메시지 였다.

요즘 CVN 클라이언트인 TortoiseSVN을 1.7.1 버전으로 업데이트하여 발생한 문제처럼 보였는데 인터넷에 찾아보니 임시 디렉토리 문제라 하는데 메세지로는 임시 디렉토리를 못 찾았다는 건데...


난 시스템을 설치하고 임시 디릭토리를 항상 운영체제와 다른 드라이브에 설정을 한다. 경로는 한글이나 공백이 포함되면 못 찾을 수 있을까봐 아주 간단하게 설정을 한다.


에러 해결책을 찾아보니 대부분 리눅스 기반에서 권한 문제나 더 이상 쓸 공간이 없을 때 발생하여 권한 또는 여유 공간을 확보해 주면 되는데 난 윈도우 기반이라 이에 해당하지 않았다.


그래서 대략 5GB 사용중이던 임시 디렉토리를 청소를 하고 다시 시도해 보니 프로젝트를 정상적으로 업데이트를 하였다. 해결된 이유가 임시 디렉토리를 정리해서 인지 임시 디렉토리를 접근해서 인지는 모르겠으나 자꾸만 TortoiseSVN 1.7.1 버전의 버그라는 생각을 지울 수

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

2011/10/24

CPU Core수 확인 함수

[출처] Parallel Programming, OpenMP 그리고 Win32 - 1



현재 시스템의 Core 수를 확인하는 코드이다. 관련 정보를 찾았었는데 김 명신님 블로그에서 찾을 수 있었다.

아래 코드는 김 명신님 블로그에서 발췌한 것으로 nullptr 부분을 NULL로 바꾸기만 하였다.

#include <Windows.h>
#include <process.h>

int GetNumberOfCores()
{
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION pProcessorInformations = NULL;
DWORD length = 0;

BOOL result = GetLogicalProcessorInformation(pProcessorInformations, &length);
if (!result)
{
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
pProcessorInformations = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)new BYTE[length];
}
}

result = GetLogicalProcessorInformation(pProcessorInformations, &length);
if (!result)
{
// error
return -1;
}

int numOfCores = 0;
for (int i = 0 ; i < length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) ; i++)
{
if (pProcessorInformations[i].Relationship == RelationProcessorCore)
numOfCores++;
}

delete [] pProcessorInformations;

return numOfCores;
}





<

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

TortoiseSVN 1.7.1 Released

불과 얼마전 1.7버전을 공개 했었는데 또 다시 1.7.1 버전을 공개하였다. 이번 버전에서는 많은 버그가 수정되었다고 한다.



Version 1.7.1 에서 버그 수정 사항

- BUG: Issue #88: Check for modifications on

       multiple targets. (Stefan)

- BUG: Issue #89: Crash in TSVNCache. (Stefan)

- BUG: Cursor stayed as busy after an operation

       until it was moved. (Stefan)

- BUG: Issue #92 : checked item count in 

       commit dialog is wrong. (Stefan)

- BUG: Issue #94: resolve conflict dialog

       resizing issues. (Stefan)

- BUG: Issue #95: docs are wrong for log

       filter automation. (Stefan)

- BUG: Missing space in property status

       text. (Stefan)

- BUG: Issue #96: Unable to close repo browser

       to repository with username/password

       required. (Stefan)

- BUG: Issue #97: Too many accesses to the

       config files. (Stefan)

- BUG: Issue #98: Endless loop in

       repobrowser. (Stefan)

- BUG: Issue #100: wrong argument exception

       in repobrowser. (Stefan)

- BUG: Issue #99: Memory corruption in

       repository browser. (Stefan)

- BUG: Issue #102: renamed diff scripts. (Stefan)

- BUG: Issue #102: tagging externals errors

       not shown. (Stefan)

- BUG: Issue #104: tagging externals for

       files pegs to HEAD. (Stefan)

- BUG: Issue #105: Win7 library loses

       command buttons. (Stefan)

- BUG: Issue #106: "Search for:" string is

       trimmed forcibly in TortoiseMerge. (Stefan)

- BUG: Issue #107: Crash when editing

       externals property. (Stefan)

- BUG: Issue #108: log dialog uses wrong

       file if sorted. (Stefan)

- BUG: Issue #109: Log dialog does not

       refresh correctly. (Stefan)

- BUG: Issue #110: Bogus entries in

       Language Combo on x64. (Stefan)


TortoiseSVN <

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

2011/10/19

구글 Android Ice Cream Sandwich(ICS) 발표

구글이 미뤄두었던 Ice Cream Sandwich 발표를 오늘 하였다.



YouTube로 실황 중계를 좀 봤는데 영어가 딸려 다 이해하지는 못했지만 많이 좋아진 것 같아 보였다. 잠깐 본 것으로는 카메라 SW 기능이 많이 좋아졌고 파노라마도 지원하기 되었다. 메일과 캘린더도 강화되고 무엇보다 두 기기간의 데이터 공유기능을 보았다. 기기의 뒷 면을 대는 것 만으로 자료를 공유할 수 있었다.

이제 좀 쓸만한 안드로이드 스마트 폰이 나올 것 같다.



오늘 ICS를 발표와 동시에 SDK도 함께 공개를 하였다.



ICS and the New Nexus

Android 4.0 Platform and Updated SDK Tools

&

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

OpenCV 2.3.1 Release

OpenCV 가 2.3 정식 버전을 공개한 후 바로 2.3.1 버전을 공개 하였다.

실제로 공개한 것은 지난 8월인데 프로젝트 페이지에서 소스 파일 패키지가 보이지 않아 윈도우용은 아직 발표하지 않을 줄 알았다. 그러다 Windows Superpack을 확인해 보니 그 안에 모든 것을 포함하고 있었다.

배포 정책이 바뀐듯 하다. 이전 버전은 Superpack 이외에 소스만 따라 배포를 하였는데 이번에는 모든것을 하나의 파일로 배포하고 있다.



다음은 2.3.1 버전에서 변경된 사항으로 프로젝트 사이트에서 발췌 하였다.




Android port


OpenCV Java bindings for Android platform are released in Beta 2 quality. A lot of work is done to make them more stable and easier to use. Currently Java API has about 700 different OpenCV functions and covers 8 OpenCV modules including full port of features2d. See OpenCV for Android release notes for detailed information about Android-specific changes made for this release.


And follow the instructions from Android page for getting started with OpenCV for Android.




Other New Functionality and Features


  • Retina module has been contributed by Alexandre Benoit (in opencv_contrib module). See the new retina sample and https://sites.google.com/site/benoitalexandrevision/.

  • Support for Ximea cameras (http://www.ximea.com/) in HighGUI has been contributed by Ximea developers.

  • Planar subdivisions construction (Delaunay triangulation and Voronoi tesselation) have been ported to C++. See the new delaunay2.cpp sample.

  • Several new Python samples have been added.

  • FLANN in OpenCV has been upgraded to v1.6. Also, added Python bindings for FLANN.

  • We now support the latest FFMPEG (0.8.x) that features multi-threaded decoding. Reading videos in OpenCV has never been that fast.
    Documentation





Documentation


Quite a few new tutorials have been added. Check http://opencv.itseez.com/trunk for the up-to-date documentation.




Optimization


Performance of the sparse Lucas-Kanade optical flow has been greatly improved. On 4-core machine it is now 9x faster than the previous version.




Bug Fixes


Over 100 issues have been resolved since 2.3 release. Most of the issues (closed and still open) are listed at https://code.ros.org/trac/opencv/report/6.




Known Problems/Limitations


TBD





OpenCV Project website

OpenCV 2.3.1 Download page

Download OpenCV-2.3.1-win-superpack.exe

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

2011/10/17

CStdioFile::WriteString 의 함정

텍스트 파일 저장에 편하여 사용하는 CStdioFile 클래스의 WriteString에서 꼭 알아야할 사항이 있다.

뭐 나만 모르고 있는 것 일 수도 있지만...  CStdioFile::WriteString 은 널 문자를 쓰지 않고 Line feed(\n) 문자를 Carriage Return(\r) 과 Line Feed(\n) 짝을 이뤄 파일에 저장을 한다.



따라서 다섯개의 "\r\n"을 출력하면 아래 처럼 Carriage Return이 하나 더 붙어서 출력이 된다. 아래 내용을 읽어들인 프로그램은 Notepad2로 이 파일을 Mac 형식으로 인식해서 보여준다.



이렇게 작성한 파일은 나중에 메모장에서 Word Wrap 기능사용시 문제를 일으키기도 하는 것 같다.

CStdioFile::WriteString를 사용할 때는 여느 파일 작성때와 같이 버릇처럼 줄넘김을 윈도우 기본 형태인 \r\n 형태로 출력하면 안되겠다.



아마 처음 CStdioFile::WriteString 함수를 접할 때 MSDN을 한번만 이라도 주위깊게 읽었더라면 쉽게 알고 있을만한 사항이다.



MSDN 에서 CStdioFile::WriteString 함수에 대한 Remark 부분에 아래와 같은 설명이 되어 있다.

The terminating null character ('\0') is not written to the file. Any newline character in lpsz is written to the file as a carriage return–linefeed pair.

 



CStdioFile::WriteString on MSDN



+ 2011/10/19

이 문제는 CStdioFile::WriteString 함수만의 문제가 아니였다. 기본적으로 C 에서의 파일(FILE) 입출력 할 때 텍스트 모드로 할 경우 자동으로 변경 되는 것이다. MSDN에서 찾아보면 텍스트 모드에 대해서 아래와 같은 설명이 있었다.

in text mode, carriage return?linefeed combinations are translated into single linefeeds on input, and linefeed characters are translated to carriage return?linefeed combinations on output.


fopen on MSDN


&

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

AnkhSVN 2.3.10481 released

Visual Studio SVN Plug-in 인 AnkhSVN이 SubVersion 1.7 Release에 맞추어 업데이트 버전을 공개 하였다.



AnkhSVN 2.3.10481 버전 변경 사항


  • Subversion 1.7 support

  • Support for the Visual Studio 11 Developer Preview




2.1 버전에서 2.3으로 바로 건너 뛰었다. 2.2 개발 버전이 있어서 인지 메인 잇슈인 SubVersion 1.7 지원과 Visual Studio 11 버전을 지원하는 기능을 추가하고 2.3으로 건너 뛴 것 같다. 


AnkhSV

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

TortoiseSVN 1.7 Release



SVN Client 인 TortoiseSVN 이 1.7 버전을 공개하였다. 이번 버전에서는 많은 변화가 있었다.

아래 리스트는 1.7 버전에서 변경된 사항이다. 


  • Working copy metadata storage improvements

  • x64 Installer

  • Property dialogs

  • Windows 7 Library

  • Log dialog

  • Revision graph

  • Branch/Tag dialog

  • Commit dialog

  • Repository browser

  • Sparse checkouts

  • TortoiseMerge

  • Compatibility concerns





많은 것들이 바뀌었지만 대부분 UI나 이전과 크게 다르지 않은 것이지만 그 중 관심있게 보아야 할 것이 첫 번째 항목인 Working copy metadata storage improvements 이다. Client 쪽의 메타 데이터 저장 시스템이 변경되어 이전 버전의 클라언트로 받은 소스들과 호환이 되지 않는다. 실제 1.6 버전에서 받은 소스들은 탐색기 상에서 Overay 아이콘이 표시가 되지 않는다. 이러한 프로젝트폴더에서 마우스 오른쪽 버튼을 누르면 Context 메뉴에 "SVN Upgrade working copy" 라는 메뉴가 보여지며 1.7버전으로 업그레이드를 하면 더이상 하위 버전의 클라이언트로는 해당 소스를 관리할 수 없게 된다. 사이트에서는 업그레이드 보다는 새롭게 프로젝트를 받는 것을 권장하기 때문에 업그레이드 전 소스 정리를 해 두는 것이 좋다.


TortoiseSVN

TortoiseSVN 1.7 Release Note&

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

Subversion 1.7.0 Released



SubVersion 이 1.7 버전을 공개하였다.

아주 오래간만에 웹페이지를 찾아가 보았는데 프로젝트 홈페이지가 Apache 프로젝트(http://subversion.apache.org/)로 이전을 하였다. 기록을 찾아 보이 이전한 것이 2009년도 인 것 같은데 아주 오랫동안 방문을 하지 않았나 보다.



1.7 버전에서 바뀐 내용.


  • Working Copy Metadata Storage Improvements

  • New remote dumpfile tool: svnrdump

  • Improved HTTP protocol usage

  • New feature: svn patch

  • Many enhancements and bug fixes

  • Known issues in the release

  • Dependency, license and distribution changes




지원하는 프로토콜도 바뀌고 클라이언트의 메타데이터도 싹 바뀌었다 한다. 자세한 내용은 Release Note를 읽어봐야 겠다.





Apache Subversion Project

Apache Subversion 1.7 Release Notes 

&

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

2011/10/16

[C#] WPF에서 Client Area 설정하기

WPF를 처음 하면서 디자인 한 결과가 실행 한 화면과 다소 다른 것에 고민하다 XAML 의 최상위 Tag인 Window 안쪽에 처음 있는 Grid의 크기를 지정하고 Window Tag에 SizeToContent 속성을 WidthAndHeight로 변경을 하게 되면 고정된 크기의 Client Area 영역을 가지는 프로그램을 만들 수 있다.

<Window x:Class="MyFirstWPFApp.wndTestDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="wndTestDialog" SizeToContent="WidthAndHeight">
<Grid Height="300" Width="300"></Grid>
</Window>



&

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

Visual Studio 2010 WPF 디자인 문제

Visual Studio 2010 에서 WPF Application을 디자인 함에 있어 문제가 있어 보인다.

VS2010 버전에서 WPF 프로그램을 작성할 때 디자인을 윈도우 크기를 고정해서 디자인할 때 문제가 되는 것 같다.

Visual Studio 2010 에서 디자인 한 윈도우

Visual Studio 2010 에서 디자인 한 윈도우

실제 실행 한 윈도우

실제 실행 한 윈도우




위 이미지는 윈도우 크기를 300x300 으로 설정하고 디자인하고 실행한 화면이다. 디자인 한 것과 실제 실행한 프로그램과의 모양이 약간 다르다.


Expression Blend 와 여러가지로 비교해 보았는데 WPF 를 디자인 하는데 있어 윈도우 테마 스타일을 간과한 것 같다. 윈도우 크기를 300x300으로 설정하면 윈도우 형태를 일반으로 설정하든 Tool 윈도우로 설정하든 윈도우 테두리에 대한 감안이 안되고 일정한 Client Area를 기준으로 디자인 되는 것으로 보인다.


Expression Blend 에서는 디자인 타임에 컨트롤을 오른쪽 끝이나 아래쪽 끝으로 가져갈 경우 HorizontalAlignment나 VerticalAlignment이 자동으로 변경이 되어 실제 윈도우에서는 윈도우 크기에 따라 해당 컨트롤들이 알아서 배치가 되는데 Visual Studio 에서는 그렇지 않은 것 같다. 그렇다고 해서 Expression Blend에서 Fixed size 윈도우를 디자인 하는데 있어 문제가 없는 것은 아닌 것 같다. Margin을 설정한 컴포넌트넌트들은 위치 문제에서 자유로울 수 없어 보인다.


Form 프로그래밍에서의 Form 디자인 에서는 이러한 문제가 없어 보인다. WPF 에도 문제가 없게 하려면 윈도우의 Client Area를 제어할 수 있어야 할 것 같은데 방법을 모르겠다.


아직 WPF를 공부하는데 많은 시간을 투자하지 않아 모르는게 많은 것 같다.&

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

2011/10/14

C#에서 SQLite 사용하기

C#에 대해서 잘 알지는 못하고 요즘 조금 관심을 두고 있는데 C#의 데이터베이스 관련하여 모르는 상태에서 SQLite 의 예제와 관련 정보를 찾아 SQLite를 연결하여 테스트 해 보았다.



우선 C#에서 SQLite를 사용하려면 아래 사이트를 통해 개발 환경에 맞는 파일을 다운 받아야 한다.

System.Data.SQLite Download Page 



내려받은 파일들 중 System.Data.SQLite.dll 와 System.Data.SQLite.Linq.dll 을 Add Reference... 를 통해 추가한다. 테스트에 사용한 코드는 아래와 같다.

string strQuery;

textResult.Text = "Begin...\n";

SQLiteConnectionStringBuilder SQLiteConString
= new SQLiteConnectionStringBuilder();
SQLiteConString.DataSource = "test.db";

SQLiteConnection SQLite3Con
= new SQLiteConnection(SQLiteConString.ToString());
SQLite3Con.Open();

bool bPrevStepSuccess = false;

textResult.AppendText(" Try to connect with test.db ...");
if (SQLite3Con.State == ConnectionState.Open)
{
textResult.AppendText("OK\n");

// 테이블 생성
strQuery = "CREATE TABLE IF NOT EXISTS TestTable ("
+ " name VARCHAR(20)"
+ " ,age int"
+ " ,country VARCHAR(20)"
+ ")";

SQLiteCommand SQLite3Cmd = SQLite3Con.CreateCommand();
SQLite3Cmd.CommandText = strQuery;
try
{
SQLite3Cmd.ExecuteNonQuery();
textResult.AppendText(" Test Table Create ... OK\n");

bPrevStepSuccess = true;
}
catch (System.Data.SQLite.SQLiteException ex)
{
int nResult = SQLite3Con.ResultCode();
textResult.AppendText(" Test Table Create ... FAIL, Error Msg : "
+ ex.Message + "\n");

bPrevStepSuccess = false;
}

if (bPrevStepSuccess)
{
// Insert
textResult.AppendText(" Inserting ...\n");
strQuery = "INSERT INTO TestTable (name, age, country) VALUES (?,?,?);";

SQLite3Cmd.CommandText = strQuery;
SQLiteParameter paramName = SQLite3Cmd.CreateParameter();
SQLite3Cmd.Parameters.Add(paramName);
SQLiteParameter paramAge = SQLite3Cmd.CreateParameter();
SQLite3Cmd.Parameters.Add(paramAge);
SQLiteParameter paramCountry = SQLite3Cmd.CreateParameter();
SQLite3Cmd.Parameters.Add(paramCountry);

for (int i = 0; i < 10; ++i)
{
paramName.Value = "Name " + i.ToString();
paramAge.Value = 20 + i;
paramCountry.Value = "None";

int InsertRow = SQLite3Cmd.ExecuteNonQuery();

if (InsertRow == 1)
{
textResult.AppendText(" Insert ... OK\n");
}
else
{
textResult.AppendText(" Insert ... FAIL\n");
}
}

strQuery = "SELECT COUNT(*) FROM TestTable;";

SQLite3Cmd.Parameters.Clear();
SQLite3Cmd.CommandText = strQuery;

using (SQLiteDataReader SQLite3Reader = SQLite3Cmd.ExecuteReader())
{
if (SQLite3Reader.Read())
{
string strRow = " Row Count ... "
+ SQLite3Reader.GetValue(0).ToString() + "\n";

textResult.AppendText(strRow);
}
}

// Selecting
textResult.AppendText(" Selecting ...\n");
strQuery = "SELECT * FROM TestTable;";

SQLite3Cmd.Parameters.Clear();
SQLite3Cmd.CommandText = strQuery;

using (SQLiteDataReader SQLite3Reader = SQLite3Cmd.ExecuteReader())
{
while (SQLite3Reader.Read())
{
string strRow = " "
+ SQLite3Reader.GetValue(0).ToString() + " "
+ SQLite3Reader.GetValue(1).ToString() + " "
+ SQLite3Reader.GetValue(2).ToString()
+ "\n";

textResult.AppendText(strRow);
}
}

// Updating...
textResult.AppendText(" Updating ...\n");
strQuery = "UPDATE TestTable SET country=@country WHERE age<@age;";
SQLite3Cmd.CommandText = strQuery;

paramCountry.ParameterName = "@country";
paramCountry.Value = "KOREA";
SQLite3Cmd.Parameters.Add(paramCountry);

paramAge.ParameterName = "@age";
paramAge.Value = 25;
SQLite3Cmd.Parameters.Add(paramAge);

int nUpdated = SQLite3Cmd.ExecuteNonQuery();

string strMsg = " Updated Row(s) Count ... "
+ nUpdated.ToString() + "\n";
textResult.AppendText(strMsg);

// Deleting...
textResult.AppendText(" Deleting ...\n");
strQuery = "DELETE FROM TestTable WHERE age < @age;";

SQLite3Cmd.Parameters.Clear();
SQLite3Cmd.CommandText = strQuery;

paramAge.ParameterName = "@age";
paramAge.Value = 25;
SQLite3Cmd.Parameters.Add(paramAge);

int nDeleted = SQLite3Cmd.ExecuteNonQuery();

strMsg = " Deleted Row(s) Count ... "
+ nDeleted.ToString() + "\n";
textResult.AppendText(strMsg);

// Drop Table
strQuery = "DROP TABLE IF EXISTS TestTable;";

SQLite3Cmd.Parameters.Clear();
SQLite3Cmd.CommandText = strQuery;

SQLite3Cmd.ExecuteNonQuery();
textResult.AppendText(" Test Table dropped ... OK\n");
}
}
else
{
textResult.AppendText("FAIL\n");
}

SQLite3Con.Close();
textResult.AppendText("Finish.");





C#은 C++ 에서의 방법과 많이 다른 것 같다. 효과적으로 사용하기 위해서는 C#의 데이터베이스에 대한 공부가 필요할 것 같다.&

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

2011/10/13

Firebird 2.5.1 Release

Firebird 데이터베이스의 새 버전이 공개 되었다. 이번 버전은 2.5 버전의 마이너 업그레이드 버전으로 버그픽스와 성능 개선이 이루어 졌다고 한다.



Firebird 2.5.1 버전의 개선 사항


  • The SQLSTATE code has been made available as a PSQL context variable, for use in WHEN .. exception blocks, in the same manner as GDSCODE and SQLCODE

  • Now it is possible to write to global temporary tables in a read-only database

  • Diagnostics for internal trace errors were improved

  • The fbtracemgr utility will now do a periodic flush to output

  • Performance of gbak restore at the data insertion stages has improved

  • Conversions between BLOBs and other data types can now be effected in the API functions

  • The Services API now supports the “metadata-only” restore

  • A “silent install” switch has been implemented for make install on POSIX

  • The unused bytes of VARCHAR values in the message buffer are now set to zero

  • The actual record compression ratio is now estimated in the optimizer

  • The MON$STATEMENT_ID value now stays constant among monitoring snapshots

  • The SO_KEEPALIVE option on the client TCP socket will now be set, as a measure to guard against aggressive timing out of sockets by newer Windows systems

  • Lock Manager can now cancel waits that become interminable

  • A platform port of v.2.5.1 for HPPA has been done for both Linux and Alpha




Firebird websit

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

2011/10/12

SQLite3 3.7.8 Libraries for Visual C++ & C++ Builder

amalgamation 소스를 이용한 의 라이브러리를 만드는 방법으로 라이브러리를 만들었다. 기존의 전체 소스를 이용하여 만드는 것 보다 많이 쉬웠다.

2011/10/12 - [Dev Story] - SQLite3 dll 과 정적 라이브러리(Static Library) 만들기

2011/10/12 - [Dev Story/Tips] - C++ Builder 를 위한 SQLite3 라이브러리 만들기



각각의 라이브러리는 오래전 올린 테스트 코드를 이용하는데 문제가 없었다.

2009/03/23 - [Dev Story/Mess] - SQLite 테스트...

2009/03/23 - [Dev Story/Mess] - SQLite 64비트에서 테스트...





<

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

C++ Builder 를 위한 SQLite3 라이브러리 만들기

C++ Builder를 위한 SQLite3 라이브러리 생성은 그리 어렵지 않다. 이전에 올린 글에서도 언급을 하였는데 amalgamation 소스를 이용하면 작업이 쉽다.

2011/10/12 - [Dev Story] - SQLite3 dll 과 정적 라이브러리(Static Library) 만들기


동적 라이브러리는 SQLite 사이트에서 배포하는 DLL을 사용하면 되며 필요한 .lib 파일은 아래 명령을 통해서 만들 수 있다.

implib -a sqlite3.lib sqlite3.dll



정적 라이브러리의 경우 amalgamation 소스를 이용하여 만든다. 

먼저 Static Library 프로젝트를 만든다.



적당한 이름으로 프로젝트를 정리하고 프로젝트에 amalgamation 소스파일 3개(sqlite3.c, sqlite3.h, sqlite3ext.h)을 추가 한다.


그리고 프로젝트의 Conditional defines의 Base에 아래와 같이 3개의 Conditional을 추가한다.

SQLITE_ENABLE_FTS3

SQLITE_ENABLE_RTREE

SQLITE_ENABLE_COLUMN_METADATA



이제 빌드만 하면 정적 라이브러리를 얻을 수 있다.

기존의 전체 소스로 컴파일 하는 것에 비하면 상당히 단순화 된 작업이다.

이렇게 만들어진 라이브러리에 대해서는 이전에 올린 테스트 코드에서 이상없이 동작을 하였다. <

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

SQLite3 dll 과 정적 라이브러리(Static Library) 만들기

예전 글에서는 Dll 은 amalgamation 소스를 이용하고 정적 라이브러리는 전체 소스를 가지고 만드는 방법을 기록하였는데 이번에는 두가지 모두 amalgamation 소스를 이용하는 방법으로 하여 보았다. 이 방법을 이용할 경우 작업이 무척 간단하고 ICU 모듈 없이도 라이브러리를 만들 수 있다.



일단 Dll 을 만드는 방법은 예전 글(2009/12/09 - [Dev Story/Tips] - SQLite3.dll 만들기 (Win32 & x64 with VC++ 2005))에도 설명을 하였지만 다시금 간단하게 요약을 하면 Win32 Application 을 "SQLite3"란 이름으로 만들고 Wizard 화면에서 아래와 같이 Type을 DLL, Additional options에서 Empty project를 체크하고 프로젝트를 만든다.

SQLite3.dll 프로젝트 속성

SQLite3.dll 프로젝트 속성



프로젝트에 sqlite-amalgamation-xxxxxxxx.zip 파일에 있는 sqlite3.c, sqlite3.h, sqlite3ext.h 파일을 프로젝트에 포함시켜 준다. 그리고 Preprocessor Definitions에 아래 세가지를 입력한다.

SQLITE_ENABLE_FTS3

SQLITE_ENABLE_RTREE

SQLITE_ENABLE_COLUMN_METADATA





마지막으로 sqlite-dll-win32-x86-
xxxxxxxx.zip 파일에 포함되어 있는 sqlite3.def 파일을 프로젝트에 속성에 추가 시켜준다.

sqlite3.def 지정 화면

sqlite3.def 지정 화면



이제 빌드만 해 주면 .dll 파일과 .lib 파일을 얻을 수 있다. 필요에 따라 x64 platform 을 추가 구성하면 64비트용 파일들을 얻을 수 있다.



다음으로 정적 라이브러리를 만드는 방법이다. 기존 방법과는 다르고 DLL 파일을 만드는 것과 유사하다.

우선 Win32 Application을 SQLite3Static 이란 이름으로 type을 Static library, Additional options에서 Precompiled header를 선택 해제하고 프로젝트를 생성한다.



DLL 만드는 경우와 같이 프로젝트에 sqlite-amalgamation-xxxxxxxx.zip 파일에 있는 sqlite3.c, sqlite3.h, sqlite3ext.h 파일을 프로젝트에 포함시켜 준다. 그리고 Preprocessor Definitions에 아래 세가지를 입력한다.

SQLITE_ENABLE_FTS3

SQLITE_ENABLE_RTREE

SQLITE_ENABLE_COLUMN_METADATA



이제 빌드만 하면 정적 라이브러리를 만들 수 있다. 역시 x64 platform 을 추가 구성하면 64비트용 파일들을 얻을 수 있다. 그리고 각각의 
x64 platform 과 Configuration에 맞게 정적 라이브러리 이름을 지정하면 쉽게 구분할 수 있다.

본인의 경우 아래와 같이 이름을 지정하였다.


x86용

Debug: SQLite3Static32D.lib 

Release: SQLite3Static32.lib 

x64용

Debug: SQLite3Static64D.lib 

Release: SQLite3Static64.lib 



위의 작업은 Visual Studio 2005에서 작업을 하였으며 정적 라이브러리의 경우 Visual Studio 2010 버전으로 테스트해

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

2011/10/11

.Net 을 위한 SQLite 라이브러리

언제부터 인지는 모르겠지만 오래전 부터 SQLite 사이트에서 .Net을 위한 코드와 바이너리를 제공하고 있었다. 그런데 이번 3.7.8버전 공개로 다시 찾은 사이트에서는 보다 다양한 버전을 제공하고 있다.

다양한 버전을 제공하고 있어 특별한 경우가 아니고서는 컴파일을 할 필요 없이 일반적으로 제공하는 것을 다운받아 사용하면 될 것 같다.


아래 항목은 System.Data.SQLite 페이지에서 제공하는 것 들이다.

Source Code

Setups for 32-bit Windows (.NET Framework 3.5 SP1)

Setups for 64-bit Windows (.NET Framework 3.5 SP1)

Setups for 32-bit Windows (.NET Framework 4.0)

Setups for 64-bit Windows (.NET Framework 4.0)

Precompiled Binaries for 32-bit Windows (.NET Framework 3.5 SP1)

Precompiled Binaries for 64-bit Windows (.NET Framework 3.5 SP1)

Precompiled Binaries for 32-bit Windows (.NET Framework 4.0)

Precompiled Binaries for 64-bit Windows (.NET Framework 4.0)

Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 3.5 SP1)

Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 3.5 SP1)

Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 4.0)

Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.0)

Precompiled Binaries for Windows CE (.NET Compact Framework 3.5)


System.Data.SQLit

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

SQLite Release 3.7.8

SQLite 3.7.8 (2011/09/19)


  • Orders of magnitude performance improvement for CREATE INDEX on very large tables.

  • Improved the windows VFS to better defend against interference from anti-virus software.

  • Improved query plan optimization when the DISTINCT keyword is present.

  • Allow more system calls to be overridden in the unix VFS - to provide better support for chromium sandboxes.

  • Increase the default size of a lookahead cache line from 100 to 128 bytes.

  • Enhancements to the test_quota.c module so that it can track preexisting files.

  • Bug fix: Virtual tables now handle IS NOT NULL constraints correctly.

  • Bug fixes: Correctly handle nested correlated subqueries used with indices in a WHERE clause.

  • SQLITE_SOURCE_ID: "2011-09-19 14:49:19 3e0da808d2f5b4d12046e05980ca04578f581177"

  • SHA1 for sqlite3.c: bfcd74a655636b592c5dba6d0d5729c0f8e3b4de




SQLite homepage&

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

[C#] WPF App의 System Menu에 사용자 메뉴 추가하기

C#의 WPF Application 에서 System 메뉴에 사용자 메뉴를 추가하는 방법이다. 이 방법은 Add System Menu Items to WPF Window using Win32 API에서 알게된 방법으로 Form Application과 다소 다르다. Win32 API를 사용하는 것은 동일하게 보이나 메세지를 핸들링하는 부분이 다른 것 같다.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Runtime.InteropServices;
using System.Windows.Interop;

// For Custom menu on System menu
//using System;
//using System.Windows;
//using System.Runtime.InteropServices;
//using System.Windows.Interop;

namespace MyWPFApp
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
#region Win32 API Stuff
// Define the Win32 API methods we are going to use
[DllImport("user32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);

[DllImport("user32.dll")]
private static extern bool InsertMenu(IntPtr hMenu, Int32 wPosition,
Int32 wFlags, Int32 wIDNewItem, string lpNewItem);

/// Define our Constants we will use
public const Int32 WM_SYSCOMMAND = 0x112;
public const Int32 MF_SEPARATOR = 0x800;
public const Int32 MF_BYPOSITION = 0x400;
public const Int32 MF_STRING = 0x000;
#endregion

// The constants we'll use to identify our custom system menu items
public const Int32 _SettingsSysMenuID = 1000;
public const Int32 _AboutSysMenuID = 1001;

/// <summary>
/// This is the Win32 Interop Handle for this Window
/// </summary>
public IntPtr Handle
{
get
{
return new WindowInteropHelper(this).Handle;
}
}

public MainWindow()
{
InitializeComponent();

/// 아래 코드는 필요 없어 보임. 이벤트 핸들러가 아닌
/// 임의의 함수를 할당할 때 필요한 것으로 보임
//this.Loaded += new RoutedEventHandler(wndMain_Loaded);
}

private void wndMain_Loaded(object sender, RoutedEventArgs e)
{
/// Get the Handle for the Forms System Menu
IntPtr systemMenuHandle = GetSystemMenu(this.Handle, false);

/// Create our new System Menu items just before the Close menu item
// Add a menu seperator
InsertMenu(systemMenuHandle, 5, MF_BYPOSITION | MF_SEPARATOR,
0, string.Empty);
// Add Setting Menu
InsertMenu(systemMenuHandle, 6, MF_BYPOSITION,
_SettingsSysMenuID, "Settings...");
// Add About Menu
InsertMenu(systemMenuHandle, 7, MF_BYPOSITION,
_AboutSysMenuID, "About...");

// Attach our WndProc handler to this Window
HwndSource source = HwndSource.FromHwnd(this.Handle);
source.AddHook(new HwndSourceHook(WndProc));
}

private static IntPtr WndProc(IntPtr hwnd, int msg,
IntPtr wParam, IntPtr lParam, ref bool handled)
{
// Check if a System Command has been executed
if (msg == WM_SYSCOMMAND)
{
/// Execute the appropriate code for
/// the System Menu item that was clicked
switch (wParam.ToInt32())
{
case _SettingsSysMenuID:
MessageBox.Show("\"Settings\" was clicked");
handled = true;
break;
case _AboutSysMenuID:
MessageBox.Show("\"About\" was clicked");
handled = true;
break;
}
}

return IntPtr.Zero;
}
}
}



실행 결과 화면

실행 결과 화면

&n

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

[C#] Form App 의 System Menu에 사용자 메뉴 추가하기

C#의 Windows Form Application에서 System 메뉴에 사용자 메뉴를 추가하는 방법이다. 인터넷을 통해 알게된 방법으로 Add System Menu Items to a Form using Windows API 글을 보고 알게 되었다. C# 에서의 Win32 API 사용과 메세지 핸들링에 대한 지식을 알고 있어야 겠다. C++에서는 API 사용이 쉬웠는데 그 C#에서는 다소 복잡해 보인다.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

// For Custom System Menu
// using System;
// using System.Windows.Forms;
// using System.Runtime.InteropServices;

namespace MyFormApp
{
public partial class frmMain : Form
{
#region Win32 API Stuff
// Define the Win32 API methods we are going to use
[DllImport("user32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);

[DllImport("user32.dll")]
private static extern bool InsertMenu(IntPtr hMenu, Int32 wPosition,
Int32 wFlags, Int32 wIDNewItem, string lpNewItem);

/// Define our Constants we will use
public const Int32 WM_SYSCOMMAND = 0x112;
public const Int32 MF_SEPARATOR = 0x800;
public const Int32 MF_BYPOSITION = 0x400;
public const Int32 MF_STRING = 0x000;
#endregion

// The constants we'll use to identify our custom system menu items
public const Int32 _SettingsSysMenuID = 1000;
public const Int32 _AboutSysMenuID = 1001;

public frmMain()
{
InitializeComponent();
}

private void frmMain_Load(object sender, EventArgs e)
{
/// Get the Handle for the Forms System Menu
IntPtr systemMenuHandle = GetSystemMenu(this.Handle, false);

/// Create our new System Menu items just before the Close menu item
// Add a menu seperator
InsertMenu(systemMenuHandle, 5, MF_BYPOSITION | MF_SEPARATOR,
0, string.Empty);
// Add Settings Menu
InsertMenu(systemMenuHandle, 6, MF_BYPOSITION,
_SettingsSysMenuID, "Settings...");
// Add About Menu
InsertMenu(systemMenuHandle, 7, MF_BYPOSITION,
_AboutSysMenuID, "About...");
}

protected override void WndProc(ref Message m)
{
// Check if a System Command has been executed
if (m.Msg == WM_SYSCOMMAND)
{
/// Execute the appropriate code for
/// the System Menu item that was clicked
switch (m.WParam.ToInt32())
{
case _SettingsSysMenuID:
MessageBox.Show("\"Settings\" was clicked");
break;
case _AboutSysMenuID:
MessageBox.Show("\"About\" was clicked");
break;
}
}

base.WndProc(ref m);
}
}
}



실행 결과 화면

실행 결과 화면

<

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

2011/10/10

한영 전환을 편하게 - jwShiftSpacekey

아주 오래전에는 한영 전환을 Shift + Space 사용했었는데 언제부터인가 한영키를 이용하게 되었다.

하지만 한영키는 때때로 많은 불편함을 가져와서 예전 방식의 Shift + Space 를 사용하기위해 윈도우의 키보드 종류를 Type 3으로 하였었다. 이러한 방법은 여럿이 사용하는 곳에는 할 수 없는 방법인데 오늘 아주 유용한 프로그램을 만났다.


jwShiftSpacekey 는 어떤 키보드 타입에서건 Shift + Space 입력을 받아 한영 전환을 해 주는 아주 작은 프로그램 이다.


이 프로그램을 사용하면 아주 간단하게 Shift + Space 로 한영 전환을 할 수 있다. 하지만 오래전에 사용하던 기능키라서인지 세벌식으로 전환한 지금에는 예전 두벌식 버릇을 생각나게해 오타를 치게도 한다.




jwShiftSpaceKey 한영 전환을 편하게


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

Google Reader를 위한 Chrome 확장 프로그램 - Super Full Feeds for Google Reader™

RSS Reader로 구글 리더를 사용하는데 전체 공개를 하진 않는 글들을 쉽게 볼 수 있는 확장 프로그램을 찾았다.


이 확장 프로그램을 설치를 하면 각각의 글 제목 우측에 세개의 메뉴가 보여지게 된다.



Readable, Link 그리고 Feed 이다.

기본 뷰 형태가 Feed 메뉴이고 Readable 은 포스크의 본문에 대한 전체 글을 가져와 보여준다.



그리고 Link 메뉴는 해당 글을 포함하고 있는 사이트 전체를 보여준다.



Super Full Feeds for Google Reader™는 구글 리더 안에서 모든 포스트를 볼 수 있게 해주는 아주 유용한 확장 프로그램이다.




Super Full Feeds for Google Reader

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

2011/10/07

함수 이름 가져오는 매크로

흥배님의 블로그를 통해 함수 이름을 가져오는 매크로인 __FUNCTION__, __FUNCSIG__ 에 대해 알게되어 이와 유사한 매크로가 더 있는 찾아 보았다.



MSDN 에서 Predefined Macros 로 찾으니 쉽게 찾아 졌다.

흥배님께서 언급한 두 개의 매크로 외에 __FUNCDNAME__ 라는 녀석도 있었다. 이들의 쓰인 결과를 보면 어떤 역할을 하는 매크로 인지 쉽게 알 수 있다.



아래 코드는 MSDN에서 발췌한 코드 이다. MSDN의 Predefined Macros 페이지에 보다 다양한 매크로에 대해 설명 하고 있다.

// Demonstrates functionality of __FUNCTION__, __FUNCDNAME__, and __FUNCSIG__ macros
void exampleFunction()
{
printf("Function name: %s\n", __FUNCTION__);
printf("Decorated function name: %s\n", __FUNCDNAME__);
printf("Function signature: %s\n", __FUNCSIG__);

// Sample Output
// -------------------------------------------------
// Function name: exampleFunction
// Decorated function name: ?exampleFunction@@YAXXZ
// Function signature: void __cdecl exampleFunction(void)
}

 



Predefined Macros on MSD

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

2011/10/05

디스크, 파티션 복제하기 - Macrium Reflect Free



디스크나 파티션을 복제할 때 유용한 프로그램이다.


Snoopy 님의 블로그에서 알게된 프로그램으로 친절하게도 사용법에 대하여 자세한 설명도 있다.


간혹 하드디스크를 교체해야할 때 고민을 하게되는 것이 기존 HDD의 내용을 그대로 사용할 수 없을까 하는 것인데 Macrium Reflect 프로그램이 고민을 해결해 줄 수 있을 것 같다. 


Macrium Reflec

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

2011/10/02

[Direct2D] MFC에서 간단한 사용 예

Direct2D 에 대해서는 오래전에 들어 보았지만 오늘에서야 관련 정보를 찾아 보았다.

그리고 간단한게 사용해 봤다.



MSDN 에서 찾은 것으로 간단하게 사각형을 그리는 코드 이다. 이 코드는 Windows 7 x64 에서 Visual Studio 2010 SP1 버전에서 작성되고 테스트 하였다.


Direct2D 기능을 사용하려면 Windows 7 또는 Vista SP2 이상이어야 해서 범용 프로그램 제작에 이용하는 것은 이른것 같지만 알아두면 앞으로 사용할 일이 있을 것 같다. 상세한 것들은 차차 익혀가야 겠다.



////////////////////////////////////////////////////////////////////////////////
// stdafx.h
// Direct2D
#include <d2d1.h>
#pragma comment(lib, "D2D1.lib")

template<class Interface>
inline void SafeRelease(
Interface **ppInterfaceToRelease
)
{
if (*ppInterfaceToRelease != NULL)
{
(*ppInterfaceToRelease)->Release();

(*ppInterfaceToRelease) = NULL;
}
}

#ifndef Assert
#if defined( DEBUG ) || defined( _DEBUG )
#define Assert(b) do {if (!(b)) {OutputDebugStringA("Assert: " #b "\n");}} while(0)
#else
#define Assert(b)
#endif //DEBUG || _DEBUG
#endif

#ifndef HINST_THISCOMPONENT
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
#endif

////////////////////////////////////////////////////////////////////////////////
// ChildView.h
ID2D1Factory* m_pD2DFactory;

////////////////////////////////////////////////////////////////////////////////
// ChildView.cpp
CChildView::CChildView()
{
// Initialize Direct2D
m_pD2DFactory = NULL;
HRESULT hr = D2D1CreateFactory(
D2D1_FACTORY_TYPE_SINGLE_THREADED,
&m_pD2DFactory
);
}

CChildView::~CChildView()
{
// Release Direct2D
SafeRelease( &m_pD2DFactory );
}

void CChildView::OnPaint()
{
CPaintDC dc(this); // device context for painting

Render();

// Do not call CWnd::OnPaint() for painting messages
}

int CChildView::Render()
{
if ( m_pD2DFactory == NULL )
{
return -1;
}

// Obtain the size of the drawing area.
CRect rcClient;
GetClientRect(&rcClient);

// Create a Direct2D render target
ID2D1HwndRenderTarget* pRT = NULL;
HRESULT hr = m_pD2DFactory->CreateHwndRenderTarget(
D2D1::RenderTargetProperties(),
D2D1::HwndRenderTargetProperties(
GetSafeHwnd(),
D2D1::SizeU( rcClient.Width(), rcClient.Height() )),
&pRT
);

ID2D1SolidColorBrush* pBlackBrush = NULL;
pRT->CreateSolidColorBrush(
D2D1::ColorF(D2D1::ColorF::Blue),
&pBlackBrush
);

// Begin Drawing
pRT->BeginDraw();

pRT->Clear(D2D1::ColorF(D2D1::ColorF::White));

pRT->DrawRectangle(
D2D1::RectF(
rcClient.left + 100.0f,
rcClient.top + 100.0f,
rcClient.right - 100.0f,
rcClient.bottom - 100.0f),
pBlackBrush
);

// End Drawing
HRESULT hrDraw = pRT->EndDraw();

SafeRelease( &pBlackBrush );
SafeRelease( &pRT );

return NO_ERROR;
}



Direct2D on MSDN

&

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