2013년 7월 18일 목요일

블로그에 하이라이트 기능 넣기

델파이 관련 자료를 많이 다루다 보니 소스 코드가 많은데 보기에 별로여서 보기 좋게 꾸미려고 구굴링해보았더니 있더군요. 해서 따라 해보았습니다.

Adding Syntax Highlighting to Blogger 를 참조하세요. 

막상 따라해보니 이해가 잘 안되는 곳도 있더군요.

먼저

1. Go to http://syntaxhighlighter.googlecode.com/svn/trunk/Styles/SyntaxHighlighter.css, then perform a "select all" and "copy". The css information is now in the clipboard.

링크 따라가서 복사 한다음
[템플릿  > 사용중인 디자인 > HTML 편집] 한다음

2. Paste the css information at the end of the css section of your blogger html template (i.e., after <b:skin><!--[CDATA[/* and before ]]--></b:skin>).

]] 껏쇠 바로 앞부분에 넣으라는 이야기고..

3. [Updated March 25, 2009 to include closing script tags] Before the </head> tag, paste the following:

부분 코드 박스 위쪽에 있는  [View plain / Copy to Clipboard / Print / ?] 에서 Copy to Clipboard 를 선택하여 복사 한다음 </head> 바로 앞부분에 붙여 넣고

4. [Updated to add final /script] Before the </body> tag, insert the following:
역시 Copy to Clipboard 를 선택하여 복사 한다음  </body> 바로 앞에 붙여 넣습니다.

코드 작성 할때
<pre name="code" class="delphi">
...Your html-escaped code goes here...
</pre>
이렇게 하면 됩니다.

(4) 에서 아래와 같이 코드를 수정하면 Copy To Clipboard 가 활성화 됩니다.

<script language='javascript'>
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.ClipboardSwf = '/flash/clipboard.swf'; 
dp.SyntaxHighlighter.HighlightAll('code');
</script>

** 복사하여 붙여 넣기 하면 ' 문자가 바뀌여 들어 가더군요.

2013년 7월 16일 화요일

홈페이지에 있는 자바 스크립트 호출하기

본 예제는 2가지의 기술이 들어 있습니다.
웹에서의 버튼 조작을 델파이로 갖어와서 델파이에서 처리를 하는데 TWebBrowser 의
StatusTextchange 이벤트를 이용하는 것과
웹에 있는 Javascript function 을 실행하는 것입니다.

홈페이지에는 아래와 같은 스크립트가 들어 있습니다.
<head>
  <script language="javascript">
        function closewin(num){
            window.status='close';
            window.status='';
            window.close();
        }
  </script>
</head>
.......
<from>
   <input id="idtext" name="idtext" type="text" />
   <input 0="" id="idimage" name="idimahe" onclick="closewin()" src="images/images.jpg" style="cursor: hand;" type="image" />
   <input id="idsubmit" name="idsubmit" type="submit" />
</from>
폼에 WebBrowser 와 Editor, button 3개를 올려 놓고
procedure TForm4.Button1Click(Sender: TObject);
var iDoc: IHTMLDocument2;
    iWin: iHTMLwindow2;
    ifunc: string;
begin
  WebBrowser1.Document.QueryInterface(IHTMLDocument2, iDoc);
  WebBrowser1.Document.QueryInterface(IHTMLWindow2, iWin);
  ifunc:= 'closewin()';
  try
    iwin.execScript(ifunc, 'JavaScript');
  finally
  end;
end;

procedure TForm4.Button2Click(Sender: TObject);
begin
  WebBrowser1.Navigate(http://localhost/test.html');
end;

procedure TForm4.Button3Click(Sender: TObject);
var Obj,Doc : OleVariant;
begin
  Obj:= 0;
  // 필요하면 IDispatch(TTTestCode.Create); 방법으로 Dispatch인터페이스로 형변환한다...
  // HTML Script는 Dispatch인터페이스만 지원한다.
  // Script 인터페이스를 얻고...
  Doc:=IHTMLDocument2(WebBrowser1.Document).Script;
  // Script의 SetObject함수를 호출한다...(이함수는 HTML의 JavaScript함수이다)
  Doc.closewin(obj);
end;

procedure TForm4.WebBrowser1StatusTextChange(ASender: TObject; const Text: WideString);
var iStr: string;
begin
  iStr:= Text;
  if istr= 'close' then begin
    close;
  end;
end;
웹에서 이미지를 크릭하면 프로그램이 종료합니다.
프로그램에서 버튼3를 크릭하면 웹에 있는 스크립트를 실행하고, 즉 이미지를 크릭한 것과 같은 현상, 그 결과로서 프로그램을 종료 합니다.
다른 스크립트를 실행 시킬 수 있고, 다른 동작을 할수 있겠지요.
예를 들어 특정 버튼의 결과에 특정 디비에서 자료를 읽어와 Html을 만들고 그웹을 뿌려줄 수 있겠지요.

한영변환(펌)

public에 밑에 함수 추가
const   English = 0; Korean = 1;
uses InputUnit, ViewUnit, Imm;
{$R *.DFM}
//////////// 한/영상태 검사 루틴///////////////
function TMainForm.IsHanState(paForm: TForm): boolean;
var
   fFlag, imeMode: DWORD;
   hIMC: THandle;
begin
   hIMC:= ImmGetContext(paForm.Handle);
   ImmGetConversionStatus(hIMC, fFlag, imeMode);
   ImmReleaseContext(paForm.Handle, hIMC);
   Result:= (fFlag = 1);
end;
//////////// 한/영상태 변화 루틴///////////////
procedure TMainForm.SetIMEMode(const Language: Integer);
var
   dwConversion, dwSentence: DWORD;
   hIMC: THandle;
begin
   hIMC:= ImmGetContext(Application.Handle);
   ImmGetConversionStatus(hIMC, dwConversion, dwSentence);
   Case Language Of
      English: ImmSetConversionStatus(hIMC, IME_CMODE_ALPHANUMERIC, dwSentence);
      Korean : ImmSetConversionStatus(hIMC, IME_CMODE_NATIVE, dwSentence);
   end; {Case Value Of}
   ImmReleaseContext(Application.Handle, hIMC);
end;

procedure TMainForm.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
   If IsHanState(Self) Then StatusBar1.Panels[1].Text:= ' 한글 '
   Else StatusBar1.Panels[1].Text:= ' 영문 ';
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
   InputFormActive:= False;
   ViewFormActive:= False;
   InputClose:= True;
   Application.OnHint:= ShowHint;
   Application.OnMessage:= AppMessage;
   SetIMEMode(Korean);
   Left:= 1;
   Top:= 1;
end;
* 자료출처 : http://blog.daum.net/ryang000/118

2013년 7월 15일 월요일

명령창 열기 (cmd) 이렇게..

컴퓨터를 다루면서 명령창을 열어야 할 경우가 자주 있는데 이제 까지는
[시작 > 실행.. > 열기 = cmd] > 확인] 을 하였습니다.

특정한 폴더에서 열 경우에는
[해당 폴더의 상위 폴더로 이동한 다음 > 팝업창(마우스 오른쪽버튼 누르면 나오는 돌출메뉴) > Shift + 마우스 오른쪽 버튼 한다음 > 여기서 명령창 열기를 선택]하였습니다.

이렇게 해보세요.
탐색기에서 특정한 폴더로 이동한 다음 > 탐색기의 경로가 보이는 곳에서 >
마우스 한번 크릭 한 다음 cmd 라고 입력하고 리턴하면...

경로창으로 곧바로 이동하는 단축키는 Alt + D 입니다.

이것을 이제 까지 모르고 시작... 하고 있었으니... (아래와 같은 것도 해보세요. exe는 생략)
chrome.exe
bds.exe
about:blank
localhost
http://google.co.kr
www.google.co.kr
www.daum.net
inetmgr.exe
제어판
c:\temp
regedit.exe
services.msc
wf.msc  => 방화벽 관리
diskmgmt.msc
devmgmt.msc > 장치관리자
compmgmt.msc > 컴퓨터관리자
commgmt.msc > 구성요소관리자
notepad.exe
.....................................

까있거! 패스만 연결되어 있으면 전부 되고, 인터넷 익스플러 또는 크롬등 디폴트 인터넷 탐색기의 주소창에 입력하는 것이 전부 됩니다.


PhpStorm 과 WebStorm 에서 MySql DB 관리

IDE 상태에서 MySql DB에 연결하려면 이렇게 하면 된다는 군요.

  1. Install DB Navigator Plugin via menubar >> Settings >> Plugins >> Available-Tab
  2. Download MySQL jdbc connector from here >> http://www.mysql.com/downloads/connector/j/
  3. Unpack MySQL jdbc connector to a directory of your choice
  4. Restart PHPStorm / WebStorm
  5. Add a DB via menubar >> DB Navigator >> Settings >> Connection-Tab >> Plus-Button
  6. Enter the parameters for your connection (see below for possible entries for a local MySQL DB)
Possible parameters for a local MySQL DB
  • Name: name of choice (localhost)
  • Description: additional info of choice (dbname)
  • Driver Library: path to the .jar file (that is the directory used in step 3)
  • Driver: your perfered driver (most likely the standard driver will do >> com.mysql.jdbc.Driver)
  • URL: connection URL with a jdbc reference (in doubt try: jdbc:mysql://localhost:3306/)
  • UserName: the db username (root)
  • Password: the db password (root)
버전 6.0 에서는 이렇게 해도 되는 군요.
IDE 오른쪽에 숨겨진 DataBase 탭을 보이게 한다음
마우스오른쪽 버튼 팝업창에서 " + New > Data Source"를 선택한다음
Data Source name: LocalRoot
Scope: IDE
Database Tab > JDBC driver Files > 드롭다운 박스 아래 화살표를 눌러
접속하고자 하는 드리이버를 선택하면 다운받아 .jar 파일을 저장합니다.
드롭다운 박스 오른쪽 "...." 버튼을 선택하여 방금 다운받은 파일을 선택합니다.
JDBC driver Class: 드롭다운 박스에서 com.mysql.jdbc.Driver 를 선택합니다.
Database URL: 드롭다운 박스 아래 화살표르 눌러 입력 형식을 선택합니다.
jdbc:mysql//localhost:3306
이렇게, 특정 Database를 지정하려면
jdbc:mysql//localhost:3306/honam
User: 와 Password: 텍스트 박스에 root 와 암호를 입력하고
아래쪽 Test Connection 버튼을 눌러 확인합니다.

확장 시킨 DataBase 탭에서 원하는 데이터베이스를 선택하고
마우스 오른쪽 버튼 > Console 하여
Select * from workers;
DB 내용을 확인 할 수 있습니다.
사용해보니 정말 좋네요. WebStorm 하나 구입해야 겠네요.

2013년 7월 12일 금요일

ActiveX폼에서 JavaScript의 함수 호출

델마당의 강용희님 글 델마당에는 소스가 첨부되어 있습니다.
우선...
ActiveX폼이라는 놈을 이용해 프로그램을 만들면 꼭 한번씩 JavaScript의 함수를 호출할때가 필요합니다. 여기저기 알아봐도 답이 없고 해서 직접 분석해서 알아 냈습니다... 원리는 간단한데... 예상외로 알고 있는 사람이 없더군요... 제가 원래 말솜씨가 없서서 강좌가 좀 부실할검니다... ^^;; 넓은 아량으로 봐주세요!!

우선 JavaScript에서 지원하는 Object는 Automation Object입니다... 이 Object는 COM이기는 COM인데, 이름으로 호출 하는것을 지원하는 놈이죠... 델파이의 경우는 C나 C++처럼 포인터를 이용해서 함수를 호출하는 방식하고 JavaScript나 VB에서 지원하는 이름으로 함수를 호출하는 방식 모두를 지원합니다... 
COM Object만드는 방식은 여기 강좌에 보시면 많이 있으므로 생략하고...
Automation Object는 델파이의 File->New->Other->ActiveX->Automation Object를 선택하면 만들수 있습니다. 만일 ActiveX Form에서 사용한다고 하면 ActiveX Form자체가 Automation Object이므로 따로 Object를 만들 필요가 없고, ActiveX Form에서 Typelib 편집기에서 함수를 만들면 JavaScript에서 바로 함수를 호출할수가 있습니다.^^;;
아래는 Automation Object의 예입니다... 

unit Unit2;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
   ComObj, ActiveX, Project1_TLB, StdVcl, Dialogs;
type // Automation(Dispatch)오브젝트...
  // HTML(JavaScript)에서 호출을 할려면 VB처럼 Dispatch방식을 지원해야 된다...
TTTestCode = class(TAutoObject, ITTestCode)
protected
procedure TestCall(const Param1: WideString); safecall;
end;
implementation
uses ComServ;
procedure TTTestCode.TestCall(const Param1: WideString);
begin // ShowMessage로 전달받은 문자열을 출력한다...
  ShowMessage('난 델파이의 객체야!!'+#13+Param1);
end;
initialization
TAutoObjectFactory.Create(ComServer, TTTestCode, Class_TTestCode,
ciMultiInstance, tmApartment);
end.

멤버함수로 TestCall이라는 함수가 있는데... 이함수는 전달받은 인수를 델파이의 ShowMessage를 이용해서 출력합니다.
그러면 TestCall은 누가 호출을 하느냐 하면...
아래의 HTML에서 "요기를 눌러보세요"를 누르면 호출을 합니다.. ^^;; 

요기를 눌러보세요... 

그럼 위의 두문장으로 실행이 될까요. 당연히 않되겠죠. object는 선언만 되었지... 실제로 객체가 할당이 되지 않았으니까요. 그럼 Object를 할당하는 JavaScript함수를 만들었습니다...
함수는 SetObject이구요...
이제 이함수를 메인 폼에서 호출해주면 되겠죠!!
그럼 이제 메인 소스를 볼까요!!

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, ComObj, StdCtrls, OleCtrls, SHDocVw, MSHTML;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin // HTML을 읽어 들인다...
  WebBrowser1.Navigate(ExtractFilePath(Application.ExeName)+'test.htm');
end;
procedure TForm1.Button2Click(Sender: TObject);
var
  Obj,Doc : OleVariant;
begin
  Obj:=IDispatch(TTTestCode.Create); // Dispatch인터페이스로 형변환한다...
  // HTML Script는 Dispatch인터페이스만 지원한다.
  Doc:=IHTMLDocument2(WebBrowser1.Document).Script; // Script 인터페이스를 얻고...
  Doc.SetObject(Obj); // Script의 SetObject함수를 호출한다...(이함수는 HTML의 JavaScript함수이다)
end;

procedure TForm1.Button3Click(Sender: TObject);
var
  Obj,Doc : OleVariant;
begin
  Obj:=Unassigned;
  Doc:=IHTMLDocument2(WebBrowser1.Document).Script;
  Doc.SetObject(obj); // HTML의 Object를 Null로 초기화 한다...
end;

procedure TForm1.Button4Click(Sender: TObject);
var Win : IHTMLWindow2;
begin // 아래는 다른 방법으로 스크립트를 호출한다...
  // 이방법의 단점은... 오직 문자열로만 표현되는 인수만 전달할수 있다.
  // 즉 문자나 숫자는 전달할수 있지만,
  // Object등은 전달할수가 없다...
  Win:=IHTMLWindow2(IHTMLDocument2(WebBrowser1.Document).frames); // HTML의 Window객체를 얻는다...
  Win.execScript('SimpleCall("다른 방법으로 스크립트 호출")','');
end;
end.

위의 소스를 보면 Button2를 누르면 Automation Object를 만들어서 HTML SetObject를 호출해 객체를 설정하는것을 알수 있습니다... ^^;;
이렇게 객체를 설정한후에 링크를 누르면 제대로 동작하느것을 볼수 있을것입니다.
원리는 간단하죠!!
근데 아무리 강좌를 뒤비봐도 없더라구요...

휴... 
위에서 보듯이 HTML의 JavaScript함수를 호출하는 방법은 2가지가 있는데...
첫번째는 Script라는 Dispatch인터페이스를 이용해서 호출하는 방법입니다...
이방법이 가장 좋은 방법이구요...

아니면 IHTMLWindow2의 execScript함수를 이용해서도 호출을 할수 있습니다...
단지 이방법은 문자열로 함수를 호출하기 때문에 인수의 타입에 제한이 있죠.,..

그럼 수고하시구요...
즐프하세요;;

NodeJs 관련 자료 링크

노드 홈페이지 http://nodejs.org/

node.js 한글 도큐먼트  http://nodejs.sideeffect.kr/docs/

Node.js 책 쓰신 아웃사이더 님의 블로그  http://blog.outsider.ne.kr/category/node.js 


express 한글 가이드 http://firejune.io/express/guide 

Jade 한글 가이드 http://blog.doortts.com/223 


express 설치 - 글로벌로 설치 
>npm install -g

Node 생성 
>express [Application Name]

Node 생성 - with Session 
>express [Application Name] -s

Jade 설치
>npm install express jade 

Mysql module 설치
>npm install mysql

Socket.io 모듈 설치
>npm install socket.io

몽골리안 설치
> npm install mongolian

박병일 님 자료 http://feeding.kr/js 


윈도우 핸들로 HTML 갖어 오기 http://bloodguy.tistory.com/748

2013년 7월 9일 화요일

Netbeans 로 android App 개발(PhoneGap)

NetBeans IDE 에서 Phone Gap 이용하여 Android App 개발 환경 설정하기

Phone Gap 은 Html, CSS, Java Script 만으로 web 이 아닌 App 을 개발 할 수 있다.

1. NetBeans IDE 를 설치
 - netbeans ide 로 구굴링해서 2013.7.9 기준으로 NetBeans IDE 7.3.1, Java SE 81 을
 - 다운 받아 설치한다. All 을 설치하면 더 좋겠지요.
2. Java SE 를 설치
 - java se 로 구굴링해서 오라클 다운로드 사이트에 접속하여
 - Java Plaform(JDK) 7u25를 다운 받아 설치 합니다.
 - 참고로 자신의 OS 상태에 맞추어서 설치 해야 겠지요.
 - 저는 windows x86 (i586)을 선택 했습니다.
 - 라이센스 동의 여부를 물어오니 Accept License Aggrement 를 선택합니다.
2-1 저는 이 화면에서  JDK7 + NetBeans 을 선택하여 한방에 설치하였습니다.
3. PhoneGap 설치
 - phonegap 으로 구굴링해서 PhoneGap 2.9.0 을 다운받아
 - 압축을 풀어 놓고 폴더 이름을 잘 기억해 둡니다.
4. Android SDK 설치
 - android sdk 으로 구굴링해서 developer.android.com에 접속하여
 - SDK를 받아 오는데, 기본으로 되어 있는 ADT Bundle for windows 으로 하거나, 
 - USE AN EXISTING IDE 로 해서
 - sdk를 설치하는데 설치되는 폴더를 잘기억 해 둡니다.
 - ADT 번들로 하면 eclipse 가 설치됩니다.
 - 설치 하려는데 Next 가 활성화가 안되는 경우가 있습니다.
4-1 Java 환경설정
 - 바탕화면의 내컴퓨터에서 마우스 오른쪽 버튼 > 속성 > 고급 시스템 설정(win7)
 - 하여 나오는  시스템 속성 창에서 > 고급 탭을 선택하고 >
 - 환경 변수 창에서 > 시스템 변수에서
 - JAVA_HOME 변수가 있는지 확인하고 없으면 (2)에서 설치한 폴더를 지정해 줍니다.
 - 저의 경우에는 c:₩program files₩java₩jdk1.7.0_25 입니다.
5. Android SDK Manager 이용 필요 파일 다운 받기
 -  (4) 과정이 끝나면 Android SDK Manager 창이 뜹니다.
 - 만약 안뜨면 c:₩program files₩android₩androis-sdk₩sdk manager.exe 를 실행합니다.
 - 인스톨이 필요한 파일이 Not Installed 라고 표시되니 install packages 버튼을 크릭하여 
  인스톨 합니다. 
 - 참고로 Tools 가지에 sdk tools, sdk platform-tools, sdk build-tools 
 - 세가지가 인스톨 되어 있는지 확인하세요.
 - 저는 build-tools 가 빠져 마지막 단계에서 
 - sdk dies not have any build tools installed 에러를 만났었습니다.
6. nbandroid template 설치
 - nbandroid 로 구굴링하여 나온 사이트에서 업데이트 주소를 복사해옵니다.
 - NetBeans을 실행시키고, Tools > PlugIns > Settings 탭에서 Add 버튼을 눌러 
 - 적당한 이름(nbandroid)을 주고 url 에 복사해둔 업데이트 경로를 붙여 놓고 ok 합니다.
7. 계속하여 PlugIns > Settings > Available Plugins 탭에서 android 찾아 체크한 후
  install 버튼을 선택합니다.
8. NetBeans 에 sdk 패스 설정하기
  -  NetBeans > Tools > Options > Miscellaneous > android 탭에서
  - SDK Location 에 android-sdk 패스를 설정합니다.
9. 윈도우 [시작 > 실행 창(cmd)]을 열어 
 -  java -version
 -  javac -version 하여 패스 연결이 제되로 되어 있는지 확인합니다.
9-1. 4-1과 같은 방법으로 path 변수를 확인하여, 
 - ../android-sdk₩tools 와 
 - ../android-sdk₩platform-tools 와 
 - ..java₩jdk1.7.0_25₩bin 이 제대로 걸려 있는지 확인합니다.
 - 저는 jdk 가 걸려 있지 않아 추가 javac 가 안먹더군요.
10. toos > adv manager 에서 new 버튼을 눌러 적당한 단말기를 만듭니다.
 - cpu type 은 arm.

** 새로운 프로젝트를 하여면 이곳부터 하면 됩니다. **

11. netbeans 에서
 - [file > newproject > categories > android > projects = android project]
 - next버튼을 차례로 선택합니다.
12. New Android Application 창에서 다른칸은 적당하게 선택하고 , 
 - Package Name 에는  a.a등으로 입력합니다.
 - finish 버튼을 눌러 기본 골격을 생성합니다.
13. 왼쪽 projects 창에 보면 
 - 방금 만들어진 골격이 제대로 되지 않아 빨강 버튼이 보입니다.
 - NeBeans 을 종료합니다.
14. 탐색기 창을 열어 방금 생성한 프로젝트 폴더에 있는(내문서 폴더에 있겠지요)
 - src, res, libs 폴더와 androidmanifest.xml 파일을 삭제 합니다.
15. phonegap 폴더 > lib 폴더 > android 폴더 > example 폴더 에서
 -  asserts, libs, res, src 폴더와 androidmanifest.xml 파일을 복사하여 와서 방금전에 삭제 해버린 프로젝트 폴더에 복사합니다.
16. netneans 를 다시 실행합니다. 
 - projects 창에 빨간 버튼이 사라졌음을 확인하세요.


17.NetBeans 의 projects 창의 
 - assert 의 www 아래에 있는 
 - index.html 을 불러와서 
 - <body>..</body> 영역에.  hello world! 라고 입력하세요.
18. run 버튼을 크릭하고 가상단말기가 나타 나는 것을 기다립니다. 
 - 끈기 있게 기다리세요.
 - 기다리기 지루하면 아래쪽 output 창이나 소스를 확인하세요.
19. 에뮬레이터가 아주 늦는 것은 이해하셔야 합니다.
 - 싸구려 중고 단말기하나 구해서 USB에 곱아 하는게..)
20. 에뮬레이터가 정상으로 올라오면 
 - app 영역에 보면 
 - example 이라는 app 이 설치되어 있슴을 확인하세요. 
 - 아이콘은 프린터 모양입니다.
 - 선택하여 실행
21. 가상 단말에 hello world 가 보이는 것을 확인 합니다.

2013년 7월 8일 월요일

radphp 에서 mysql 연결시 한글 깨어질때

radphp xe2 를 이용하여 mysql 에 접속하면,
서버의 문자코드에 따라 한글이 제대로 보이지 않는 경우가 있다.
이때는 
MysqlDataBase1AfterConnect($sender, $params) {
   $this->MysqlDatabase1->execute('set names utf8;');
}
하면 해결이 된다.
그러나 Data Explorer 에서 연결은 되는데 Table 을 열라치면 에러가 난다.
아마 dbexpress 에서 문제가 있는 것 같다.
동일 시스템에 Delphi xe2 에서는 잘되는데...

radpho xe2 에 있는 안드로이드 개발 환경을 설치하다보면 잘 안되는 경우가 많은데.
특히나 재설치 하는 경우 무한 루프에 빠지는 경우가 나옵니다.
이때는 다음 버전인 HTML5 Studio 버전에 있는 android-setup.exe 를 실행하면 잘됩니다.

근데 왜 HTML5 Studio는 그렇게 시커먹게 해 놓고, 창크기도 조절하지 못해게 하였는지
아무리 테마를 바꾸려고 해고 안되네요..


2013년 6월 24일 월요일

WebBroker 에서 JavaScript 사용

웹브로커에서 자자 스크립트를 사용 할때   아래와 같은 방법으로 하면 됩니다.

procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var iStr: string;
begin
  // Response.Content := HTPpEncode( '<input type="button" onClick="alert(''Hello World'')" Value="Hello World"/>');
  iStr:= '<input type="button" onClick="alert('+ QuotedStr('Hello World')+')" Value="Hello World"/>';
  response.content := HTMLEncode( iStr ) + '<br>' + iStr;
end;

HtmlEncode 는 HTML 형식을 문장으로 그래도 보여 줍니다.

ftp://po.istu.ru/public/docs/other/_New/Books/Lang/Delphi/Delphi%20Developer's%20Guide/Ebooks/d6dg/chapter23.pdf

2013년 6월 23일 일요일

WebSnap 을 이용하여 모바일 홈페이지 만들기 2

모바일 웹에서 가장 많이 사용되는 것이 ListView 일 것입니다.

이것을 구현하기 위하여 역시 Web.WbWeb 유니트를 약간 수정 하도록 합니다.
 DataSetTableProducer1.tag 를 이용하여 tag 가 99 이면 Table 처리를 하고 아니면 
LiveCiew 처리를 하면 되지 않나 생각합니다.
procedure TWebModule2.DataSetTableProducer1FormatCell 에서 
  if CellColumn = DataSetTableProducer1.tag then
    CellData:= '<a href="#">'+CellData+'</a>';

으로 처리 하게끔하고 
Web.DBWeb 에서 

function TDataSetTableProducer.HtmlTable(DataSet: TDataSet; DataSetHandler: TDSTableProducer; MaxRows: Integer): string;
var
  I, J: Integer;
  DisplayText, RowHeaderStr: string;
  Field: TField;
  Column: THTMLTableColumn;
begin
  if DataSet.State = dsBrowse then begin
    J := 1;
    while (MaxRows <> 0) and not DataSet.EOF do begin
      // Result := Result + RowHeaderStr;
      if SameText(Caption,'table') then begin
        for I := 0 to DataSetHandler.Columns.Count - 1 do begin
          Column := DataSetHandler.Columns[I];
          Field := Column.Field;
          if Field <> nil then
            DisplayText := Field.DisplayText
          else DisplayText := '';
          with Column do
            Result := Result + DataSetHandler.FormatCell(J, I, DisplayText, 'TD', BgColor, Align, VAlign, Custom);
        end;
      end else begin
        if i <  DataSetHandler.Columns.Count then I := Tag
        else I:= 0;
        Column := DataSetHandler.Columns[I];
        Field := Column.Field;
        if Field <> nil then
          DisplayText := Field.DisplayText
        else DisplayText := '';
        with Column do
          Result := Result + DataSetHandler.FormatCell(J, I, DisplayText, 'li',  BgColor, Align, VAlign, Custom);
      end;
      Result := Result + EndRow + #13#10;
      DataSet.Next;
      Dec(MaxRows);
      Inc(J);
    end;
end;

당연히 헤더 부분도 수정 하여야 겠지요.
<div data-role="page">
<div data-role="header"><h1>Page Title</h1></div><!-- /header -->
<div data-role="content">
<ul data-role="listview" data-inset="true">

footer 부분도
</ul>
로 수정하여 주면 Caption 에다 Table/Ul 구분하여 넣어 주고 UL 이면 어떠한 컬럼으로 할것이지 지정하면 됩니다. 그렇지 않고 한 컬럼 만 있어도 되겠지요.

WebSnap 을 이용하여 모바일 홈페이지 만들기

현재 WebSnap을 이용하여 모방일 웹을 만들고 있습니다.
모바일 웹은 특성한 간결함이 기본이기에 WebSnap 만으로 충분하지 않아 생각되어 진행하고 있습니다.
당연이 JQueryMobile 을 이용하고 있습니다.

코딩을 줄이기 위하여 PageProcedure , DataSetTableProcedure 을 사용하는데 몇가지 마음에 맞지 않는 부분이 있어 Web.DbWeb.수정하였습니다.
수정을 위하여
1. Web Server Application을 새로운 르로젝트로 만듭니다. (Stand-alone)
2. 새로운 폴더에 생성된 모든 파일을 저장합니다. (프로젝트 저장)
3. ClientDataSet 과 DataSource 컴포넌트를 올려 놓습니다.
4. ClientDataset.FileName 에 biolife.xml 을 지정합니다.
5. DataSetTableProducer 를 폼에 올령 놓습니다.
6. 컨트로 F9 하여 빌드 하고 Code 최 상단에 보면 Web.DBWeb 유니트가 Uses 되어 있습니다.
7. 컨트롤 키를 누르고 DBWeb 단어를 크릭하면 해당 유니트를 불러옵니다.
8. [File > Save AS.. 하여 새로 만든 프로젝트 폴더에 저장합니다. !주의, !주의 폴더 확인
9. Class Helper를 이용하려고 했는데  function HtmlTabled 를 유니트 함수로 만들어 놓아서 별 수 없이 원본을 수정하게 되었습니다. 설마하니 이것을 계승한 녀석은 없겠지요.
있다하더라도 내 프로젝트에서만 수정하여 사용하니 별 문제 없을 것입니다.
10. 필요하면  function HtmlTabled 를
  TDataSetTableProducer = class(TDSTableProducer)
  ....................
     function HtmlTable(DataSet: TDataSet; DataSetHandler: TDSTableProducer; overrride; MaxRows: Integer): string;
  ....................
  하여 클래스 안에 집어 넣어 버리세요. 원본을 그렇게 하여도 될 것 같아요..
11. HtmlTable 마지막행에  < /Table> 앞에 < / TBody >를 추가합니다.
  Result := Result + '</Body></Table>';  { do not localize }
12. 아래 부분을 코멘트 처리합니다.
  {
  RowHeaderStr := DataSetHandler.RowHeader;
  Result := DataSetHandler.TableHeader + DataSetHandler.TableCaption + #13#10 +
    RowHeaderStr;
  Result := Result + DataSetHandler.ColumnHeader + EndRow + #13#10;
  }
  .....
   // Result := Result + RowHeaderStr;
  즉 테이블의 컬럼 해드를 외부에서 지정하겠다는 의미입니다.
13. DataSetTableProducer.Header 에 아래와 같이 수정합니다.
<body><div data-role="page">
<div data-role="header"><h1>Page Title</h1></div><!-- /header -->
<div data-role="content">
<TABLE id="FishList" class="ui-responsive table-stroke" data-role="table" data-mode="reflow"><THEAD><TR> 
<TH data-priority="1">Species No</TH><TH data-priority="2">Category</TH>
<TH data-priority="3">Common Name</TH> <TH data-priority="4">Species Name</TH>
<TH data-priority="5">Length (cm)</TH></TR></THEAD> <TBODY> 
필요하면 Page Title과 기타를 수정합니다
14. Footer 도 수정합니다.
</TBody></Table>
15. 앵커 처리를 합니다.
procedure TWebModule1.DataSetTableProducer1FormatCell(Sender: TObject; CellRow, CellColumn: Integer; var BgColor: THTMLBgColor;
  var Align: THTMLAlign; var VAlign: THTMLVAlign; var CustomAttrs, CellData: string);
begin
  if CellColumn = 0 then
    CellData:= '<a href="#" data-rel="external">'+CellData+'</a>';
end;
16. Pagrproducer를 하나를 폼에 올려 놓고 ppHeader로 이름 짓고
<!DOCTYPE html><html><head>
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
</head>
17. Pagrproducer를 하나를 폼에 올려 놓고 ppHeader로 이름 짓고
<div data-role="footer"><h4>Page Footer</h4></div><!-- /footer -->
</div><!-- /page --></body></html>

18. 최종 액션 부분을 수정합니다.
procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
  ClientDataSet1.Open;
  Response.Content := ppHeader.Content+ DataSetTableProducer1.Content
     + ppFooter.Content;
  ClientDataSet1.Close;

16. 아마 uses 절에 Web.HTTPProd 을 넣어 주어야 할 것입니다.

2013년 6월 21일 금요일

MySql 사용시..

  MySql 을 사용하면서..
재설치 할때 갑자기 이전 암호가 보이는 경우가 있다.
분명히 MySql 폴더를 전부 삭제 했는데도 이러한 현상이 보이는 것은
윈도우 상위버전에서는 데이터를 Application Data 영역에다 저장하기 때문입니다.

c:₩users₩all users₩mysql₩mysql server 5.1₩data
폴더를 확인해 보세요.

방화벽 때문에 3306 포트를 사용할 수 없으면 원격 접속이 안됩니다.
그러나 해당 서버에 웹서버가 있으면 http tunneling (터널링) 방법이 있는데
dll 과 php 를 사용하는 방법이 있습니다.

DeVart 의 mysql 컴포넌트(MyDac)를 사용하면 됩니다.
먼저 해당 서버의 적당한 위치에 MyDac가 설치된 폴더의 http 폴더에 있는 tunnel.php 라는 파일을 복사 시킵니다.

MyConnection.url:= http://server/tunnel.php
MyConnection.Options['protocal']:= mpHttp;
로 하면 된다고 하는데 실제 해보니 연결이 안되네요. 좀, 삽질좀 해야겠습니다.

2013년 6월 20일 목요일

Delphi WebBroker 등에서 utf-8 처리 (Get,Post)

델파이에서 웹브로커를 이용하여 모바일용 웹을 만들고 있는데 JQueryMobile 을 하용하면 쉽고 멋있게 만들 수 있습니다. 비교적 깔끔한 형태이기에 웹브로커로 만들어도 좋을 듯 합니다.

작업을 하면서 몇가지 정리하고 넘어가야 할 사안이 있어 정리합니다.

우선 화면상에 한글을 정상적으로 표현하기 위하여는

PageProdecer에 html을 불러올 경우에는 utf-8 형식으로 저장하여야 합니다.(XE2 기준)

또한 아래와 같이 Response.ContentType 을 지정하여야 합니다.

procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.ContentType:= 'text/html; charset=utf-8';
Response.Content := PageProducer1.Content;
end;

Form 에서 데이터를 Query 하는 방법에는 Post 와 Get 이 있는데
Get은 Url 상에 Query 내용이 보이는 것이고,
( http://localhost:8080/test?param=%ED%95%9C%EA%B8%80&hidden=hidden+%EB%AC%B8%EC%9E%90&submit=UTF-8+%ED%95%9C%EA%B8%80+%EC%9D%B4%EC%A0%95%EA%B7%80 )

Post는 Url 상에 Query 내용이 보이지 않는다는 점을 제외하고는 큰 의미는 없습니다.
( http://localhost:8080/test )
단, Get은 Get 이고 Post는 Post입니다. 가져오고, 뭔가를 보내고의 의미차이겠지요.

Query 를 읽어오는 방법에는
Request.ContentFields.Values['name'] 과
Request.QueryFields.Values['hidden'] 방법이 있는데,
Help 상에는 ContentFiels 는 mtPost에서 사용하는 것 처럼 되어 있고
QueryFields.Values 은 Hidden 필드를 읽어오는 것 처럼 되어 있어 이게 mtGet에서 작동되는 것처럼 곡해되고 있는 것 같습니다.

Request.ContentFields.Values['name'] 으로 모두 읽어 올 수 있습니다.

그리고 가장 중요한 것은!!!!!!!!!!!!!!
이렇게 읽어온 UTF-8 문자가 일부 깨어진다는 점입니다.

이것을 해결하기위하여 거의 하루를 삽집하였습니다.

결론은 항상그러하듯이 너무 허망하네요..

Progect에 아래와 같이   utf8ContentParser 를 포함만 시켜주면 됩니다.

program Project2;
{$APPTYPE GUI}

uses
  Vcl.Forms,
  Web.WebReq,
  IdHTTPWebBrokerBridge,
  utf8ContentParser,
  FormUnit1 in 'FormUnit1.pas' {Form1},
  WebModuleUnit1 in 'WebModuleUnit1.pas' {WebModule1: TWebModule};


이렇게 할경우 Get 에서는 Hidden 필드의 한글이 깨어 지네요.
역시나 Hidden 필드는 QueryFields.Values['hidden']으로 읽어와야 깨어지지 않습니다.

2013년 6월 5일 수요일

아이패드에서 윈도우 95 설치하고 델파이 2.0 사용하기(3)

IPAD 에서 Windows95 를 샐행 시키기 위히여는 부팅이 가능한 img 파일이 있어야합니다.
이를 위하여는
1. 데스크탑에 DOSBOX를 설치하고
* IMG 파일을 생성하기 위하여는 DOSBOX SVN 버전을 설치하여야 합니다.(다음 카페)
2. IMG 파일을 생성한 다음
3. 이미지 파일을 FDISK 로 파트션을 만들고 포맷합니다.
4. 이미지 파일에 SYS 명령을 이용하여 부트로더와 io.sys msdos.sys 파일을 복사한다.
5. 이미지 파일에 윈도우 95를 설치용 파일을 복사 합니다.
6. 설치된 윈도우 이미지 파일에 델파이 설치 프로그램도 복사합니다. (1.0 과 2.0 같이)
7. 이미지 파일(Lee520g.img)을 마운트하고 부팅합니다.
8. 윈도우95를 설치합니다.
9. DOSBOX를 종료하고 다시 시작하여 Lee510g.img 를 마운트 하고 부팅합니다.
10. 윈도우95 기본 화면이 나타납니다.
11.(중요) 시작 > 실행 하여 SYSEDIT 하여 SYSTEM.INI 파일을 수정합니다.
[boot]
.........
shell=ProgMan.exe
..........
12. 윈도우 95를 종료합니다.
13. IPAD를 데스크탑에 연결하고 iFUNbox 프로그램을 이용하여 iDOS의 Documents 폴더에 Lee520g.lee 파일을 복사합니다.
14. IPAD 에서 iDOS앱을 실행합니다.
15. dospad.cfg를 수정합니다. [CPU 속도 이미지 오른쪽의 아이콘 터치]
[cpu]
.............
core= normal ; simple 도 가능
cycles= 6000  ;정도 max 도 가능
cputype = 386  ;정도로 바꾸어 보심도...
.............
15: c:\ 아이콘을 터치하여 DOS 모드로 진입합니다.
16. dir 하여 lee520g.img 파일을 확인합니다.
17. imgmount d lee520g.img 하여 d 드라이버로 마운트 합니다.
18. boot lee520g.img 하여 이미지로 부팅합니다.
19. 윈도우 95가 실행되고 TaskMan 이 셀로서 실행되어 있음을 확인 할수 있습니니다.

* shell 로서 ProgMan을 사용하는 것은 explorer.exe 가 워낙 버겁고, 에러가 자주 발생되기 때문입니다. explorer 은 데스크탑에서도 상당히 골치 아픈 프로그램 이었습니다.

20. ProgMan 에 winfile을 등록합니다.
21. 델파이 1.0 폴더로 이동하여 setup.exe 를 샐행하여 Delphi 1.0을 설치합니다.
22. 델파이 2.0 폴더로 이동하여 setup.exe 를 실행하여 Delphi 2.0을 설치합니다.
- 2.0을 설치하면 ***32.exe 에서 에러가 나서 설치 할 수 없습니다. 라는 메세지가 보입니다.
- 인스톨실드가 iDOS에 없는 루틴을 실행하려는 것 같습니다.
- 걱정하지 마십시요. 프로그램은 정상적으로 복사되어 설치되어 있으니
- ProgMan을 이용하여 등록하면 됩니다.

* 참고로 제가 iPAD 에서 iDOS 환경을 통해서라도 window 환경에서 Delphi 를 설치하려는 것은 그동안에 익힌 프로그램 기술을 활용하여 나만의 프로그램을 iPAD에서 구현해 보려고 하는 것입니다.
* 덕분에 간단한 자기학습용(암기 도우미) 프로그램을 델파이로 간단하게 만들어서 공부 한 결과 59이라는 많은 나이에도 불구하고 소방설비기사(전기) 자격증을 획득하게 되었습니다.
* 소방설비기사(기계) 1차를 합격하고 2차를 준비하면서도 암기 도우미를 활용하여 공부 할려고 합니다.

아이패드에서 윈도우 95 설치하고 델파이 2.0 사용하기(2)

IDOS에서 윈도우95 환경에서 델파이 2.0을 실행 한 이미지 입니다.

IDOS에서 IPAD를 행으로 놓고 시작 LEE520G.IMG 확인
LEE520G.IMG 로 mountting, booting
windos95 가 실행 되고 있는 모습
Shell 프로그램을 Explorer가 아니고 TaskMan으로 바꿈
Delphi 2.0 에서 컴파일 하여 디버깅모드로 실행중

아이패드에서 윈도우 95 설치하고 델파이 2.0 사용하기(1)

아이패드에 IDOS 앱이 올라온이후 예전 도스용 프로그램을 아이패드에서 실행해 볼 수 있습니다. 저는 아이패드2에서 윈도우 95와 윈도우 98을 실행해 보았는데 윈도우98은 실행에 문제가 많더군요.

우선 기본적인 지식이 있어야 할 것 같습니다.
IDOS 앱에 대하여 알아야 합니다.
이앱은 윈도우또는 다른 OS(예를들어 Linux)에서 예전 도스용 게임을 실행 시킬 목적으로 개발된 DOSBOX의 소스(소스는 공개되어 있습니다)를 이용하여 IPAD, IPHONE 등에서 돌아가도록 컴파일 하여 올려 놓은것 같습니다.

DosBox는 우리나라 다음카페에서 관련 정보와 자료를 얻을 수 있습니다.

윈도우에 대해서도 알아야 겠네요.
윈도우3.1은 도스 프로그램이며 GUI만 윈도우라도 보면 됩니다.
DOS나 윈도우 3.1은 16비트용 프로그램입니다. 기본적으로 80286 이상의 CPU 에서 돌아가지요.
델파이 1.0은 16비트용 터보파스칼 컴파일러를 사용하여 16비트용 실행 프로그램을 만들어 냅니다. 해서 도스상태에서 윈도우 3.1을 실행시켜 윈도우 3.1의 WinAPI를 이용하여 실행프로그램을 실행합니다.

CPU 기술이 발달되어 80386이 나오면서 32비트 처리가 가능하여 윈도우95가 탄생하였으며 OS로서의 자리 매김을 하게 되었습니다. 그러나 윈도우 95는 16비트와 32비트 과도기에 만들어진 OS라서 16비트 프로그램과 32 비트 프로그램의 호완성을 갖게하였습니다. 시장에 맞추었다고 보면 되겠네요.

윈도우 95부터는 부팅자체를 윈도우로만 하게 기본으로 하였습니다. 만, MSDOS를 먼저 실행 시키고 윈도우 95를 실행 시켜도됩니다.

이방법을 이용하면 IDOS에서 MSDOS를 샐행하고 이미 설치된 윈도우95를 실행 해도 되어야 하는데 몇가지 시도를 해보았지만 실패하였습니다.
IDOS에 깔려 있는 DOS가 MSDSO와 호환되지 않아서죠. 윈3.1과는 호환되는데요...

윈도우 95를 설치하기 위하여는 인스톨 과정을 거쳐 하드디스크를 FAT-16(?)으로 포멧하고 부트로더 즉 IO.SYS를 하드에 깔아 이 IO.SYS를 이용하여 부팅하게 합니다. IDOS 에서 윈95를 실행하지 못하는 원인도 이것 때문 인것 같습니다.

IDOS 상태에서만으로 윈도우 95를 설치 할 수는 없는 이유이지요.(IDSO가 win95 호환의 IO.SYS를 지원하기되면...)

DOSBOS 나 IDOS에는 mount, imgmount, boot 라는 개념이 있습니다.
윈도우시스템에 있는 특정 폴더나 이미지파일을 하드디스크로 에뮬레이트하여 DOSBOX 나 IDOS에서 새로룬 하드디스크로 인지하게 할수 있으며, mount 된 가상 하드디스크로 부팅을 할 수 있다는 것입니다.

너무 길어져서 다음에 계속 할께요..

2013년 4월 22일 월요일

윈도우의 CMD 명령어


http://ss64.com/nt 에서 긁어 왔습니다. 링크 찾아가면 상세 설명있습니다.
a
   ADDUSERS Add or list users to/from a CSV file
   ADmodcmd Active Directory Bulk Modify
   ARP      Address Resolution Protocol
   ASSOC    Change file extension associations?
   ASSOCIAT One step file association
   AT       Schedule a command to run at a specific time
   ATTRIB   Change file attributes
b
   BCDBOOT  Create or repair a system partition
   BCDEDIT  Manage Boot Configuration Data
   BITSADMIN Background Intelligent Transfer Service
   BOOTCFG  Edit Windows boot settings
   BROWSTAT Get domain, browser and PDC info
c
   CACLS    Change file permissions
   CALL     Call one batch program from another?
   CERTREQ  Request certificate from a certification authority
   CERTUTIL Utility for certification authority (CA) files and services
   CD       Change Directory - move to a specific Folder?
   CHANGE   Change Terminal Server Session properties
   CHKDSK   Check Disk - check and repair disk problems
   CHKNTFS  Check the NTFS file system
   CHOICE   Accept keyboard input to a batch file
   CIPHER   Encrypt or Decrypt files/folders
   CleanMgr Automated cleanup of Temp files, recycle bin
   CLEARMEM Clear memory leaks
   CLIP     Copy STDIN to the Windows clipboard
   CLS      Clear the screen?
   CLUSTER  Windows Clustering
   CMD      Start a new CMD shell
   CMDKEY   Manage stored usernames/passwords
   COLOR    Change colors of the CMD window?
   COMP     Compare the contents of two files or sets of files
   COMPACT  Compress files or folders on an NTFS partition
   COMPRESS Compress individual files on an NTFS partition
   CON2PRT  Connect or disconnect a Printer
   CONVERT  Convert a FAT drive to NTFS
   COPY     Copy one or more files to another location?
   CSCcmd   Client-side caching (Offline Files)
   CSVDE    Import or Export Active Directory data
d
   DATE     Display or set the date?
   DEFRAG   Defragment hard drive
   DEL      Delete one or more files?
   DELPROF  Delete user profiles
   DELTREE  Delete a folder and all subfolders
   DevCon   Device Manager Command Line Utility
   DIR      Display a list of files and folders?
   DIRUSE   Display disk usage
   DISKPART Disk Administration
   DISKSHADOW Volume Shadow Copy Service
   DNSSTAT  DNS Statistics
   DOSKEY   Edit command line, recall commands, and create macros
   DriverQuery Display installed device drivers
   DSACLs   Active Directory ACLs
   DSAdd    Add items to active directory (user group computer)
   DSGet    View items in active directory (user group computer)
   DSQuery  Search for items in active directory (user group computer)
   DSMod    Modify items in active directory (user group computer)
   DSMove   Move an Active directory Object
   DSRM     Remove items from Active Directory
e
   ECHO     Display message on screen?
   ENDLOCAL End localisation of environment changes in a batch file?
   ERASE    Delete one or more files?
   EVENTCREATE Add a message to the Windows event log
   EXIT     Quit the current script/routine and set an errorlevel?
   EXPAND   Uncompress files
   EXTRACT  Uncompress CAB files
f
   FC       Compare two files
   FIND     Search for a text string in a file
   FINDSTR  Search for strings in files
   FOR /F   Loop command: against a set of files?
   FOR /F   Loop command: against the results of another command?
   FOR      Loop command: all options Files, Directory, List?
   FORFILES Batch process multiple files
   FORMAT   Format a disk
   FREEDISK Check free disk space (in bytes)
   FSUTIL   File and Volume utilities
   FTP      File Transfer Protocol
   FTYPE    File extension file type associations?
g
   GETMAC   Display the Media Access Control (MAC) address
   GLOBAL   Display membership of global groups
   GOTO     Direct a batch program to jump to a labelled line?
   GPRESULT Display Resultant Set of Policy information
   GPUPDATE Update Group Policy settings
h
   HELP     Online Help
i
   iCACLS   Change file and folder permissions
   IF       Conditionally perform a command?
   IFMEMBER Is the current user a member of a Workgroup
   IPCONFIG Configure IP
k
   KILL     Remove a program from memory
l
   LABEL    Edit a disk label
   LOCAL    Display membership of local groups
   LOGEVENT Write text to the event viewer
   LOGMAN   Manage Performance Monitor
   LOGOFF   Log a user off
   LOGTIME  Log the date and time in a file
m
   MAPISEND Send email from the command line
   MBSAcli  Baseline Security Analyzer
   MEM      Display memory usage
   MD       Create new folders?
   MKLINK   Create a symbolic link (linkd) ?
   MODE     Configure a system device
   MORE     Display output, one screen at a time
   MOUNTVOL Manage a volume mount point
   MOVE     Move files from one folder to another?
   MOVEUSER Move a user from one domain to another
   MSG      Send a message
   MSIEXEC  Microsoft Windows Installer
   MSINFO32 System Information
   MSTSC    Terminal Server Connection (Remote Desktop Protocol)
   MV       Copy in-use files
n
   NET      Manage network resources
   NETDOM   Domain Manager
   NETSH    Configure Network Interfaces, Windows Firewall & Remote access
   NETSVC   Command-line Service Controller
   NBTSTAT  Display networking statistics (NetBIOS over TCP/IP)
   NETSTAT  Display networking statistics (TCP/IP)
   NOW      Display the current Date and Time
   NSLOOKUP Name server lookup
   NTBACKUP Backup folders to tape
   NTRIGHTS Edit user account rights
o
   OPENFILES Query or display open files
p
   PATH     Display or set a search path for executable files?
   PATHPING Trace route plus network latency and packet loss
   PAUSE    Suspend processing of a batch file and display a message?
   PERMS    Show permissions for a user
   PERFMON  Performance Monitor
   PING     Test a network connection
   POPD     Return to a previous directory saved by PUSHD?
   PORTQRY  Display the status of ports and services
   POWERCFG Configure power settings
   PRINT    Print a text file
   PRINTBRM Print queue Backup/Recovery
   PRNCNFG  Display, configure or rename a printer
   PRNMNGR  Add, delete, list printers set the default printer
   PROMPT   Change the command prompt?
   PsExec     Execute process remotely
   PsFile     Show files opened remotely
   PsGetSid   Display the SID of a computer or a user
   PsInfo     List information about a system
   PsKill     Kill processes by name or process ID
   PsList     List detailed information about processes
   PsLoggedOn Who's logged on (locally or via resource sharing)
   PsLogList  Event log records
   PsPasswd   Change account password
   PsPing     Measure network performance
   PsService  View and control services
   PsShutdown Shutdown or reboot a computer
   PsSuspend  Suspend processes
   PUSHD    Save and then change the current directory?
q
   QGREP    Search file(s) for lines that match a given pattern
   Query Process    Display processes (TS/Remote Desktop)
   Query Session    Display all sessions (TS/Remote Desktop)
   Query TermServer List all servers (TS/Remote Desktop)
   Query User       Display user sessions (TS/Remote Desktop)
r
   RASDIAL  Manage RAS connections
   RASPHONE Manage RAS connections
   RECOVER  Recover a damaged file from a defective disk
   REG      Registry: Read, Set, Export, Delete keys and values
   REGEDIT  Import or export registry settings
   REGSVR32 Register or unregister a DLL
   REGINI   Change Registry Permissions
   REM      Record comments (remarks) in a batch file?
   REN      Rename a file or files?
   REPLACE  Replace or update one file with another
   Reset Session  Delete a Remote Desktop Session
   RD       Delete folder(s)?
   RMTSHARE Share a folder or a printer
   ROBOCOPY Robust File and Folder Copy
   ROUTE    Manipulate network routing tables
   RUN      Start | RUN commands
   RUNAS    Execute a program under a different user account
   RUNDLL32 Run a DLL command (add/remove print connections)

s
   SC       Service Control
   SCHTASKS Schedule a command to run at a specific time
   SCLIST   Display Services
   SET      Display, set, or remove session environment variables?
   SETLOCAL Control the visibility of environment variables?
   SETX     Set environment variables
   SFC      System File Checker
   SHARE    List or edit a file share or print share
   ShellRunAs Run a command under a different user account
   SHIFT    Shift the position of batch file parameters?
   SHORTCUT Create a windows shortcut (.LNK file)
   SHOWGRPS List the Workgroups a user has joined
   SHOWMBRS List the Users who are members of a Workgroup
   SHUTDOWN Shutdown the computer
   SLEEP    Wait for x seconds
   SLMGR    Software Licensing Management (Vista/2008)
   SOON     Schedule a command to run in the near future
   SORT     Sort input
   START    Start a program, command or batch file?
   SU       Switch User
   SUBINACL Edit file and folder Permissions, Ownership and Domain
   SUBST    Associate a path with a drive letter
   SYSTEMINFO List system configuration
t
   TAKEOWN  Take ownership of a file
   TASKLIST List running applications and services
   TASKKILL Remove a running process from memory
   TIME     Display or set the system time?
   TIMEOUT  Delay processing of a batch file
   TITLE    Set the window title for a CMD.EXE session?
   TLIST    Task list with full path
   TOUCH    Change file timestamps  
   TRACERT  Trace route to a remote host
   TREE     Graphical display of folder structure
   TSSHUTDN Remotely shut down or reboot a terminal server
   TYPE     Display the contents of a text file?
   TypePerf Write performance data to a log file
u
   USRSTAT  List domain usernames and last login
v
   VER      Display version information?
   VERIFY   Verify that files have been saved?
   VOL      Display a disk label?
w
   WAITFOR  Wait for or send a signal
   WHERE    Locate and display files in a directory tree
   WHOAMI   Output the current UserName and domain
   WINDIFF  Compare the contents of two files or sets of files
   WINMSDP  Windows system report
   WINRM    Windows Remote Management
   WINRS    Windows Remote Shell
   WMIC     WMI Commands
   WUAUCLT  Windows Update
x
   XCACLS   Change file and folder permissions
   XCOPY    Copy files and folders

FSUTIL 명령어 살펴보기

http://ss64.com/nt/fsutil.html
http://ss64.com/nt/fsutil.html 에서 긁어 왔습니다.
File and Volume specific commands, Hardlink management, Quota management, USN, Sparse file, Object ID and Reparse point management
Create a hardlink
    FSUTIL hardlink create new_filename existing_filename
    Eg : fsutil hardlink create c:\foo.txt c:\bar.txt
Create a new file of a specific size
    FSUTIL file createnew filename
    Eg : fsutil file createnew C:\testfile.txt 1000
Set the short NTFS filename for a file
    FSUTIL file setshortname filename shortname
    Eg : fsutil file setshortname C:\testfile.txt tes1.txt
Set the valid data length for a file
    FSUTIL file setvaliddata filename datalength
    Eg : fsutil file setvaliddata C:\testfile.txt 4096
Set the zero data for a file
    FSUTIL file setzerodata offset=val length=val filename
    offset : File offset, the start of the range to set to zeroes
    length : Byte length of the zeroed range
        Eg : fsutil file setzerodata offset=100 length=150 C:\Temp\sample.txt
List all drives (including mapped and Subst drives)
    FSUTIL fsinfo drives
Query drive type for a drive
    FSUTIL fsinfo drivetype volume pathname
    Eg : fsutil fsinfo drivetype C:
    ListLocalDrives.cmd - List all drives on the local computer
Query volume information
    FSUTIL fsinfo volumeinfo volume pathname
    Eg : fsutil fsinfo volumeinfo C:\
Query NTFS specific volume information
    FSUTIL fsinfo ntfsinfo volume pathname
    Eg : fsutil fsinfo ntfsinfo C:
Query file system statistics
    FSUTIL fsinfo statistics volume pathname
    Eg : fsutil fsinfo statistics C:
QUOTA Management
    FSUTIL quota {query|disable|track|enforce } C:
    
    FSUTIL quota violations
    
    FSUTIL quota modify volume_pathname threshold limit user

    Eg : fsutil quota modify c: 3000 5000 domain\user
Find a file by user name (if Disk Quotas are enabled)
    FSUTIL file findbysid user directory

    Eg : fsutil file findbysid scottb C:\users
File system options:
    FSUTIL behavior query option

    FSUTIL behavior set option

      Where option is one of:
       allowextchar {0|1}       Allow extended characters in filenames
       disablelastaccess {0|1}  Don’t generate last-access times
       quotanotify NumSeconds   Log quota violations, default=3600 seconds
       mftzone {1|2|3|4}        Set MFT Zone, multiple of 200MB
       Bugcheckoncorrupt {0|1}  Enable bugcheck  #
       disablecompression {0|1} Disable compression #
       disableencryption {0|1}  Disable encryption  #
       encryppagingfile {0|1}
       memoryusage {1|2}           Paged-pool memory cache, 1=default #
       symlinkevaluation L2L:{0|1}    Local to local symbolic links #
       symlinkevaluation L2R:{0|1}    Local to remote symbolic links #
       symlinkevaluation R2R:{0|1}    Remote to local symbolic links #
       symlinkevaluation R2L:{0|1}    Remote to remote symbolic links #
       DisableDeleteNotify {0|1}      Delete notifications for all volumes#
       disable8dot3 [volumePath] sfnNum
          sfnNum is between 0 and 3 
           0 = Create short file names (default).
           1 = don’t create short file names. 
           2 = Set 8.3 names on a per volume basis.
           3 = Disable 8.3 names on all volumes except the system volume.

1 = enable option
0 = Disable option
# = Windows7/2008 option

    Eg :  FSUTIL behavior query disable8dot3 
          FSUTIL behavior set disablelastaccess 1

    FSUTIL dirty query volume pathname

    FSUTIL dirty set volume pathname

    Marking a disk as dirty will prompt a Chkdsk at next boot
    Eg :  FSUTIL dirty query C:
Query a reparse point
    FSUTIL reparsepoint query filename

    Eg : fsutil reparsepoint query C:\Server
Delete a reparse point
    FSUTIL reparsepoint delete filename

    Eg : fsutil reparsepoint delete C:\Server
Edit an object identifier
    FSUTIL objectid {query | set | delete | create}
Set sparse file properties
    FSUTIL sparse queryflag filename
    FSUTIL sparse setflag filename

    FSUTIL sparse queryrange filename
    FSUTIL sparse setrange filename
    
    Eg : fsutil sparse queryflag "C:\My Test.txt"
Query the allocated ranges for a file
    FSUTIL file queryallocranges offset=val length=val filename

    offset : File Offset, the start of the range to query
    length : Size, in bytes, of the range

    Eg : fsutil file queryallocranges offset=1024 length=64 C:\Temp\sample.txt
To run FSUTIL, you must be logged on as an administrator or a member of the Administrators group.

2013년 4월 2일 화요일

iPAD 에서 델파이 1.0 실행하기

iPAD 에서 델파이(터보파스칼)를 실행 하기 위해서는 아래와 같은 방법이 있습니다.

1. 도스환경에서 터보파스칼 3(한글 처리 때문에 이것을 권합니다)
2. 윈도우 3.1 환경에서 델파이 1.0 실행하기
3. 이미지 파일을 만들고 이 미미지 파일로 부팅하여 윈 95 환경에서 델파이 2.0 실행하기

참고로  윈도우 3,1은 16 비트 프로그램이고 윈32는 16 비트와 32 비트 가능합니다.
델파이 1.0은 16 비트 환경에서 돌아가고 델파이 2.0 은 32 비트 환경에서 돌아갑니다.

몇가지의 시행 착오 끝에 아이패드2 에서는 윈도우 95를 돌리는 것은 약간 느리고,
그것에 델파이 2.0 까지 돌리려면 상당한 인내가 필요할 것입니다.

IPAD에서 위와 같이 델파이(파스칼)을 돌리려는 시도는 나 자신의 프로그램을 만들어  이동 중이나 휴대중에 프로그램을 돌려 보려는 것입니다. 그리고 필요하다면 현장에서 곧바로 소스를 수정해 볼 수 있으니 좋겠지요.

효용성을 높이기 위하여는 자신의 데스크 탭에 DOSBOX라는 프로그램을 설치하여 아이패드와 동일 한 환경을 만들어 본 작업은 데스크탭에서 하고 필요하면 iPAD를 연결하여 파일을   보내어 실행 하면 되겠습니다.

윈도우 3.1 에서 사용한다면 속도나 활용도가 상당 하다는 것을 알게될것입니다.


구현하는 방법은 iDOS 라는 앱(2013년 3월 현재)을 iPAD(순정)에 설치합니다.
데스크 탭에 iFunBox 라는 프로그램을 다운 받아 설치합니다.
iFUNBOX는 아이튠과 같이 파일을 아이패드에 옮길 수 있습니다.

준비하여야 할 것은
0. iPAD2, DESKTOP(아이툰 설치된)
1. 한글 윈도우 3.1
2. iFunBOX
3. delphi 1.0

윈도우 설치 방법은 상상외로 간단합니다.
1. 한글 윈도우 3.1 파일을 폴더로 만들어 iFunBOX를 이용하여
 - iDOS 의 Documents 폴더에 저장합니다. (이 Documents 가 c: 가 됩니다)
2. iPAD 설치 폴더에서 Setup 하면 Windows 라는 폴더에 윈도우 3.1 이 설치 됩니다.
 - 설치시 그래픽카드는 VGA를 선택하시고 나중에 SVGA로 바꾸시면 됩니다.
 - iDOS는 S3 를 잡게 되어있는데 화면 오른쪽에 약간 어긋남이 있어 기본을 이용 하기로 하였습니다.
3. 프로그램 메니져(progman.exe) 만 덜렁하니 화면에 올라 올것입니다.
 - 파일 메뉴를 선택하여 프로그램 그룹을 만들도 그 그룹에 필요한 프로그램을 올리면 됩니다. 참고로 그 그룹이름은 한글로 입력하면 되지만, 그룹파일명을 영문으로 하여야 됩니다.
* iDOS는 이 부분에 문제가 있어 자동으로 필요한 프로그램을 모아 오지 못하는 것 같습니다. 차차 DOSBOX가 버전업 되면 해결 되겠지요. 그렇게 되면 윈95도 잘 돌려 볼 수 있을 것 같습니다.
 - 이 때 c:\windows\winfile.exe 를 꼭 그룹에 등록하세요.
 - 물론 실행(R)을 이용해도 되지만요.
4. 델파이 설치용 파일 디스켓 십여개를 하나의 폴더에 모아 놓고 그것을 iFUNBOX를 이용하여 iPAD에 복사한다음
5. 윈도우3.1을 구동하고(c:>cd windows   c:>win)
 - 참고로 마우스 설정 부분에서 약간의 조정이 필요 할 것입니다.
 - 또한 약간의 숙달 과정이 필요합니다.
 - 마우스 커서를 해당되는 객체에 옮기고, 화면을 가볍게 뚝 두루리면 왼쪽 크릭이 된 것입니다.
 - 오른쪽 크릭은 가로 화면에서 화면 오른쪽의 버튼을 이용 해도 되지만, 마우스 커서를 해당 객체에 옮겨 하나의 손가락을 이용해 가볍게 터치하고, 이어서 오른쪽에서 손가락으로 한번더 터지를 하면 오른쪽 버튼이 크릭되는 것입니다.
 - 드래그 앤 드롭( drag & drop)은 저도 처음에는 할 줄 몰라 여간 고민을 많이 했는데 약간의 신중 함만 있으면 별로 어렵지 않게 사용이 가능합니다.
 - 역시 마우스커서를 해당 객체에 위치 시키고 한손가락을 잠시 누르면 바탕에 지문 이미지가 나타나고 이때 다른 손가락으로(저는 검지를 처음에 나중에 중지를 이용) 화면을 가볍게 누르고 옮기면 옮겨 집니다. ^.^; 연습 많이 하세요.
6. 아까 복사해온 델파이1.0 폴더 안의 setup.exe를 크릭하면 설치하여 프로그램그룹(영문)을 자동으로 만들어 줍니다.
* 참고로 iPAD를 가로로 하여 화면 상단을 살며시 당기면 키보드와 마우스등을 설정 할 수 있습니다.
7. 사운드 카드는 자동으로 잡아 오른것 같더군요. 저는 필요가 없어서 설치하지 않았습니다.
* 다음에는 컴 포트도 설치 해볼 요량입니다.
8. 윈도우에서 하거나, 나가서 하거나 setup.exe를 다시 실행하여 비디오카드를 svga(800 x 640)으로 바꾸어 보십시요.


아래 이미지는 실제 운용 한 결과 입니다.
다음번에 win95를 구동하는 방법을 설명하도록 하겠습니다. 구글하면 좋은 방법을 찾을 수 있을 것입니다.

2013년 3월 1일 금요일

Topstyle 에서 한글 사용하기

Topstyle 은 CSS, Html 텍스트 타입 편집기로는 정말 좋은데 한글을 사용 할 수 없다는 것이 아쉬어서 국내에서는 별로 사용하지 않고 있는것 같으네요. 

저도 몇번 한글을 사용해보려고 시도 해보았다가 별로 좋은 결과가 없어 사용을 미루었는데 이러한 방법이면 어떻겠나하고 해보앗더니, 아쉬운데로 사용 할 만 하네요. 

Notepad++ 과 같이 같은 화일을 열어 놓고 사용하면 그런데로 사용 하실만 할 것입니다.
 
방법은 아래에 같이 따라해보세요.
1. AutoReplace 기능을 활용하는 것입니다. 그림만 보면 충분히 이해가 가실 것입니다.
[Option > Options... > Editor > Auto Replace > Html > Add.. 버튼]
하신다음 자신이 좋아하는 단축키를 등록합니다.
저는 ~~ 문자에 , <p>{$Hangle text}<!DOCTYPE></p>  과 같이 등록하였습니다.

한글을 입력하고 싶으면 ~~ + SpaceBar 를 치면 한글을 입력할 수 있는 다이알로그 박스가 뜸니다.



2. 그런데 한글이 화면에 절반 밖에 안 보일것입니다. 이곳에서 대 실망..
[Option > Options... > Editor > Font > ... 버튼] 를 누르시면 글꼴이 Courier New 라고 되어 있을 것입니다. 확인 만 하시고 바꾸진 마세요.

오른쪽 아래에 스크립트(R)이 있는데 이곳을 베트남어 정도로 바꾸어 주고 확인 버튼 누르고 나옵니다.
한글이 제대로 보이고 간단한 입력도 가능합니다.

3. 그런데 한글 수정이 힘듭니다. 택스트 편집기 Notepad++을 실행 한다음 동일 파일을 열어서 그곳에서 수정 하시면 됩니다.
수정이 끝나고 Topstyle로 돌아오면 리로딩 할거냐고 묻습니다. 당연히 OK(Yes) 하시면 되고요. NotePad++ 을 열어 놓은 상태로 두었다가 다시 수정하시고 싶으시면 NotePad++로 전환하면 역시나 리로딩을  묻습니다.

도움되셨기를 ...

2013년 1월 27일 일요일

DataSnap REST 에서 한글(utf8) 사용

DataSnap REST 에서 한글(utf8)을 사용하려고 Template의 html의 헤더에
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
을 포함하여도 한글이 제대로 표현되지 않습니다.

예전에 WebBroker 에서 한글처리하기 위하여서는
해당 엑션에서
Response.ContentType := 'text/html; charset=utf-8';
Response.ContentEncoding := 'utf-8';
지정하여 하였었습니다.

DataSnap Rest 에서는
WebModuleUnit1.pas 에서


procedure TWebModule1.WebModuleBeforeDispatch(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
  Response.ContentType := 'text/html; charset=utf-8'; // 추가
  Response.ContentEncoding := 'utf-8'; //추가
  if FServerFunctionInvokerAction <> nil then
    FServerFunctionInvokerAction.Enabled := AllowServerFunctionInvoker;
end;


하여서 해결하였습니다.


2013년 1월 24일 목요일

windows7 에서 엑셀 2007 xls adoquery로 읽기

windows7 에서 엑셀 2007 xls adoquery로 읽기위하여는

폼에 AdoQuery를 올려 놓고 ConnectionString 에
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Administrator\Desktop\Example2.xls;Extended Properties=Excel 12.0;
와 같이 입력하면 됩니다.

단, 엑셀에서 데이터 베이스로 설정 할 영역을 이름을 주어야 합니다.
그런후 Sql 에 Select * from name  where 1
와 같은 방법으로 접근하면 됩니다.

2013년 1월 18일 금요일

특정 폴더 찾기


uses WinApi.Shlobj, ActiveX;

procedure TForm2.Button1Click(Sender: TObject);
var
  PIDL: PItemIDList;
  // Path: String;
  Path: PChar;
  Folder: integer;
  AMalloc: IMalloc;
begin
  Folder:= CSIDL_INTERNET_CACHE;
  // SetLength(Path,MAX_PATH);
  Path:= StrAlloc(Max_Path);
  SHGetSpecialFolderLocation(Application.Handle, Folder, PIDL);
  // if SHGetPathFromIDList(PIDL, pChar(Path)) then
  if SHGetPathFromIDList(PIDL, Path) then
    Edit1.Text:= Path;
  SHGetMalloc(AMalloc);
  StrDispose(Path);
end;

Path 변수를 String 과 PChar 2가지의 방법으로 구현하여 보았습니다.
당연 String 으로 할 경우에는 StrDispose 가 필요없습니다.

ShellListView 에서 필터 구현하기

ShellListView 컴포넌트는 델파이 샘플프로그램에 있으니 설치하면 됩니다.

저의 경우에는
C:\Users\Public\Documents\RAD Studio 9.0 Samples\Delphi\VCL\ShellControls
에 있습니다.

폼에 FilterComboBox 와 ShellListView 컴포넌트를 올려 놓습니다.


unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.FileCtrl, Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.Shell.ShellCtrls;

type
  TForm2 = class(TForm)
    ShellListView1: TShellListView;
    Panel1: TPanel;
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    FilterComboBox1: TFilterComboBox;
    procedure ShellListView1AddFolder(Sender: TObject; AFolder: TShellFolder;
      var CanAdd: Boolean);
    procedure FilterComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FilterComboBox1Change(Sender: TObject);
begin
  ShellListView1.Refresh;
end;

procedure TForm2.ShellListView1AddFolder(Sender: TObject; AFolder: TShellFolder;
  var CanAdd: Boolean);
var xFilterExt, xExt : string;
begin
  if FilterComboBox1.Mask <> '*.*' then begin
    xFilterExt:= ExtractFileExt(FilterComboBox1.Mask);
    xExt:= ExtractFileExt(AFolder.PathName);
    if (CompareText(xExt, xFilterExt) = 0) or AFolder.IsFolder then
      CanAdd:= True
    else
      CanAdd:= False;
  end;

end;

end.

prophet 를 이용하여 시계열 예측을 할때 설치가 안될때(fbprophet)

 pip install fbprophet 으로 설치가 안될때 python -m pip install prophet 으로 설치하고. fbprophet을 prophet으로 바꾸어 준다. from prophet import Prophet from p...