unicode 환경 컴파일 작업중 ansi 파일을 읽고 쓰는 부분을 unicode에서 읽고 쓰기가 되도록 수정 하다보니

검색해보면 대부분 BOM을 사용하는것으로 검색이 된다.


하지만 내가 필요한 내용은 BOM이 없는 파일에서 utf-8 포맷의 텍스트 파일을 읽는것이라서

다음과 같은 방식으로 수정을 했다.



CString strBuffer; // 실제 작업용 버퍼
CStringA szFileBuffer; // 파일에서 읽어들일 버퍼

CString strFilePath;
strFilePath = _T("test.txt");

CFile   hFile;
DWORD n;
if(hFile.Open(strFilePath,CFile::modeRead)){
    n = (DWORD)hFile.GetLength();
    n = hFile.Read(szFileBuffer.GetBuffer(n), n);
    szFileBuffer.ReleaseBuffer(n);
    hFile.Close();
}
// utf-8 파일 내용을 unicode로 변환
strBuffer = CA2T(szFileBuffer, CP_UTF8);

// 이후 로직 처리

//파일 저장
if(hFile.Open(strFilePath,CFile::modeCreate | CFile::modeWrite )){
    // unicode 문자열을 utf-8로 변환
    szFileBuffer = CT2A(strBuffer, CP_UTF8);
    sf.Write(szFileBuffer, szFileBuffer.GetLength());        
    hFile.Close();
}


unicode에서도 CFile 은 BOM 이 없으면 ansi 형식으로 데이터를 읽으므로 CStringA를 사용하도록 하는것이 핵심!!


'지식창고 > 프로그램' 카테고리의 다른 글

firefox Dns over HTTPS (DOH) 적용 하기  (0) 2018.05.17
nginx post 405 not allow 문제  (0) 2016.11.24
크롬 마우스 제스쳐 확장  (0) 2016.09.21
ConEmu 설정  (0) 2016.08.31
Laravel - 기본 라우팅  (0) 2015.05.19


60버전 이상에서 기능 지원함


주소창에 about:config 입력

검색 network.trr

network.trr.bootstrapAddress : 1.1.1.1

내 경우엔 1.1.1.1이 접속이 되지 않아 1.0.0.1 사용

network.trr.mode : 3

3 :DOH만 사용

2: DOH 실패시 기존대로 다시 시도

network.trr.uri  : https://cloudflare-dns.com/dns-query

다른 주소도 있는것 같은데 1.1.1.1 과 같은 서비스 주소를 사용하는편이 좋겠다 생각함



'지식창고 > 프로그램' 카테고리의 다른 글

CFile 에서 utf-8 파일 읽고 쓰기  (0) 2020.06.16
nginx post 405 not allow 문제  (0) 2016.11.24
크롬 마우스 제스쳐 확장  (0) 2016.09.21
ConEmu 설정  (0) 2016.08.31
Laravel - 기본 라우팅  (0) 2015.05.19

nginx에 static파일을 post로 요청하면 405 에러가 발생한다. ( get 은 정상 작동 get만 쓰라는건가?)


curl -d -O  URL 해보면 다음과 같은 에러가 보인다.


$ curl -d -O url
<html>                                                                   
<head><title>405 Not Allowed</title></head>                              
<body bgcolor="white">                                                   
<center><h1>405 Not Allowed</h1></center>                                
<hr><center>nginx/1.10.2</center>                                        
</body>                                                                  
</html>                                                                  



아파치 서버에서는 아무 문제 없던 코드라 당황.


구글링해서 설정 추가 하니 잘 동작한다.


405에러인경우 에러페이지를 던지는 대신 요청한 URL을 주는 방식인것 같다.


error_page 405 = $uri;



참고 :

http://blog.brainless.in/2012/01/server-static-files-from-nginx-for-post.html




'지식창고 > 프로그램' 카테고리의 다른 글

CFile 에서 utf-8 파일 읽고 쓰기  (0) 2020.06.16
firefox Dns over HTTPS (DOH) 적용 하기  (0) 2018.05.17
크롬 마우스 제스쳐 확장  (0) 2016.09.21
ConEmu 설정  (0) 2016.08.31
Laravel - 기본 라우팅  (0) 2015.05.19

크롬에서 사용하는 마우스 제스쳐


https://chrome.google.com/webstore/detail/crxmouse-chrome-gestures/jlgkpaicikihijadgifklkbpdajbkhjo


'지식창고 > 프로그램' 카테고리의 다른 글

firefox Dns over HTTPS (DOH) 적용 하기  (0) 2018.05.17
nginx post 405 not allow 문제  (0) 2016.11.24
ConEmu 설정  (0) 2016.08.31
Laravel - 기본 라우팅  (0) 2015.05.19
Laravel - 홈스테드 설치와 기본 설정  (0) 2015.05.19

탐색기 메뉴 : ConEmu Here추가

Setting -> Intergration -> Register

기본값은 {cmd} 윈10용 bash를 실행하려면 {bash} 기타 다른 쉘이 필요하면 Task의 명을 사용한다.



homestead에서 사용한 명령창은 이제 사용하지 않는다.


사용하는 에디터로 프로젝트 파일을 연다.



laravel.app로 접속하면 WelcomeController에서 index 를 실행시킨다.




view는 리소스에 있다.



기본 라우팅 도움말

http://xpressengine.github.io/laravel-korean-docs/docs/5.0/routing/


blade템플릿 도움말

http://xpressengine.github.io/laravel-korean-docs/docs/5.0/templates/



Route::get('/test/{msg}',function($msg)
{
    return 'Hello '.$msg;
});




라라벨 한글메뉴얼 http://xpressengine.github.io/laravel-korean-docs/docs/5.0/homestead/


개발환경을 로컬에 구축 하는 가장 손쉬운 방법으로 Vagrant가 있는데


이걸 사용한 환경을 Laravel에서 제공한다.


VirtualBox에 미리 설치된 리눅스 이미지를 다운로드 받고 관리 해주는 툴이 Vagrant다.




VirtualBox를 설치하고 Vagrant를 설치 한다.


vagrant로 homestead를 다운받자


vagrant box add laravel/homestead


다운로드 되는 동안 환경 설정을 하자.


적당한 위치에 홈스테드 설정 파일을 받는다.


git clone https://github.com/laravel/homestead.git Homestead


메뉴얼대로  bash init.sh 를 실행시킨다.  (윈도우는 GitBash 사용)


메뉴얼대로 SSH키를 생성한다.

ssh-keygen -t rsa -C "you@homestead"


사용자 디렉토리에 .homestead 에서 Homestead.yml이 설정파일이다.


https://scotch.io/tutorials/getting-started-with-laravel-homestead


설정 파일은 위의 링크를 참조 하는게 좋다.


git으로 clone을 받은 경로와 실제 laravel소스가 위치할 경로는 별개로 잡는게 관리상 편리하다.


그냥 한번 해볼꺼면 기본 상태로 그냥 하고 차후를 생각해서 관리 를 할꺼면 폴더 구조를 잠시 고민한다.


내경우엔 위의 경로를 참고해서 프로젝트를 따로 관리하기로 했다.

folders:

 - map: /Users/dummy/projects

   to: /home/vagrant/Sites


sites:
- map: laravel.app
to: /home/vagrant/Sites/test/public


homestead이미지 다운로드가 완료되면 clone받은 homestead경로에서 명령창을 연다


vagrant up


필요한 환경을 구성하면서virtualbox를 구동시킨다.


vagrant ssh를 하면 가상머신으로 로그인한다.


윈도우에서는 putty에서 127.0.0.1:2222로  접속 하거나

기본상태로는 192.168.10.10의 내부 네트워크 아이피를 부여받으므로 해당 아이피로 접속한다.



이제 본격적인 Laravel설치

http://xpressengine.github.io/laravel-korean-docs/docs/5.0/installation/.


기본상태라면

/home/vagrant/Code의 경로가

clone받은 homestead의 Code 경로 공유되어 있을것이다.


나는 Sites로 설정을 했으니

cd Sites


laravel전역설치

composer global require "laravel/installer=~1.1"


프로젝트 생성은 둘중에 편리한 방법으로 진행을 한다.


프로젝트 생성

laravel new test


전역설치 하지 않고 프로젝트 생성

composer create-project laravel/laravel test--no-dev --prefer-dist -vvv



host에서 브라우져를 켜고  192.168.10.10으로 접속하면

라라벨 초기 화면이 보일것이다.


아이피보다는 도메인으로 접속하는게 편리 하므로 설정을 한다


/etc/hosts

192.1568.10.10 laravel.app











구글링해봤는데 딱히 방법이 보이지 않았는데 구세주를 만났다.


http://www.codeproject.com/Articles/14127/How-to-call-an-Oracle-Stored-Procedure-that-return


컨넥션 스트링에 PLSQLRSet=1;이게 답이였다.


Provider=OraOLEDB.Oracle;PLSQLRSet=1;Data Source=XXX


기존에 MS-SQL로 개발되어 있는 프로그램에서 저부분만 수정했더니 잘 동작했다.


물론 자동으로 마이그레이션 해준 프로시져를 약간 손보긴 했지만  잘 돌아간다.

Oracle SQL Developer만세!!!



http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev/r30/SQLServerMigration/SQLServerMigration.htm


테이블, 프로시저 모두 깔끔하게 변환되어 마이그레이션 된다.


일부 프로시저에서 트랜젝션 관련 함수및 case구문등 에러가 발생하는 부분도 있었지만 이정도면 아주 훌륭하다고 볼 수 있다.



http://www.labnol.org/internet/website-uptime-monitor/21060/


운영중인 웹서버가 가끔 오류로 죽는경우 모니터링이 필요해서 검색해서 사용하던건데


최근 오작동이 많아져서 다시 찾아보니 업그레이드 되어 있네요.


  1. Sign-in to your Google account and then click here to copy this Google sheet into your Google Drive. You may use your Google Apps account as well.
  2. Put your website URLs in cell B2 (comma separated) and your email address in cell B3. If you wish to receive alerts by text messages, put Yes in cell B4.
  3. You’ll find a new Website Monitor menu in your Google Sheets toolbar. Click Initialize and you’ll get a pop-up asking for authorization. Grant the necessary access.
  4. Go to the Website Monitor menu again and choose “Start Website Monitor” to begin the monitoring process. Close the Google Sheet.
  • click here를 누르면 구글 docs에 스크립트 문서가 복사됩니다.
  • B2열에 모니터링할 URL을 , 로 구분해서 넣고, email을 적어주면 문제 발생시 메일이 옵니다. 구글 메일로 해놓으면 메일 푸시가 되므로 SMS안해봤습니다.
  • 기존에 사용하던것은 메뉴에 Website Monitor만 누르면 동작했는데 오늘 해보니 바뀌었네요.
    메뉴를 눌러서 Initlialize -> Start Monitor 이제 웹페이지를 닫으면 됩니다.