Wednesday, December 14, 2011

맥에서 한글 파일 압축시 윈도우에서 파일명이 깨지는 경우

http://www.sopht.jp/en/cleanarchiver/downloads.html

위 주소에서 최신버전(3.0a6)을 다운로드한다.

화면에서 encoding을 cp949로 설정하고,

파일을 드래그 앤 드롭하여 압축한다.

Sunday, December 11, 2011

GIT 로컬 소스에서 부터 원격 서버 설정.

로컬에 있는 소스를 원격에 업로드/임포트(import)해서 초기화 하는 방법은 아래와 같다.

git init

git add .

git commit -m ‘initial import’

git remote add origin <<remote url.git>>

git push origin master

http://stackoverflow.com/questions/4658606/import-existing-source-code-to-github

Wednesday, November 23, 2011

UIWebView anchor로 이동 방법

NSArray* urlArray = [urlString componentsSeparatedByString:@"#"];

if(1 < [urlArray count]){

        NSString *absoluteUrl = [urlArray objectAtIndex:0];

NSURL *url = [NSURL fileURLWithPath:absoluteUrl];

url = [NSURL URLWithString:[NSString stringWithFormat:@"#%@", [urlArray objectAtIndex:1]] relativeToURL:url];

NSURLRequest *req = [NSURLRequest requestWithURL:url];

[webView loadRequest:req];

}

URL에 anchor가 있는 경우 스트링에서 분리후 #%23으로 자동변환되지 않도록 직접 포맷팅해주면 앵커로 이동이 가능하다.

http://stackoverflow.com/questions/6691495/how-to-load-nsurl-which-contains-hash-fragment-with-uiwebview

Monday, November 21, 2011

XCod4 에서 크래쉬난 경우 콜스택을 보여주는 방법.

void uncaughtExceptionHandler(NSException *exception);

void uncaughtExceptionHandler(NSException *exception) {

NSLog(@"CRASH: %@", exception);

NSLog(@"Stack Trace: %@", [exception callStackSymbols]);

// Internal error reporting

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

// Override point for customization after application launch.

NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);

return YES;

}

실제 서비스에서도 크래쉬에 대한 콜스택을 수거할 수 있도록 파일에 저장할 수 있다고 한다.

스택오버플로우에서 봤는데, 링크를 찾지 못하겠음...

Tuesday, November 1, 2011

GIT 충돌 해결

GIT 사용중 충돌 발생한 경우.

$ git pull

From xxxx

4cb74b1..d6ca118 master -> origin/master

Auto-merging xxx.xcodeproj/project.pbxproj

CONFLICT (content): Merge conflict in xxx.xcodeproj/project.pbxproj

Automatic merge failed; fix conflicts and then commit the result.

$ git status

# On branch master

# Your branch and 'origin/master' have diverged,

# and have 5 and 1 different commit(s) each, respectively.

#

# Unmerged paths:

# (use "git add/rm <file>..." as appropriate to mark resolution)

#

#        both modified: xxx.xcodeproj/project.pbxproj

#

충돌난 파일을 에디터로 열고 충돌을 해결한다.

그리고 커밋을 하면 아래 에러가 발생하고 커밋을 할 수 없다.

충돌난 파일을 git add 로 다시 추가하여도 동일한 에러가 발생한다.

Devs-MacBook-Pro:paperble_app dev$ git commit .

fatal: cannot do a partial commit during a merge.

이러한 경우 -i 옵션을 주면 stage에 되지 않은 파일을 커밋할 수 있다.

$ git commit . -i

http://dready.org/blog/2010/04/28/git-conflict-resolution/

Tuesday, October 11, 2011

GIT MACOSX 설정

맥에서 GIT을 설정하는 방법.

git config --global user.name “TEST”

git config --global user.email “TEST@TEST.com

git config --global color.ui “auto”

설정 정보 확인

git config --global --list

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

        LANGUAGE = (unset),

        LC_ALL = (unset),

        LC_CTYPE = "UTF-8",

        LANG = (unset)

are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C")

.bash_profile 에 아래 내용 추가.

export LC_CTYPE=en_US.UTF-8

export LC_ALL=en_US.UTF-8

Tuesday, October 4, 2011

XCode 4 시뮬레이터 앱 디렉토리

- XCode 4 시뮬레이터 앱 디렉토리 위치.

/Users/YOURUSER/Library/Application Support/iPhone Simulator/IOSVERSION/Applications/APPID/

- Lion 에서 Library 폴더를 보이게 하는 방법.

chflags nohidden ~/Library

Sunday, May 8, 2011

타임라인(Timeline) 샘플

타임라인은 일목요연하게 많은 정보를 시간 흐름별로 쉽게 알 수 있게 도와준다.

몇 가지 정리했다.

  • 간단하게 하루 시간별 타임라인을 보여준다. The Big Day Exhibition Presidentes de Colombia (beta) Design Research Categories timeline 2005 Can robots be creative? Process - Timeline
  • 제품 생명 주기 타임라인 iPod Timeline [Updated] iPhone Timeline
  • 방사형 타임라인 Timeline of Evolution Timeline MCAS Tustin Timeline
  • 여러 항목별 타임라인 Lost Timeline Infographic Bronte sisters timeline : FINAL Nike Timeline.png {matd} History time charts : 13 Social Media Timeline {matd} History time charts : 10
  • 기타 타임라인(?) tree of life Celebrity Mustache Timeline Marketing Conversions Helsinki Games

Saturday, May 7, 2011

VS2010Express

Visual Studio 2010 Express 버전을 설치하고 WTL 연동을 한다.

 

 VS2010 Express 와 WDK(DDK)를 다운로드한다.

 

WTL을 빌드하기 위해서는 ATL이 필요하며, 다행히 ATL은 DDK에서 배포를 하고 있다.

 

http://www.microsoft.com/express/Downloads

http://www.microsoft.com/express/Downloads/#2010-All (전체 ISO 다운로드)

 

WDK(DDK)다운로드

http://www.microsoft.com/whdc/DevTools/WDK/WDKpkg.mspx

http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=36a2630f-5d56-43b5-b996-7633f2ec14ff

 

WTL 다운로드

http://sourceforge.net/projects/wtl/

http://wtl.svn.sourceforge.net/viewvc/wtl/trunk/wtl/Wizards/AppWiz/?view=tar

http://wtl.svn.sourceforge.net/viewvc/wtl/trunk/wtl/include.tar.gz?view=tar
각각 다운로드후 WTL을 사용할 폴더를 설정후, setup100x.js 를 수행하여 위저드를 설치한다.

 

 

VS2010 에서는 전체 프로젝트에 설정하는 include, library 디렉토리 설정이 없어졌다.

왜 이렇게 변경되었는지 아래 링크에 설명되어있다.

http://blogs.msdn.com/b/vsproject/archive/2009/07/07/vc-directories.aspx

 

사용자별 프로젝트 설정을 하기 위해서 

http://insomniacgeek.com/getting-started-with-wtl-on-visual-studio-2010/

에 나온바와 같이 새로운 프로젝트를 생성해서 Property Manager를 수행해야 한다.

그러나, VS2010 express에서는 디폴트로 Property Manager가 보이지 않는다.

Tools>>Settings>>Basic Settings 를 Expert Settings로 변경하면,

View>>Property Manager 가 나온다.

이것 때문에 고생했다. 사용자별 설정부터 이해할 수 없는 UI로 만들어졌다.

 

사용자별 설정을 하기위해 Property Manager에서 

Debug와 Release 아래 "Microsoft.Cpp.Win32.user" 모두 선택후,

마우스 오른쪽 버튼으로 컨텍스트 메뉴를 수행하면 Properties가 보이며,

선택하면 Property Pages 가 나온다.

 

이 상태에서 Include, Library Directories 를 설정하라.

 

ATL, WTL 디렉토리를 설정후 빌드하면 

stdint.h(72): warning C4005: 'INT8_MIN' : macro redefinition

이러한 형태의 경고가 발생하는데 아래 링크를 참고하여 해결하였다.

http://connect.microsoft.com/VisualStudio/feedback/details/621653/including-stdint-after-intsafe-generates-warnings#

 

링킹시 아래와 같은 에러가 발생한다.

error LNK2019: unresolved external symbol "void * __stdcall ATL::__AllocStdCallThunk(void)" (?__AllocStdCallThunk@ATL@@YGPAXXZ) referenced in function "public: static void * __cdecl ATL::_stdcallthunk::operator new(unsigned int)" (??2_stdcallthunk@ATL@@SAPAXI@Z)

error LNK2019: unresolved external symbol "void __stdcall ATL::__FreeStdCallThunk(void *)" (?__FreeStdCallThunk@ATL@@YGXPAX@Z) referenced in function "public: static void __cdecl ATL::_stdcallthunk::operator delete(void *)" (??3_stdcallthunk@ATL@@SAXPAX@Z)

 

결론적으로, 이 두가지 현상을 잡기위해 stdafx.h에 아래와 같이 작성하였다.

 

  1. #ifdef _MSC_VER // This check can be removed if you only build for Windows
  2. #pragma warning (push)
  3. #pragma warning (disable : 4005)
  4. #include <intsafe.h>
  5. #include <stdint.h>
  6. #pragma warning (push)
  7. #pragma warning (default : 4005)
  8. #endif

  9. #include <atlbase.h>
  10. #include <atlstdthunk.h>
  11. #include <atlstr.h>
  12. #include <atlapp.h>

  13. #pragma comment(lib, "atlthunk.lib")

 

Windows SDK 설치.

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=35aeda01-421d-4ba5-b44b-543dc8c33a20&displaylang=en

 

WindowsSdkDir 이 7.0A로 고정되는 경우

http://connect.microsoft.com/VisualStudio/feedback/details/564036/visual-studio-2010-windowssdkdir-always-forced-to-v7-0a-directory

UICC를 찾을 수 없어서 아래와 같은 에러가 발생한다.

  1. 1>  Compiling Ribbon.xml
  2. 1>  'uicc'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
  3. 1>  배치 파일이 아닙니다.
  4. 1>D:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 9009.

 

Windows SDK v7.0 v7.1 에서는 UICC.exe 가 배포되고 있다.

따라서 $(WindowsSdkDir) 을 v7.1로 옮겨야 한다.

http://blogs.msdn.com/b/vcblog/archive/2009/05/20/using-the-windows-7-rc-sdk-in-visual-c-2010-beta-1.aspx

Platform Toolset 을 Windows7SDK 로 설정한다.

 

DirectX 관련 에러 발생시.

7.1\include\objidl.h(11280): error C2061: syntax error : identifier '__RPC__out_xcount_part'

 

 

AFX_IMPORT_DATA  관련 에러 발생시

 

  1. error C2146: syntax error : missing ';' before identifier 'CUserToolsManager'
  2. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  3. error C2144: syntax error : 'int' should be preceded by ';'
  4. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  5. error C2146: syntax error : missing ';' before identifier 'm_bUseMemoryDC'
  6. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  7. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  8. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  9. error C2146: syntax error : missing ';' before identifier 'IsMemDC'
  10. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  11. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  12. warning C4183: 'IsMemDC': missing return type; assumed to be a member function returning 'int'
  13. error C2146: syntax error : missing ';' before identifier 'IsVistaDC'
  14. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

 

 

 


이 글은 스프링노트에서 작성되었습니다.

Sunday, April 17, 2011

연결선 및 그라데이션 추가.

이전 포스팅에서 에디터를 직접 구현하기로 했는데, 시간이 너무 많이 걸릴 것으로 예상되었다. 각각의 방식이 장단점은 있으나 다분히 많은 코드가 들어가야 할 것으로 보인다.

이러한 경우 어떠한 선택을 하느냐에 따라 개발시간/코드등 많은 차이가 날 수 있다. 장기적으로는 자체 에디터 개발이 맞다고 예상되나 단기적으로는 에디터를 사용하는 것이 맞을 수 있다.

미래의 일은 예측이 불가능하여 이러한 선택에서 고민을 많이 하는데, 여기서는 간단한 솔루션이 Strategy 패턴을 사용하는 방법이다.

간단한 인터페이스만 심어두고 구현은 뒤로 미룬다. 추후 구현시 단위테스트까지 구현이 가능하다. 물론 c로 작성해도 인터페이스만 맞추면 되겠다.

현재로서는 데스크탑 1차버전 완성도 중요하지만 마인드맵 자체 기능을 추가하여 아이폰용 업데이트도 해줘야 하는 상황인지라 에디터는 잠시 접고 연결선 작업을 했다.

Cairo 와 Quartz 는 동일한 좌표 시스템을 사용하도록 변경 가능했고, 함수 인자도 동일하여 함수명 변경으로만 기존 코드를 Cairo 로 변경 가능했다. 덕분에 쉽게 작업이 완료되었다.

image

노드 배경색에 그라데이션 작업도 쉽게 추가하였다. 아이폰에서는 그라데이션이 하드 코딩되어 있다. 데스크탑 버전에서는 테마에서 설정된 값으로 처리한다.

Quartz 에서 Cairo 로 포팅이 비교적 쉽게 이루어지고 있지만, 그림자 기능 관련하여 Cairo에서 직접적으로 지원을 하지 않는 것으로 보인다. 일단 패스.

마인드맵 기능 추가를 위해서 노드간 관계 작업을 해야 하는데 아직 노드 선택조차 되지 않으므로 어떻게 구현해야 할지 고민이 필요하다.

텍스트 출력과 스크롤 추가

주말동안 텍스트 출력과 스크롤 처리를 하였다. 이전에 데스크탑버전 개발시 텍스트 입력을 받고, 리치텍스트 및 이미지 처리등 리치컨트롤을 직접 제작하려 하였다.

이 부분에서 상대히 많은 시간을 소모하였는데(물론 제대로 완성하지도 못했다) 잠시 잊고 있었던 힘들었던 기억이 떠올랐다. 다시 리치에디터를 구현하기는 힘들 듯 하여 아이폰과 같이 단순한 에디터 수준으로 1차 버전은 만족하기로 했다.

물론 단순한 에디터라고 표현했지만 에디터를 직접 구현하는 작업이라 만만치 않을 것으로 예상된다.

다른 방법으로 윈도우에서는 리치에디터 컨트롤을 사용하고, 맥에서는 NSTextView 를 사용하여 구현이 가능하겠다.

image

텍스트 출력과 관련된 문제가 있는데, 영문폰트가 설정된 경우 한글을 출력하면 Cairo 라이브러리에서 출력은 하지 못한다. 당연한 얘기지만...

한글 윈도우일 경우 GDI에서 자동으로 한글 디폴트 폰트(굴림)으로 출력이 된다. 이 부분을 확인하기 위해 많이 시간이 투자되었다. 자세한 사항은 다음에 다루겠다.

아이폰 수준까지만 만들려고 했는데 초반부터 심상치 않다. 쉽지 않을 듯 하다.

Friday, April 15, 2011

MindHD 윈도우 버전 개발 시작

기존 데스크탑 버전은 QT를 이용하여 단일 소스로 각 플랫폼별로 구동하였다. 이러한 방식은 각 플랫폼별 고유한 UI에 어울리지 못하는 부분이 있었고, 맥스토어가 나오면서 경쟁력을 갖기 어려웠다. 또한 윈도우 앱스토어도 예고되어 상황이다. 단일 소스라는 커다란 장점이 있지만 사용자들이 받아들이는 친숙한 UI를 구현하지 못한다는 단점이 더 크게 부각되었다.

결국 각 플랫폼별로 제작을 하기로 결정하고 윈도우버전 개발을 다시 시작하였다. 먼 길이지만 돌아가기로 결정한 것이다.

image 윈도우 버전의 프로젝트 구성이다. 기본적으로 C++로 작성된 엔진과 엔진에 직접 접근하여 UI와 구동되는 WTL프로젝트가 있다. 여기에서 만든 클래스를 이용하여 Active Document를 제작하는 DocServer 프로젝트가 있으며 최종적으로 리본컨트롤은 사용하는 MFC 프로젝트가 있다. 그리고 단위테스트가 있다.

이러한 구성은 엔진을 이용하는 컴포넌트로 구성하여 모듈화 시키려는 의도가 있으며 추후 컴포넌트 판매를 기대할 수 있다.

처음부터 복잡한 구성이 개발기간을 늘리는 원인이 될 수 있지만 모듈화된 틀 안에서 개발에 임할 수 있으므로 설계/소스관리등 장기적인 관점에서는 유리하다는 계산이다.

WTL로 제작된 스크린샷이다. 아직 별 다른 기능은 없다.

image

Tuesday, April 5, 2011

NSString 을 std::wstring 으로 변환 및 버그 수정

MindHD 는 마인드맵 관련 엔진이 C++로 작성되어 iOS에서 구동될 경우 스트링 변환이 필수적이었다. 따라서, NSString을 wstring으로 변환하는 과정이 필요하다. void NSStringToString(const NSString* text, String& str){         str = L"";         size_t len = [text length];         if(len <= 0){                 return;         }                  if([text canBeConvertedToEncoding:NSUTF32LittleEndianStringEncoding]){                 str = (wchar_t*)[text cStringUsingEncoding:NSUTF32LittleEndianStringEncoding];         } } NSUTF32LittleEndianStringEncoding 사용하여 변환이 가능한데, 위 코드에 버그가 있었다. 리턴값이 char* 인데 wchar_t*로 변경하니 널 문자 삽입이 제대로 되지 않는 경우가 발생한 것이다. str = wstring((wchar_t*)[text cStringUsingEncoding:NSUTF32LittleEndianStringEncoding], len); 명시적으로 스트링 길이를 주어 해결함.

HTML Encoded

프리마인드 포맷에 캐릭터 표현은 HTML Encoded 표현방식으로 작성된다. CPP에서 UTF8 변환 관련 라이브러리는 UTF8-CPP를 사용했다. http://utfcpp.sourceforge.net/         std::string strUTF8 = "한글 테스트";         std::ostringstream aStream;                  std::string::iterator beg = strUTF8.begin();         std::string::iterator end = strUTF8.end();         for(; beg!=end; ) {          if(127 < (unsigned char)*beg)                         aStream << "&#x" << std::hex << utf8::unchecked::next(beg) << ';';                 else                 {                         aStream << *beg;                         ++beg;                 } }

Friday, April 1, 2011

XCode 4 디버깅 단축키

Step Over - F6 Step Into - F7 Step Out - F8 Continue program execution - CMD+CTRL+Y Stop - CMD+. Help search - CMD+CTRL+OPT+/