블로그 이미지
훅크선장

카테고리

분류 전체보기 (362)
사진이야기 (23)
펭귄컴퓨팅 (121)
컴퓨터보안 (84)
절름발이 프로그래머 (59)
C언어, C++ 과 Visual C+.. (12)
C# .net (1)
Delphi (40)
Python (5)
하드웨어개조 (23)
멀알려줄까 (35)
홈베이킹&홈쿠킹 (2)
잡다한것들 (15)
Total
Today
Yesterday

달력

« » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

공지사항

태그목록

최근에 올라온 글

ParamCount 와 ParamStr 을 이용하여, 명령어 인자를 처리할 수 있다.

Form이 있건, 없건 상관이 없다.

Console Program의 경우에 대해서, 다음과 같이 소스로 만들면 된다.
Form이 있는 프로그램인 경우에는, 아래 소스를 발췌하여, FormCreate() 함수에 추가하면 된다.

인자 사용법은 실행시에,
c:>  Project1.exe  -a:HERE_IS_A  -b:THRER_IS_B
와 같이 씁니다.

아래소스에는 반드시 FastStrings 모듈을 추가해서 사용해야 합니다.

--------------------------------------------------------------------------------
program Project1;

{$APPTYPE CONSOLE}

uses
  Sysutils,
  Classes,
  Dialogs,
  FastStringFuncs in 'src\FastStringFuncs.pas',
  FastStrings in 'src\FastStrings.pas';

var
   param_idx:integer;
   argumentstr, prefix, realarg : String;
   arguments : TStrings;

begin
  try
    { TODO -oUser -cConsole Main : Insert code here }
     for param_idx := 1 to ParamCount do
   begin
     //ShowMessage(ParamStr(param_idx));
     argumentstr := ParamStr(param_idx);
     if (argumentstr[1] = '-') then
     begin
       Split(Copy(argumentstr, 2, Length(argumentstr) - 1), ':', arguments);
       prefix := arguments[0];
       realarg := arguments[1];
       if ((arguments.Count = 2) and (Length(prefix) = 1)) then
       begin
         Case arguments[0][1] of
            'a' : ShowMessage( 'option a : ' + arguments[1]);
            'b' : ShowMessage( 'option b : ' + arguments[1]);
         else ;
         end;
       end;
     end;

   end;

  except
    on E:Exception do
      Writeln(E.Classname, ': ', E.Message);
  end;
end.
Posted by 훅크선장
, |
http://delphi.about.com/od/objectpascalide/a/delphi-md5-hash.htm
를 참조했습니다.

uses IdHashMessageDigest, idHash;

//returns MD5 has for a file
function MD5(const fileName : string) :string;
var
  idmd5 : TIdHashMessageDigest5;
  fs : TFileStream;
begin
  idmd5 := TIdHashMessageDigest5.Create;
  fs := TFileStream.Create(fileName, fmOpenRead OR fmShareDenyWrite) ;
  try
    result := idmd5.AsHex(idmd5.HashValue(fs)) ;
  finally
    fs.Free;
    idmd5.Free;
  end;
end;

2009 버전 이상에서는, 함수가 변경되어서, 다음과 같이 
//returns MD5 has for a file
function MD5(const fileName : string) :string;
var
  idmd5 : TIdHashMessageDigest5;
  fs : TFileStream;
begin
  idmd5 := TIdHashMessageDigest5.Create;
  fs := TFileStream.Create(fileName, fmOpenRead OR fmShareDenyWrite) ;
  try
    result := idmd5.HashStreamAsHex(fs);
  finally
    fs.Free;
    idmd5.Free;
  end;
end;
로 쓰면 됩니다.
Posted by 훅크선장
, |
아래의 펌글을 참고해서, Connection String을 만든다음,
Query를 통해서, 자료를 하나씩 가져오면 됩니다.

procedure TForm1.Button1Click(Sender: TObject);
var
  fullURL  : string;
  urllist : Tstringlist;
  ADOQuery1: TADOQuery;
begin
  ADOQuery1 := TADOQuery.Create(nil);
  ADOQuery1.ConnectionString := 'Provider=MSDASQL.1;Password=패스워드;Persist Security Info=True;User ID=사용자명;Data Source=데이터베이스 DSN 명칭';
  ADOQuery1.SQL.Text := 'select * from 테이블명';
  ADOQuery1.Open;
  ADOQuery1.First;
  urllist := TStringList.Create;
  while not ADOQuery1.Eof do
  begin
    fullURL := ADOQuery1.FieldByName('필드명').AsString;
    urllist.Add(fullURL);

    ADOQuery1.Next;
  end;

  Memo1.Lines := urllist;

end;
Posted by 훅크선장
, |
http://all4programer.blogspot.com/2008/03/how-to-connect-mysql-to-borland-delphi.html
에서 가져왔습니다.

----------------------------------------------------------------------------------

HOW TO CONNECT MYSQL TO BORLAND DELPHI USING MYODBC

HOW TO CONNECT MYSQL TO BORLAND DELPHI USING MYODBC

  1. Creating MySQL ODBC DataSource

  1. We need to install MyODBC (you can download from www.mysql.com)
  2. install MyODBC or MySQLODBC
  3. Create DSN for accesing trough ODBC, follow the step bellow :
  4. Go To Control Panel>>Administrative Tools>>Data Source (ODBC)
  5. When ODBC Data Source Administrator dialogs showed click Add.. button
  6. Create New Data Source dialog will show, choose MySQL ODBC Driver
  7. Click Finish until MySQL ODBC Driver DSN Configuration dialog showed
  8. Enter Data Source Name as you like
  9. fill all information that needed for connection to be occurred
  10. Click Test Data Source Button to testing the connection to MySQL Server
  11. Connection succeed
  12. MySQL ODBC Data Source created

  1. Connecting Data Source to Delphi using ADOConnection

  1. on your project application pick ADOConnection Component in ADO VCL Tab
  2. Put ADOConnection component into a form
  3. Double Click the ADOConnection on your form until Connection String Dialog Wizard appeared
  4. Choose Use Connection String and then click Build Button
  5. when Data link properties dialog box appeared on the provider tab choose Microsoft OLEDB Provider for ODBC Drivers
  6. Click Next Button
  7. On the Connection Tab, fill all the field
  8. Choose Use Data source name and fill thecombobox with MySQL ODBC Data source that we have been created before in DSN
  9. fill information for username, password, and fill the database that you want access in Combobox Enter initial catalog to use
  10. Test the connection with clicking the Test Connection Button
  11. Connection Succed
Posted by 훅크선장
, |
너무 간단한 내용인데,
처음에 이해를 못해서 한참 헤메는 실수를...


type
MyNewType = Integer;


이렇게 하면 됩니다. 새로운 변수 타입이 생긴겁니다.
C 언어 구문으로 보면,
typedef   int    MyNewType;
이 됩니다.

델파이에서 사용할때는,

implementation

function MyFunc(AString: String; AMaxChar: Integer): String;
var
aVar : MyNewType ;
begin
...
end;

아주 간단합니다.
Posted by 훅크선장
, |
http://www.programmersheaven.com/mb/delphikylix/245467/245467/pointer-to-function/
를 참고하였습니다.

---------------------------------------------------------------------------

type
TFuncPtr = function(arg1: Integer; arg2: PChar): Integer; stdcall;
TProcThread = class(TThread)
  ...
protected
  procedure SyncProc(Data: Pointer);
  ...
end;
function MyFunc(arg1: Integer; arg2: PChar): Integer; stdcall; 

procedure SetSyncProc(argFunc: TFuncPtr); external;

constructor TProcThread.Create;
begin
 ...
 SetSyncProc(MyFunc);
 ...
end;


Posted by 훅크선장
, |
Delphi for .NET이 없어지면서 생긴 Delphi Prism.

엠바카데로가 아예 M$ Visual Studio와 협약을 맺은 것인지...
Delphi Prism은 Visual Studio에 통합되었습니다.
단독 설치시에는 VS의 최소버전이 깔리는 것 같습니다.

.NET을 전격 지원하는 M$에 발 맞추기 위한 방법인 것 같은데,
사용자 입장에서는 Visual Studio 상에서 Object Pascal을 사용할 수 있고, 기존 Delphi의 다양한 컴포넌트를 사용할 수 있다는 점에서 좋습니다.

앞으로 .NET 개발에서 기존 델파이 사용자들에게 어떤 영향을 미칠지는 아직 의문입니다.


Posted by 훅크선장
, |

Embarcadero 본사에서 담당자가 직접 와서 발표한
Delphi / C++ Builder 2010의 New Features”Future of Delphi/C++ Builder” 를 듣고 왔습니다.

Delphi / C++ Builder 2010의 New Features 중에서 가장 눈에 띄는 것은
코드 포맷팅과 터치 인터페이스등과 같은 IDE 향상과 DB 지원 강화, 그리고 쓰레드 디버깅 지원입니다.

1) 코드 포맷팅은 사용자가 작성한 코드를 깔끔하게 정리하고, 여러 사람간의 공유시 혼돈은 방지해 줍니다.

2) 터치 인터페이스 지원은 넷북등의 모바일 장비에서 키보드나 마우스가 없이도 사용할 수 있는 어플리케이션 개발을 염두에 둔 것 같습니다.

3)  IDE 기능중에서 가장 재미난 점은 이전 Delphi 7에서 인기를 끌었던 도구 선택 인터페이스가 다시 등장한 것입니다. 델파이 개발자들이 끊임없이 Delphi 7의 도구선택 인터페이스를 돌려달라는 요구때문이었는지, 이번 2010버전에서 다시 예전 인터페이스를 사용할 수 있게 되었습니다.

4) DB 지원에서는 기존의 유명한 상용 DB에 더불어, 오픈 소스인 FireBird를 공식 지원하고 있습니다.

5) 쓰레드 디버깅 지원은 기존 쓰레드 디버깅에서는 개별 쓰레드 디버깅이 불가능하였지만, 개별 쓰레드 디버깅이 가능하게 되었습니다. 개별 쓰레드를 기준으로 타 쓰레드들을 thaw 하거나 freeze할 수 있게 되었습니다.


”Future of Delphi/C++ Builder”에서 향후 출시될 개발도구들의 개념을 보았습니다.

1) 먼저 기존의 컴파일러가 64비트까지 지원하기에는 구조상의 한계가 있어서, 새로운 컴파일러 즉 64/32 비트용의 새로운 컴파일러를 만들고 있다고 합니다. 이 컴파일러 개발 프로젝트는 ”Project Commodore”로 명명되어, 작년부터 시작되었다고 합니다.

2) 다음으로 크로스플랫폼을 지원하기 위한 프로젝트를 시작했다고 합니다.
현재 Delphi / C++ Builder는 Managed Code 기반이므로, 윈도우즈 플랫폼에서 윈도우즈용 어플리케이션만을 개발할 수 있습니다.
그러나, 새로운 프로젝트 ”Project X”는 Delphi / C++ Builder의 기반을 Native Code로 바꾸고, 크로스 컴파일과 리모트 디버깅을 지원하려고 하고 있습니다. 이 프로젝트가 완료되면, 윈도우즈 개발환경에서 Linux용 어플리케이션과 MacOS X 어플리케이션, WinCE, I-Phone 어플리케이션까지도 개발할 수 있을 것으로 보고 있습니다.

상당히 원대한 계획이고, 매우 기다려집니다.


지난 Kylix의 실패를 교훈삼아, 플랫폼에 종속된 IDE 환경을 만드는 것보다는 크로스플랫폼 기반을 목표로 하고 있는 점이 아주 고무적입니다.

Posted by 훅크선장
, |
Delphi Prism
 
New Delphi development solution for .NET and Mono 

* Delphi Prism programming language for .NET and Mono 
* Take advantage of the latest and greatest .NET technologies including WinForms, WPF, ASP.NET and LINQ 
* Use your existing Delphi programming skills to build .NET applications 
* Easily connect with all your data across multiple sources and tiers 
* Powered by RemObjects Oxygene compiler technology 

The fast way to build applications on .NET for Windows, Linux and Mac 

Delphi Prism is the new .NET development solution from Embarcadero Technologies. In this Visual Studio based solution you’ll be able to use your existing Delphi programming skills to build .NET applications, taking advantage of the latest and greatest .NET technologies such as WinForms, WPF, ASP.NET and LINQ. You will of course also be able to develop database applications using familiar dbExpress functionality and .NET clients that connect to native DataSnap servers. 

Key Delphi Prism features include: 

* Complete solution for .NET development 
* Powerful full featured Delphi Prism development language 
* dbExpress framework for building database applications 
* Supports development for the Mono platform 
* Database modeling and design based on ER/Studio 
* DataSnap client creation 
* Blackfish SQL database with included deployment license 

Delphi Prism Editions 
Delphi Prism is available in three editions - Professional, Enterprise and Architect. 

Delphi Prism Professional includes a complete development environment with dbExpress local database connectivity. Delphi Prism Professional features include: 

* Delphi Prism Object Pascal programming language and compiler 
* Microsoft Visual Studio based IDE 
* dbExpress local database connectivity to InterBase® and Blackfish™ SQL 
* Blackfish SQL deployment on systems with 1 user, 512MB database size 

Delphi Prism Enterprise edition includes everything in the Professional edition, plus the following for building client/server and multi-tier database and web applications: 

* Database server connectivity to InterBase and Blackfish SQL 
* Build DataSnap .NET clients that connect to native Windows DataSnap multi-tier database application servers 
* Blackfish SQL deployment on systems with 5 users, 2GB database size 

For more detailed differences between the editions, see the Datasheet or Feature Matrix. 
Posted by 훅크선장
, |
http://www.embarcadero.com/products/rad-studio

어제 28일자로, 공식적인 릴리즈가 되었습니다.

Embarcadero 라는 이름으로 (이전까지는 CodeGear 명칭을 붙여였는데...)
RAD Studio 2010 버전이 공식적으로 출시되었습니다.
물론 Delphi 2010과 C++ Builder 2010도 출시되었습니다.

테스트삼아 설치해보니, Programs Files 폴더 밑에 Embarcadero 디렉토리에 설치됩니다.

지금 사용하고 있는 2009 버전과 달라진 점은

일단 Windows 7 지원이 먼저이고,
두번째 가장 크게 눈에 띈 것이 .NET 개발 도구의 변화입니다.

RAD Studio 2007과 2009 버전에서는 Delphi for .NET 이라고 존재하였는데,
RAD Studio 2010버전부터는 Delphi Prism 이라고 아예 별도 솔루션화 하였습니다.
RAD Studio 2010 패키지는 총 DVD 3장으로 구성되어 있습니다.
1번 DVD는 Delphi and C++ Builder 2010
2번 DVD는 Delphi Prism 2010
3번 DVD는 Partner DVD

MS가 .NET만 밀고 있으므로, 코드기어 즉 엠바카데로 역시 개발도구로 그에 대한 지원을 좀더 강화했다고 생각됩니다.

RAD Studio 2009에서도 최신 2009년 6월에 나온 ISO 파일을 보니, Delphi Prism 2009가 별도 솔루션으로 제공되고 있습니다.

이제 Delphi for .NET은 완전히 없어졌다고 봐야겠습니다.

업데이트하다가 RAD Studio 2009가 꼬이는 바람에, 결국 새로 받은 ISO로 설치하였습니다.

처음 화면에서 달라진 것을 전혀 느낄 수 없습니다. (인터페이스는 별로 변한게 없습니다.)

문제는 이전에 2009 버전에서 사용하던 패키지들을 아직 사용할 수 없다는 것입니다.
제 3자 콤포넌트들이 2010 버전을 지원하기 전까기는 별로 사용할 일이 없을 것 같습니다.

RAD Studio 2009 버전에 만족하면서 써야겠습니다.
다만, Delphi Prism은 좀 익혀놓아야 할 듯 하군요.
결국 .NET기반의 도구를 만지게 되는 듯....
Posted by 훅크선장
, |