728x90

BSTR -> char 배열

char szData[200];
BSTR decodeData;

USES_CONVERSION;
strcpy(szData,OLE2A(decodeData));

char 배열 -> BSTR

USES_CONVERSION;
char* szData = "char array";
BSTR sbstr;

sbstr = SysAllocString(A2W(szData)); 

728x90
728x90
(Java AXIS + JBOS) + Flex SOAP을 구현중에 유용한 링크 정보입니다.
성공하면 정리해서 다시 올리겠습니다.... ^^
(언제 성공하려나....)



Develop Web services clients with Macromedia Flex
http://www.ibm.com/developerworks/webservices/library/ws-macroflex/

Review: Macromedia Flex SOAP
http://javaboutique.internet.com/reviews/macro_flex/

mx.rpc.soap.Operation (Flex™ 2 레퍼런스 가이드)
http://flexdocs.kr/docs/flex2/langref/mx/rpc/soap/Operation.html

mx.rpc.soap.SOAPHeader (Flex™ 2 레퍼런스 가이드)
http://flexdocs.kr/docs/flex2/langref/mx/rpc/soap/SOAPHeader.html

Flex SoapHeader를 첨가한 WebService
http://www.cnblogs.com/mobile/archive/2007/02/01/636856.html

Flex 와 .Net ASP 간의 WebService
http://dev.yesky.com/265/3418765.shtml

Flex 와 Java XFire 간의 WebService
http://www.flexcoders.cn/showtopic-1011.aspx

Web Service Flex consume .net SoapHeader
http://groups.google.com/group/Flex2-Builder/browse_thread/thread/a867330cd3c7a2d7

Codehaus XFire - Home
http://xfire.codehaus.org/

Chapter 17. Spring을 사용한 원격(Remoting)및 웹서비스
http://openframework.or.kr/framework_reference/spring/ver1.2.2/html/remoting.html

Korean Groovy SOAP
http://groovy.codehaus.org/Korean+Groovy+SOAP

728x90
728x90

출처

http://adobe.bloter.net/tt/adobe/23
http://www.adobe.com/kr/devnet/flash/articles/flex_flasher_05.html

준비물

ant 1.7 (apache-ant-1.7.0-bin.zip)
:
http://ant.apache.org/bindownload.cgi

Flex Ant Task (flex_ant_tasks_022607.zip)
: http://labs.adobe.com/wiki/index.php/Flex_Ant_Tasks


1. ant 설치

apache-ant-1.7.0-bin.zip 파일을 압축을 출고
apache-ant-1.7.0\bin 폴더를 path에 추가 해줍니다.

2. F;ex Ant Tash 설치

flex_ant_tasks_022607.zip 특정 폴더에 압축을 풀고
build.xml 파일에 taskdef 태그에 jar 경로를 지정해준다.

예) <taskdef resource="flexTasks.tasks" classpath="D:/dev.flex/lib/flexTasks.jar" />

3. build.xml 파일 작성

<?xml version="1.0" ?>

<project name="Flex Ant Tasks" default="compile" basedir=".">

  <property name="FLEX_HOME" value="C:/Program Files/Adobe/Flex Builder 2/Flex SDK 2" />
  <property name="swfFile" value="${basedir}/HelloWorld.swf" />
  <property name="main_appliation" value="${basedir}/HelloWorld.mxml" />

  <taskdef resource="flexTasks.tasks" classpath="D:/dev.flex/lib/flexTasks.jar" />

  <target name="compile">
    <echo>Building ${swfFile}</echo>
      <mxmlc
          file="${main_appliation}"
          output="${swfFile}"
          actionscript-file-encoding="UTF-8"
          keep-generated-actionscript="true"
          incremental="true"
      >
    </mxmlc>
  </target>
 
</project>


4. 컴파일

ant -f build.xml

사용자 삽입 이미지

728x90
728x90

WebSsrver.php.zip

출처 : http://www.delphi3000.com/articles/article_3081.asp?SK=

이전에 개발된 웹서버에 php 지원을 추가했습니다.
아직 Port 번호 수정은 되지 않으며, php는 따로 설치 하시고, path 가 잡혀 있어야 합니다.

델파이 7로 컴파일 하였으며, Indy 10, php4delphi 컴포넌트 사용하였습니다.

Sample로 test.php을 넣어 두었고,
프로그램 실행하시고, Web Server Active 체크하시면 웹서버가 동작하게 됩니다.

브라우저에서 http://localhost/test.php 하시면 Sample php 페이지를 보실 수 있습니다.

test.php

<?php
  phpinfo();
?>

실행화면

사용자 삽입 이미지




728x90
728x90
출처

http://www.onflex.org/ted/2007/01/singleton-in-mxml.php

Flex을 이용한 디자인 패턴증에서 Singleton을 적용한 방법입니다.
java 처럼 생성자 자체를 private로 할수는 없네요.
다시 말해 생성자를 new로 생성하면 별도의 객체가 만들어지게 됩니다.

Singleton 예)

package
{
    public class ConnectionManager
    {
        private static var instance:ConnectionManager;
       
        private var title:String;
       
    public static function getInstance():ConnectionManager {
      if ( ConnectionManager.instance ) {
        return ConnectionManager.instance;
      } else {
        ConnectionManager.instance = new ConnectionManager();
        return ConnectionManager.instance;
      }           
    }
   
    public function setTitle(src:String):void {
        this.title = title;
    }
   
    public function getTitle():String {
        return this.title;
    }
    }
}

new 객체 생성시

var connMgr1:ConnectionManager = new ConnectionManager();
connMgr1.setTitle("a");
               
var connMgr2:ConnectionManager = new ConnectionManager();
connMgr2.setTitle("b");

mx.controls.Alert.show(connMgr1.getTitle() + "/" + connMgr2.getTitle());

사용자 삽입 이미지






getInstance 매소드 이용시

var connMgr1:ConnectionManager = ConnectionManager.getInstance();
connMgr1.setTitle("a");
               
var connMgr2:ConnectionManager = ConnectionManager.getInstance();
connMgr2.setTitle("b");
               
mx.controls.Alert.show(connMgr1.getTitle() + "/" + connMgr2.getTitle());

사용자 삽입 이미지

728x90
728x90

PHP 다운로드

http://www.php.net/downloads.php

php-5.2.3-Win32.zip

php-5.2.3-Win32.zip 파일을 받아
c:/php 폴더에 풀고 paht에 추가 합니다.

httpp.conf 수정

ScriptAlias /php5/ "C:/php/"
Action application/x-httpd-php "/php5/php-cgi.exe"

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

테스트 페이지 작성

<?php
  phpinfo();
?>

728x90
728x90

참조
http://flexdocs.kr/docs/flex2/langref/mx/events/DataGridEvent.html

DataGird에서 Item 선택시 호출되는 이벤트 처리 입니다.
DataGird 속성은 반듯이 editable="true" 되어 있어야 해당 이벤트가 호출 됩니다.

DataGridEvent 객체

Property Value
bubbles false
cancelable false
columnIndex 0부터 시작 / DataGrid의 열의 인덱스
currentTarget 이벤트를 처리하는 event listener를 정의하는 object
dataField null
itemRenderer 편집중의 아이템에 대응하는 아이템 에디터 인스턴스
localX NaN
reason null
rowIndex 0부터 시작 / DataGrid의 행의 인덱스
target 이벤트를 dispatch한 object
Type DataGridEvent.ITEM_FOCUS_IN

이벤트 등록

1. XML 속성으로 등록

<mx:DataGrid id = "grid1" editable="true" itemFocusIn="onItemFocusIn(event)">

2. 스크립트로 등록

grid1.addEventListener(DataGridEvent.ITEM_FOCUS_IN,onItemFocusIn);

이벤트 처리

   public function onItemFocusIn(e:DataGridEvent):void {
    var item:XMLList = new XMLList(grid1.dataProvider[e.rowIndex]);
    mx.controls.Alert.show("row = " + e.rowIndex + "\nitem value = \n" + item);
   }
728x90
728x90

java 소스를 Delphi로 변환 프로그램을 간단하게 만들어 보았습니다.

원래 필요로 했던 것은 사칙연산이나 제어문 정도라서 일주일 투자해서 간단하게 만들어 보았습니다.

JavaCC을 이용했으며, jj 파일을 제외하고 Java 소스를 첨부합니다.

 

사용법:

java -jar java2delphi.jar Formatter.java

 

위와 같이 명령을 하시면 Formatter.pas의 결과물을 얻을 수 있습니다.

아래에 일부 변환된 예를 입니다.

  public int sum(int s1, int s2) {
    return s1 + s2;
  }
  function TFormatter.sum(s1 : integer; s2 : integer): int;
  begin
   result := s1+s2;
  end;
------------------------------------------------------------------
  public boolean checkSELECT(String s1) {
    if (s1.equalsIgnoreCase("select")) {
      return true;
    } else {
      return false;
    }
  }
  function TFormatter.checkSELECT(s1 : String): boolean;
  begin
    if ((UpperCase(s1)='SELECT')) then
    begin
      result := true;
    end else begin
      result := false;
    end;
  end;
------------------------------------------------------------------
  public static int testFor() {
    int sum = 0;
    for (int i=0; i<100; i++)
      sum = sum + 1;
  }
  function TFormatter.testFor(): int;
  var
    i : integer;
    sum : integer;
  begin
    sum:=0;
    i:=0;
    while (i<100) do begin
      sum:=sum+1;
      inc(i);
    end;
  end;
------------------------------------------------------------------
  private void doEscape2Space() {
    for (aD = 1; aD <= queryTokenCount; aD++) {
      if (isTokenQuoteLiterals[aD])
        continue;
      if (queryToken[aD].equals("\t")
          || queryToken[aD].equals("\f")
          || queryToken[aD].equals("\r")
          || queryToken[aD].equals("\b"))
        queryToken[aD] = " ";
      if (queryToken[aD].equals("\r"))
        queryToken[aD] = "\\n";
    }
  }
  procedure TFormatter.doEscape2Space();
  begin
    aD:=1;
    while (aD<=queryTokenCount) do begin
      if (isTokenQuoteLiterals[aD]) then
      begin
        continue;
      end;
      if ((queryToken[aD]=#9)
        or  (queryToken[aD]=#12)
        or  (queryToken[aD]=#13)
        or  (queryToken[aD]=#8)) then
      begin
        queryToken[aD]:=' ';
      end;
      if ((queryToken[aD]=#13)) then
      begin
        queryToken[aD]:='\\n';
      end;
      inc(aD);
    end;
  end;  
                                    
728x90

+ Recent posts