Posted
Filed under C,C++

메뉴의 Project->Options 항목에서
1. C++ Linker의 Dynamic RTL 속성을 false로 선택
2. Packages의 Runtime Packages의 체크를 풀어줌

하시고 Build하시면 다른 컴에서 실행 가능할 듯 합니다.
2010/04/30 17:42 2010/04/30 17:42
Posted
Filed under C,C++
dialog 에 PreTranslateMessage 를 구현 한다.

BOOL CFileViewDlg::PreTranslateMessage(MSG* pMsg)
{
      // TODO: Add your specialized code here and/or call the base class
     
      if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) return FALSE;   //return TRUE;
      return CDialog::PreTranslateMessage(pMsg);
}
2010/04/30 14:52 2010/04/30 14:52
Posted
Filed under C,C++

[원문] : http://support.microsoft.com/kb/117320/ko

MFC 버전 2.5 이상을 사용하는 경우 수 활용하는 새 전역 MFC 함수, "AfxGetMainWnd", 코드를 단순화하기 위해:

   void ExitMFCApp()
   {
        // same as double-clicking on main window close box
        ASSERT(AfxGetMainWnd() != NULL);
        AfxGetMainWnd()->SendMessage(WM_CLOSE);
   }
				

참고 : 항상 문서의 데이터를 변경한 후 CDocument::SetModifiedFlag() 호출. 이 프레임워크는 종료 전에 저장할 것인지 묻는 것을 보장합니다. 종료 절차를 보다 광범위한 제어해야 CDocument::SaveModified()를 재정의할 수 있습니다.


2010/04/29 20:00 2010/04/29 20:00
Posted
Filed under Htm&Javascript

<html>
<head>
<title>마우스오른쪽 버튼 클릭 방지</title>
<script language=JavaScript>
 try {
 document.attachEvent('oncontextmenu', function () {
  return false;
 });
 } catch(e) {}
</script>

</head>
<body>
<p>마우스오른쪽버튼을 클릭해보세요.</p>
</body>
</html>

2010/04/29 15:50 2010/04/29 15:50
Posted
Filed under Htm&Javascript
http://msdn.microsoft.com/en-us/library/cc197035(VS.85).aspx


<button
    onclick="external.AddToFavoritesBar(
        'http://example.com/slices.aspx#weather',
        'Weather Conditions','slice')">
    Current Weather Conditions</button> 
2010/04/29 01:19 2010/04/29 01:19
Posted
Filed under Action Script

[작성자] http://visualp.com 고병만
actionscript 3.0에서 프린트를 하기 위해서는

flash.printing.PrintJob class를 import 해야 한다.
프린트 버튼을 누루는 시점이 하나의 job 즉 작업 단위로 봐야 한다.

PrintJob 클레스는 addPage 메소드를 통해서 Sprite 단위의 인쇄 페이지를 추가 할 수 있다.
참고로 A4 Size를 픽셀 단위로 환산 하며, 595 * 842 가 된다.

Sprite객체를직접 생성 해서 프린트를 할 수도 있고, 직접 무비클립을 만들어서 인쇄 작업을 진행 할 수 있다. 무비클립에 인쇄할 페이지를 디자인 한 후 출력 할 수도 있다는 말이다.

한번에 여러장을 인쇄 하기 위해서는 addPage메소를 이용하여 Sprite 객체를 추가 해주면 된다.
다음 예제는 SharedObject에 저장된 text를 불러와서 배경이 디자인된 skin1이라는 무비클립을
인쇄하는 간단한 예제이다.

반드스 printJob.start()메소드를 호출 한후 try catch 문으로 묶어 줘야 한다.
그렇지 않으면 오류가 발생 한다.


stop();
import flash.external.ExternalInterface;
import flash.net.SharedObject;
import flash.printing.PrintJob;

saveBtn.buttonMode=true;
printBtn.buttonMode=true;

//print object 변수 선언

//shared obj 구현
var so:SharedObject = SharedObject.getLocal("sample_lesson01_9001","/");

if(so.data.text01 != null){
 text0.text=String(so.data.text01);
}

text0.addEventListener(MouseEvent.CLICK,text_clear);
saveBtn.addEventListener(MouseEvent.CLICK,save_text0);
printBtn.addEventListener(MouseEvent.CLICK,print_text0);

function print_text0(event:MouseEvent):void{
   //[프린터 작업 생성]
  
   var skin1:print_skin1 = new print_skin1();
   var printJob:PrintJob = new PrintJob();
   skin1.content_text.text = text0.text; 
   printJob.start();
  try{
    printJob.addPage(skin1);
    printJob.send();
   }catch(error:Error){
   
   }
}

function save_text0(event:MouseEvent):void{
 if(text0.text==""){
  ExternalInterface.call("내용이 존재 하지 않습니다.");
  this.stage.focus=text0;
 }else{
  so.data.text01 = text0.text;
  so.flush();
  ExternalInterface.call("저장 완료!");
 }
}

function text_clear(evetn:MouseEvent):void{
 trace("click");
 if(so.data.text01==null){
  text0.text="";
 }
}

/*
so.flush();
so.close();
*/

2010/04/28 20:53 2010/04/28 20:53
Posted
Filed under Action Script

[작성자] :http://www.visualp.com   - 고병만
플레쉬 2.0  에서는 파일 다운로드 링크를 걸기 위해서
geturl 을 사용 했다. 링크는 되지만.  activex경고창 내지는 파일 다운로드 경고차이 뜨면서
다운로드를 선택 하면, flash 페이지가 reflash되는 현상이 발생 한다.

3.0d에 이 문제들을 해결해 주고 있다.
FileRefference를 이용하여 다운로드를 하자.

import flash.net.*;

public static var fileReference:FileReference = new FileReference();
var urlRequest:URLRequest = new URLReques(http://blog.visualp.com/filename.zip);
 fileReference.download(urlRequest);

가장 심풀한 다운로드 소스 이다.

문제는 FileRefference 객체를 생성 할 때전역 함수로 사용 해야 한다.

메소드(함수) 안에서 사용하게 될경우 , 즉 지역 함수로 선언 하면, 파일 다운로드가 되지 않는 문제가 발생 한다.
왜 파일 다운로드가 안되냐고.. 삽질 하지 말고,, 객체가 생성된 위치를 잘 살펴 봐야 하다.

구현시 생각 해야 할 부분, 자바스크립트 와 연동 하여, 다운받을 서버 주소 즉 풀 네임을  얻어서 자기 링크를 걸어야 한다.

즉 다시 말해서 ./../ 뭐 이런식의 접근은 불가능 하다. http 또는 https 형식의 접근이 가능 함으로  반드시 기억해 둬야 한다.

2010/04/27 15:01 2010/04/27 15:01
Posted
Filed under PHP
sql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
2010/04/26 16:46 2010/04/26 16:46
Posted
Filed under Action Script
[원문] : http://actionscriptexamples.com/2008/11/26/using-an-embedded-font-with-the-textarea-control-in-flash-with-actionscript-30/






// ActionScript 3.0
import fl.controls.TextArea; var chaparralProEmbeddedFont:Font = new ChaparralProEmbedded(); var textFormat:TextFormat = new TextFormat(); textFormat.font = chaparralProEmbeddedFont.fontName; textFormat.size = 32; var textArea:TextArea = new TextArea(); textArea.setStyle("textFormat", textFormat); textArea.setStyle("embedFonts", true); textArea.text = "The quick brown dog jumps over the lazy fox."; textArea.move(10, 10); textArea.setSize(300, 200); addChild(textArea);




2010/04/26 11:43 2010/04/26 11:43
Posted
Filed under Action Script

[원문] : http://koko8829.tistory.com/304

싱글톤 패턴 사용하기 미투데이로 한마디트위터로 한마디

인사이드플렉스 2008/01/02 22:47

translate this to English (via Google)
この文を日本語で翻訳 (NAVERを通じて)
소스를 보다가 싱글톤 패턴이 적용된 내용을 보았습니다.
저야 아이들 아빠니깐 그다지 싱글에는 관심이 없었지만..ㅎㅎ
(새해부터 죄송합니다. 이런 무리한 글을..ㅠㅠ)

사실 패턴 관련해서는 GoF 의 디자인 패턴부터 Java 언어로 배우는.., 자바디자인패턴과 리팩토링 등등 많은 책을 보유하고 있으나 제대로 읽고 적용해본 내용이 없더군요.
그나마 최근 읽고 있는 '패턴 그리고 객체지향적 코딩의 법칙/문우식/한빛미디어' 에서
위안이 되는 글을 찾았습니다.

더 정확히 이야기하면 불필요한 부분에 패턴을 적용하기 위해 머리를 싸매지 마라.
여러분들은 객체지향 프로그래밍을 하는 것이지 패턴 프로그래밍을 하는 것이 아니다.
경험이라는 이름의 시행착오를 거치지 않고는 아무리 패턴을 많이 사용해도 절대 좋은 코드를 얻을 수 없다는 점을 알아야 한다.

그래 아직 경험이 부족한 탓이구나...~~ 라고..

본론을 이야기하면 ActionScript 3 에서는 싱글톤 패턴을 구현할때 Java 와 같이 구현할 수가 없습니다.
일반적으로 Java 에서는 생성자에서 private 을 사용하여 싱글톤 패턴을 만든다고 하더군요.
하지만 ActionScript 3 에서는 생성자에서 public 을 사용하여야만 합니다.
private 나 protected 를 사용하지 못한다는 것이지요.
때문에 싱글톤 패턴을 구현하기 위하여 일종의 꽁수가 들어갑니다.

이렇게 된 원인(?)은 ActionScript 3 개발당시에 ECMA 4th edition(자바스크립트 2) 의 스펙이 아직 확정되지 않았기때문에 잠정적인 위험을 배제하기 위하여 어쩔 수 없는 선택이었던것 같습니다.
AS3 -- on the lack of private and protected constructors
http://weblogs.macromedia.com/sho/archives/2006/04/as3_--_on_the_l.cfm

하지만 아직 자바스크립트 2 의 스펙이 다 제정된것은 아니지만 해당 생성자에 대한 부분은
처리가 된것 같군요.
해당 부분을 어떻게 처리할지 모르겠으나 조만간 반영이 되지 않을까 생각해봅니다.
(Resolved) Private constructors are useful, common, and need to be supported
http://bugs.ecmascript.org/ticket/166

하지만 아직은 지원되는게 아니니깐.
필요하시다면
AS3.0 Better Singletons
http://blog.pixelbreaker.com/flash/as30-better-singletons/
  1.     
  2. package 
  3. {  
  4.     public class Singleton  
  5.     {  
  6.         public static var instance:Singleton;  
  7.  
  8.         public static function getInstance():Singleton  
  9.         {  
  10.             if( instance == null )  
  11.             {  
  12.                 instance = new Singleton( new SingletonEnforcer() );  
  13.             }  
  14.             return instance;  
  15.         }  
  16.  
  17.         public function Singleton( pvt:SingletonEnforcer )  
  18.         {  
  19.             // init class  
  20.         }  
  21.     }  
  22. }  
  23.  
  24. internal class SingletonEnforcer{}  


또는 아래 에서 제안하는 형식을 따라주면 될것 같습니다.
AS3 Singletons, the other way
http://www.nulldesign.de/2007/11/20/as3-singletons-the-other-way/
  1.    
  2. package {  
  3.     public class Singleton {  
  4.         private static var instance:Singleton;  
  5.         private static const checker:Object = {};  
  6.  
  7.         public function Singleton(initObj:Object) {  
  8.             if(initObj != checker) {  
  9.                 throw new Error("Private constructor!");  
  10.             }  
  11.         }  
  12.  
  13.         public static function getInstance():Singleton {  
  14.             if(instance == null) {  
  15.                 instance = new Singleton(checker);  
  16.             }  
  17.             return instance;  
  18.         }  
  19.     }  
  20. }  
2010/04/26 10:55 2010/04/26 10:55