728x90
출처 : http://www.java2go.net/blog/tag/Regular%20Expression

1. 링크 정보 추출하기


 public String getTagA_href_Value(String html) {
  Pattern p = Pattern.compile("([ ]+href[ ]*=\")([^\"]+)\"");
  Matcher m = p.matcher(html);
  if (m.find())
  {
   System.out.println(m.group(0));
   System.out.println(m.group(1));
   System.out.println(m.group(2));
   System.out.println("----------------");
   return m.group(2);
  }
  return "";
 }

2. HTML 태그 없애기

 public String getTagA_String(String html) {
  Pattern p = Pattern.compile("\\<(\\/?)(\\w+)*([^<>]*)>");
     Matcher m = p.matcher(html);
  if (m.find()) {
   return m.replaceAll("");
  }
  return "";
 }
728x90
728x90
1. 루비 설치 하기

a. Download (1.8.6-26 Final Release)

아래 사이트에서 최신 버전을 받을 수 있습니다.

http://rubyforge.org/frs/?group_id=167

b. install

ruby186-26.exe 실행

2. MySQL 설치 하기

a. Downoad (mysql-essential-5.0.51b-win32.msi)

http://mysql.com/downloads/mysql/5.0.html

b. install

mysql-essential-5.0.51b-win32.msi 실행

3. Flex 3.0 설치 하기

a. install

\Windows\FlexBuilder_Standalone.exe 실행

사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
728x90
728x90

출처 : http://www.swissdelphicenter.ch/torry/showcode.php?id=147

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    id1 : Integer;
    procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WMHotKey(var Msg: TWMHotKey);
begin
 if Msg.HotKey = id1 then
   ShowMessage('Ctrl + A 선택!');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  // 키 등록 Ctrl + A 
  id1 := GlobalAddAtom('Hotkey1');
  RegisterHotKey(Self.Handle, id1, MOD_CONTROL, $41); // $41 -> A
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  // 키 해제
  UnRegisterHotKey(Handle, id1);
  GlobalDeleteAtom(id1);
end;

end.

728x90
728x90

1. Apache Server Download (http://httpd.apache.org/download.cgi)

Win32 Binary including OpenSSL 0.9.8g (MSI Installer): apache_2.2.8-win32-x86-openssl-0.9.8g.msi

2. Apache Server Install

2-1. Apache 설치 마법사 실행 화면, [Next] 버튼 선택

사용자 삽입 이미지


2-2. License 동의 Step, License 동의 선택하고, [Next] 버튼 선택

사용자 삽입 이미지


2-3. [Next] 버튼 선택

사용자 삽입 이미지


2-4. 저의 경우 간단한 Test 용도로 사용하는 것으로, 기본값 변경 없이 [Next] 버튼 선택

사용자 삽입 이미지


2- 5. [Next] 버튼 선택

사용자 삽입 이미지


2- 6. [Change] 버튼을 선택해서 설치하고 싶은 디렉토리를 선택하고, [Next] 버튼 선택

사용자 삽입 이미지


2- 7. [Install] 버튼 선택

사용자 삽입 이미지


2- 8. 파일 복사 진행 확인 하는 창

사용자 삽입 이미지


2- 9. [Finish] 버튼 선택하여 설치 종료

사용자 삽입 이미지


설치 확인 : 조금 썰렁한 화면이 보이네요.

사용자 삽입 이미지


Default 페이지는
C:\Apache2.2\htdocs\index.html 에 있습니다.

내용
------------
<html><body><h1>It works!</h1></body></html>
------------

3. PHP Download (http://www.php.net/downloads.php)

Windows Binaries PHP 5.2.6 zip package

http://kr2.php.net/get/php-5.2.6-Win32.zip/from/a/mirror

4. PHP 설치

4-1 php-5.2.6-Win32.zip 압축 풀기

압축파일 php-5.2.6-Win32.zip 을 풀어 C:\php-5.2.6-Win32 로 둠

4-2 php.ini 파일 작성

C:\php-5.2.6-Win32\php.ini-recommended 파일을 php.ini 파일명으로 rename 해서 C:\Windows의 폴더에 복사

4-3 C:\php-5.2.6-Win32 경로를 환경 변수 Path에 추가

5. Apache 환경파일(httpd.conf)에 php관련 내용을 추가

C:\Apache2.2\conf\httpd.conf 파일 내용 추가

# For PHP 5 do something like this:
LoadModule php5_module "C:/php-5.2.6-Win32/php5apache2_2.dll"

    AddType application/x-httpd-php .php .php3 .html .htm .phtml
    AddType application/x-httpd-php-source .phps

6. PHP 설치 Test 

6-1. php 샘플 파일 작성

파일 경로
C:\Apache2.2\htdocs\test.php

test.php 내용
------------------
<?php
  phpinfo();
?>
------------------

6-2. Apache 재시작

C:\Apache2.2\bin>httpd -k restart

6-3. 페이지 확인

사용자 삽입 이미지





728x90
728x90

출처
http://kurapa.com/content-a411_%25ED%2588%25AC%25EB%25AA%2585%25EC%259C%2588%25EB%258F%2584%25EC%259A%25B0

http://careerblog.scout.co.kr/home/?pSeq=665762&blogURL=http://neodreamer.tistory.com/39
http://careerblog.scout.co.kr/search/?searchtype=4&searchtext=CodeGear

// 투명 윈도우 만들기
procedure TfmMain.Button1Click(Sender: TObject);
begin
  SetWindowLong(handle, GWL_EXSTYLE, GetWindowLong(handle, GWL_EXSTYLE) or WS_EX_LAYERED);
  SetLayeredWindowAttributes(handle, 0, Round((255 * 70 ) / 100), LWA_ALPHA);
end;

// 투명 윈도우 만들기 + 최상위 윈도우 + 이벤트 활성화
procedure TfmMain.Button2Click(Sender: TObject);
begin
   Self.Color := RGB(1, 1, 1);
   SetWindowLong(handle, GWL_EXSTYLE, GetWindowLong(handle, GWL_EXSTYLE) or WS_EX_LAYERED);
   SetLayeredWindowAttributes( handle, RGB(1, 1, 1), 127, LWA_COLORKEY or LWA_ALPHA);
  Self.FormStyle := fsStayOnTop;
end;

728x90
728x90
Delphi Tip - 파일이름 관련 함수

출처 : http://delphi.borlandforum.com/impboard/impboard.dll?action=read&db=del_tip&no=179
http://www.swissdelphicenter.ch/torry/showcode.php?id=144
http://www.delphibasics.co.uk/RTL.asp?Name=StringReplace

// 델파이
function ExtractFileDir(const FileName: string): string;
function ExtractFileDrive(const FileName: string): string;
function ExtractFileName(const FileName: string): string;
function ExtractFilePath(const FileName: string): string;

예)

filename := ExtractFileName(  StringReplace(url, '/', '\', [rfReplaceAll, rfIgnoreCase]) );
728x90
728x90

Delphi Tip - File Download

출처 : http://delphi.about.com/od/internetintranet/a/get_file_net.htm

uses WinInet;

function GetInetFile (const fileURL, FileName: String): boolean;
const
  BufferSize = 1024;
var
  hSession, hURL: HInternet;
  Buffer: array[1..BufferSize] of Byte;
  BufferLen: DWORD;
  f: File;
  sAppName: string;
begin
  result := false;
  sAppName := ExtractFileName(Application.ExeName);
  hSession := InternetOpen(PChar(sAppName), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0) ;
  try
    hURL := InternetOpenURL(hSession, PChar(fileURL), nil, 0, 0, 0) ;
    try
      AssignFile(f, FileName);
      Rewrite(f,1) ;
      repeat
        InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen);
        BlockWrite(f, Buffer, BufferLen);
      until BufferLen = 0;
      CloseFile(f) ;
      result := True;
    finally
      InternetCloseHandle(hURL);
    end
  finally
    InternetCloseHandle(hSession);
  end;
end;

// 윈도우즈의 임시폴더 명을 반환한다.
function SysTempPath(): String;
var
  Buffer: array[0..1023] of Char;
begin
  SetString(Result, Buffer, GetTempPath(Sizeof(Buffer)-1, Buffer));
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  internetFile,
  localFileName: string;
begin
 internetFile := 'http://localhost:8080/Sample.jmd';
 localFileName := SysTempPath() + 'test.xml';

 if GetInetFile(internetFile, localFileName) then
   ShowMessage(SysTempPath() + 'Sample.jmd' + ' / Download successful.')
 else
   ShowMessage('Error in file download.') ;
end;

728x90
728x90

 FILETIME ft;
 GetSystemTimeAsFileTime(&ft);
 static DWORD dwVal = 0x21;
 DWORD dwSeed = (dwVal++ << 0x18) | (ft.dwLowDateTime & 0x00ffff00) | dwVal++ & 0x000000ff;
 srand(dwSeed);

 int iRandom = rand()%10+1;

728x90

+ Recent posts