2013년 3월 13일 수요일

[팁]Windows7 32bit 에서 4G 이상 메모리 사용하기


32 bit 윈도우 환경에서는 3g 이상 안됀다고들 합니다만
그러나 찾으면 찾을것이라 라는 말은 진리인듯 , 정말로 방법이 있군요

Windows7 32 bit 에서 4 giga byte 이상 메모리를 사용하기 위해서는
먼저 사용하려구 하는 OS가 정품인증을 받은 상태여야 합니다.
정품인증을 받지 않은 상태에서는 OS에 이상이 발생할수 있습니다....

Download : http://blog.naver.com/ihaneter/130140886065  => 여기서 첨부파일을 받으세요

위의 파일을 Download 하시고 앞축을 푸시면 다음과 같은 목록을 보실수 있습니다.

AddBootMenu.cmd
readme.txt
ReadyFor4GB.exe
viewmem-x86.sys

순서는 먼저 ReadyFor4GB.exe 를 실행합니다.


위애서 보이는 버튼 순서대로 클릭합니다.
Check -> Apply

다음에 무엇인가를 실행하라는 메세지 박스를 볼수 있을것입니다.

메세지박스를 확인하시고 목록중에 
AddBootMenu.cmd 를 오른쪽 버튼 클릭해서 관리자 권한으로 실행하십시오..
( Vista 이상은 오른쪽 버튼을 클릭하면 나오는 메뉴에 관리자 권한 실행이 나타납니다... )
*) 관리자 권한이 아니면 최종 갱신 되지 않으므로 주의 하십시오...

확장가능한 최대 메모리는 128 Giga Byte 입니다. ( 저는 4 Giga 밖에는 없습니다.)

이경우는 Windows7 만 테스트 한경우이며 다른 OS도 가능하다는 예기가 있습니다.

마지막으로 ...
여기서 당연히 Reboot 해야 합니다.
주의할점은 Reboot하면
OS 선택창에 새로은 OS 링크가 생깁니다.
그걸 선택해야 메모리가 확장된것을 볼수 있습니다.
아무생각없이 그냥 Enter를 치시면 당연히 아무일도 안일어 납니다.
이것으로 완료가 됩니다.

작업관리자 결과


그럼 즐거운 팁이 되었으면 좋겠습니다...
by haneter

2013년 3월 10일 일요일

java 와 flex의 언어의 유사점비교


참조: http://java.sys-con.com/node/299251
Below is a short comparison table of major elements/concepts of these two languages for a quick reference.
아래의 빠른 참조를 위해 주요 요소 /이 두 언어의 개념에 대한 간단한 비교 표입니다.


You can read this table either left-to-right or right-to-left, depending on what’s your primary programming language is today.
JAVA 또는 FLEX(액션스크립트) 둘중의 어느것을 가지고 있는지에 따라 두 왼쪽에서 오른쪽 또는 오른쪽에서 왼쪽으로이 테이블을 읽을 수 있습니다.
This list is not complete, and your input is appreciated.
이 목록은 완전하지 않습니다, ​​그리고 입력에 감사드립니다.


Concept/Language Construct
Java 5.0
ActionScript 3.0
Class library packaging
.jar
.swc
Inheritance
class Employee extends Person{…}
class Employee extends Person{…}

Variable declaration and initialization
String firstName=”John”;
Date shipDate=new Date();
int i;
int a, b=10;
double salary;
var firstName:String=”John”;
var shipDate:Date=new Date();
var i:int;
var a:int, b:int=10;
var salary:Number;
Undeclared variables
n/a
It’s an equivalent to the wild card type notation *. If you declare a variable but do not specify its type, the * type will apply.
A default value: undefined
var myVar:*;

Variable scopes
block: declared within curly braces,
local: declared within a method or a block

member: declared on the class level

no global variables
No block scope: the minimal scope is a function

local: declared within a function

member: declared on the class level

If a variable is declared outside of any function or class definition, it has global scope.
Strings
Immutable, store sequences of two-byte Unicode characters
Immutable, store sequences of two-byte Unicode characters
Terminating statements with semicolons
A must
If you write one statement per line you can omit it.
Strict equality operator
n/a
===
for strict non-equality use
!==
Constant qualifier
The keyword final

final int STATE=”NY”;
The keyword const

const STATE:int =”NY”;
Type checking
Static (checked at compile time)
Dynamic (checked at run-time) and static (it’s so called ‘strict mode’, which is default in Flex Builder)
Type check operator
instanceof
is – checks data type, i.e. if (myVar is String){…}

The is operator is a replacement of older instanceof
The as operator
n/a
Similar to is operator, but returns not Boolean, but the result of expression:

var orderId:String=”123”;
var orderIdN:Number=orderId as Number;
trace(orderIdN);//prints 123

Primitives
byte, int, long, float, double,short, boolean, char
all primitives in ActionScript areobjects.
Boolean, int, uint, Number, String

The following lines are equivalent;
var age:int = 25;
var age:int = new int(25);

Complex types
n/a
Array, Date, Error, Function, RegExp, XML, and XMLList
Array declaration and instantiation
int quarterResults[];
quarterResults =
new int[4];


int quarterResults[]={25,33,56,84};

var quarterResults:Array
=new Array();
or
var quarterResults:Array=[];

var quarterResults:Array=
[25, 33, 56, 84];
AS3 also has associative arrays that uses named elements instead of numeric indexes (similar to Hashtable).
The top class in the inheritance tree
Object

Object
Casting syntax: cast the class Object to Person:

Person p=(Person) myObject;

var p:Person= Person(myObject);
or
var p:Person= myObject as Person;
upcasting
class Xyz extends Abc{}
Abc myObj = new Xyz();

class Xyz extends Abc{}
var myObj:Abc=new Xyz();
Un-typed variable
n/a
var myObject:*
var myObject:
packages
package com.xyz;
class myClass {…}
package com.xyz{
class myClass{…}
}
ActionScript packages can include not only classes, but separate functions as well
Class access levels
public, private, protected
if none is specified, classes have package access level
public, private, protected
if none is specified, classes have internalaccess level (similar to package access level in Java)
Custom access levels: namespaces
n/a
Similar to XML namespaces.
namespace abc;
abc function myCalc(){}
 or
 abc::myCalc(){}
 use namespace abc ;
nsole output
System.out.println();
// in debug mode only
trace();
imports
import com.abc.*;
import com.abc.MyClass;
import com.abc.*;
import com.abc.MyClass; 
packages must be imported even if the class names are fully qualified in the code.
Unordered key-value pairs
Hashtable, Map
 
Hashtable friends = new Hashtable();

friends.put("good",
“Mary”);
friends.put("best",
“Bill”);
friends.put("bad",
“Masha”);

String bestFriend= friends.get(“best”);
// bestFriend is Bill
Associative Arrays
Allows referencing its elements by names instead of indexes.
var friends:Array=new Array();
friends["good"]="Mary";
friends["best"]="Bill";
friends["bad"]="Masha";

var bestFriend:String= friends[“best”]
friends.best=”Alex”;
Another syntax:
var car:Object = {make:"Toyota", model:"Camry"};
trace (car["make"], car.model);
// Output: Toyota Camry
Hoisting
n/a
Compiler moves all variable declaration to the top of the function, so you can use a variable name even before it’s been explicitly declared in the code.
Instantiation objects from classes
Customer cmr = new Customer(); 
Class cls = Class.forName(“Customer”);
Object myObj= cls.newInstance();
var cmr:Customer = new Customer();
var cls:Class = flash.util.getClassByName("Customer");
var myObj:Object = new cls();
Private classes
private class myClass{…}
There is no private classes in AS3.

Private constructors
Supported. Typical use: singleton classes.
Not available. Implementation of private constructors is postponed as they are not the part of the ECMAScript standard yet.
To create a Singleton, use public static getInstance(), which sets a private flag instanceExists after the first instantiation. Check this flag in the public constructor, and if instanceExists==true, throw an error.
Class and file names
A file can have multiple class declarations, but only one of them can be public, and the file must have the same name as this class.
A file can have multiple class declarations, but only one of them can be placed inside the package declaration, and the file must have the same name as this class.
What can be placed in a package
Classes and interfaces
Classes, interfaces, variables, functions, namespaces, and executable statements.
Dynamic classes (define an object that can be altered at runtime by adding or changing properties and methods).
n/a
dynamic class Person {
var name:String;
}
//Dynamically add a variable // and a function
Person p= new Person();
p.name=”Joe”;
p.age=25;
p.printMe = function () {
trace (p.name, p.age);
}
p.printMe(); // Joe 25
function closures
n/a. Closure is a proposed addition to Java 7.
myButton.addEventListener(“click”, myMethod);
A closure is an object that represents a snapshot of a function with its lexical context (variable’s values, objects in the scope). A function closure can be passed as an argument and executed without being a part of any object
Abstract classes
supported
n/a
Function overriding
supported
Supported. You must use the override qualifier
 Function overloading supported not supported
Interfaces
class A implements B{…}
interfaces can contain method declarations and final variables.
class A implements B{…}
interfaces can contain only function declarations.
Exception handling
Keywords: try, catch, throw, finally, throws

Uncaught exceptions are propagated to the calling method.
Keywords: try, catch, throw, finally

A method does not have to declare exceptions.
Can throw not only Error objects, but also numbers:

throw 25.3;

Flash Player terminates the script in case of uncaught exception.

Regular expressions
Supported
Supported

FLEX Remote Object 를 이용하여 DB 연결하기

참조: http://blog.naver.com/PostView.nhn?blogId=jspark226&logNo=80027833188&redirect=Dlog&widgetTypeCall=true

참고) Flex 에서 자바 스크립트를 연동할수 있는 방법이기도합니다.

FLEX Remote Object 를 이용하여 DB 연결하기


1 . C:\fds2\jrun4\servers\default\flex\WEB-INF\flex 경로에 있는
      *  services-config.xml
      *  remoting-config.xml
      요 두개의 파일을 손봐야 한다.(경로는 flex data service 를 default  설치시..)

2. 먼저 services-config.xml 파일의 channel 부분을 아래와 같이설정..

    <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint uri="http://localhost:8700/flex/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel-definition>

3. remoting-config.xml 파일에서는
   
   <?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service"
    class="flex.messaging.services.RemotingService"
    messageTypes="flex.messaging.messages.RemotingMessage">
    <adapters>
        <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
    </adapters>
    <default-channels>
        <channel ref="my-amf"/>
    </default-channels>
  
    <destination id="nhnRO">
        <properties>
            <source>nhn.NHNDataBean</source>
        </properties>
    </destination>
</service>

 굵게 써진 부분처럼 destination 을 셋팅한다.
 id : remoteObject 객체의 참조하고픈 이름이다.
source : 패키징화 되어있는 java bean class 파일이다.

4. java bean 을 살펴보자...
 경로 : C:\fds2\jrun4\servers\default\flex\WEB-INF\classes\nhn
 밑에 NHNDataBean.class 가 위치하면 된다.

 DB 연결부분은...

 private Connection getConnection() {
  Connection con = null;
  String DB_URL = "jdbc:odbc:stat";

  try {
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   con = DriverManager.getConnection(DB_URL);
  } catch( ClassNotFoundException e ) {
   System.err.println( "드라이버를 찾을수 없습니다." + e.getMessage() );
  } catch (Exception ex ) {
    System.err.println( "DB연결에러 \n" + ex.getMessage() );
  }        
  return con;
 }  

 드라이버는 테스트 용으로 MS-ACCESS 용이다.
 (FLEX 는 자체적으로 ODBC 용 드라이버는 가지고 있는 모냥이다..ㅋㅋ)

 DATA 가져오는 부분은.....

public List getList(String sql) {
  System.out.println("조회쿼리1 : " + sql);
  ArrayList list = new ArrayList();
  Connection con = null;
  Statement stmt = null;
  ResultSet rs = null;
  java.text.DecimalFormat df = new java.text.DecimalFormat("###,##0.000000");
  System.gc();
  Runtime monitor = Runtime.getRuntime();
  long MAX = 10000000;
  long time1 =  System.currentTimeMillis();
  long time2 = 0;
  try{
   con = getConnection();
            stmt = con.createStatement();
            rs = stmt.executeQuery(sql);
            while(rs.next()) {
    NHNDataVo vo = new NHNDataVo();
    vo.YYYYMMDD = rs.getString(1);
    vo.GAME_SERVICE_ID3 = rs.getString(2);
    vo.CCNT  = rs.getInt(3);
    vo.UV = rs.getInt(4);
    list.add(vo);
   }
   rs.close();
   stmt.close();
   con.close();
   time2 =  System.currentTimeMillis();
 
   System.out.println("instance total elased time=" + (time2-time1));
   System.out.println("ave instance elased time=" + df.format((double)(time2-time1)/MAX));
   System.out.println("total mem = " + monitor.totalMemory() );
   System.out.println("free mem = " + monitor.freeMemory() + "\n");
   System.out.println("조회건수 : " + list.size());
  } catch(SQLException se) {
   System.out.println("SQL Exception : " + se);
  } catch(Exception e) {
   System.out.println("Exception : " + e);
  } finally {
   try { if( stmt != null ) stmt.close(); } catch (Exception e) { }
   try { if( con != null ) con.close();  } catch (Exception e) { }
  }
  return list;
 }

정도로 구현하면 되겠다...
TEST 용 날림코딩이니 그냥 이해해 주었음 한다.

5. FLEX 소스 부분을 살펴보자......

  (태그부분)
 <!-- JAVA REMOTE OBJECT 호출 -->
 <mx:RemoteObject id="ro" destination="nhnRO" showBusyCursor="true" >
  <mx:method name="getList" result="resultHandler(event)" />
 </mx:RemoteObject>
 위에 dataservice 설정에서 지정해주었던 destination 을 셋팅한다.

 (스크립트 부분)
 /******************************************************
   초기화
  *******************************************************/
  private function initApp():void {
   //getData('1week', combo1.selectedItem.data , combo2.selectedItem.data , combo3.selectedItem.data);
   var token:AsyncToken = ro.getList(sql); // 물론 sql 은 만들어줘야죵? 머든간에. 
   slicedResults = new ArrayCollection();
   slicedResults1 = new ArrayCollection();
   slicedResults2 = new ArrayCollection(); 
  }

 ******************************************************
   RemoteObject 호출하여 DB 의 데이터 원본을 가져온다.
  *******************************************************/
  private function resultHandler(event:ResultEvent):void {
 
   if(ArrayCollection(event.result).length == 0){
  
    mx.controls.Alert.show("DATA 가 없습니다.");
  
   }

   // DB 에서 가져온 result 를 담는다.
   allDataAC = ArrayCollection(event.result);
 
   var retAC:ArrayCollection = new ArrayCollection();
 
   // 초기 데이터를 구성한다.
   makeMonthArr();
 
   try{
    for( var i:uint = 0 ;  i < allDataAC.length ; i++){   
     retAC.addItem({Month:allDataAC[i].YYYYMMDD, svc:allDataAC[i].GAME_SERVICE_ID3, cu:allDataAC[i].CCNT, uv:allDataAC[i].UV});    
    }
   }catch(err:Error){
    trace("Error");
   }
 
    // 선택된 Combo에 따른 DATA 저장
   if(selectedComboBox.id == "combo1"){
    slicedResults = retAC;
   }else if(selectedComboBox.id == "combo2"){
    slicedResults1 = retAC;
   }else if(selectedComboBox.id == "combo3"){
    slicedResults2 = retAC;
   }
  }