XRule

Functions

Name

Detail

 req()

required

 num()

Only numbers are allowed

email()

Invaild email address format

minlen(#)

Mininum {#} letters

maxlen(#)

Maximum {#} letters

len(#,#)

{#~#}  letters

gt(#)

input greater than {#}

ge(#)

input greater than or equal to {#}

lt(#)

input less than {#}

le(#)

input less than or equal to {#}

between(#,#)

 input between {#} and {#}


XRule Custom message

xr.put("req", "필수입력입니다.");
xr.put("email", "유효한 이메일 형식이 아닙니다.");

xr.put() 함수를 이용하여 기존 메시지를 변경할 수 있음.


XRule Custom UI

XRule은 기본적으로 alert창으로 메세지 뿌려줌

xr(this, message);
message : 뿌리는 메세지의 노드를 접근하여 커스터마이징


MongoDB Install

64Bit

[10gen]

name=10gen Repository

baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64

gpgcheck=0

enabled=1

32Bit

[10gen]

name=10gen Repository

baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686

gpgcheck=0

enabled=1

Make Repository

vi /etc/yum.repos.d/10gen.repo

Install

yum install -y mongo-10gen mongo-10gen-server

Location

SettingFile :: /etc/mongod.conf

init script :: /etc/rc.d/init.d/mongod

dataFile :: /var/lib/mongo

logFile :: /var/log/mongo

Service Start

Service mongod start

Auto Start on Boot

chkconfig mongod on


Make Thrift

namespace

각 언어별로 namespace를 제공한다.


ex) namespace java com.thrift.server

Type

일반적으로 String : binary | Integer : i32 | date : i64 로 정의한다.


strcut Work {

1:binary string,

2:i32 number,

3:i64 timestamp

}

Exception

이런식으로 예외처리 가능


exception IOError {
    1:binary message
}

Service

service Example {
    void write(1:binary data) throws (1:IOError io)
    Work get(1:i32 position) throws (1:IOError io)
}

Example Thrift File

파일생성 -> calc.thrift


namespace java calc

namespace php CalcService


struct Work {

1: i32 num1,

2: i32 num2

}


service CalcService {

i32 calc(1:i32 num1, 2:i32 num2)

}

Compile Java Code

thrift --gen java calc.thrift

Compile PHP Code

thrift --gen php calc.thrift


'Thrift' 카테고리의 다른 글

1-1 CentOS 6.5 Thrift Java(Server), PHP(Client) / Thrift Install  (0) 2017.01.18

+ Recent posts