2014년 6월 22일 일요일

영어 반의어

A. 명사
analysis(분석) ↔ synthesis(종합)
ancestor(선조) ↔ descendant(후손)
antipathy(반감) ↔ sympathy(동정, 동감)
ascent(상승) ↔ descent(하강)
birth(출생) ↔ death(사망)
cause(원인) ↔ effect(결과)
comedy(희극) ↔ tragedy(비극)
consumer(소비자) ↔ producer(생산자)
danger(위험) ↔ safety(안전)
defense(방어) ↔ offense(공격)
defeat(패배) ↔ victory(승리)
ebb(썰물) ↔ flow(밀물)
emigrant(출국하는 이민) ↔ immigrant(입국하는 이민)
end(목적) ↔ means(수단)
enemy(적) ↔ friend(친구)
expense(지출) ↔ income(수입)
export(수출) ↔ import(수입)
exterior(외부) ↔ interior(내부)
gain(이익) ↔ loss(손해)
heaven(천국) ↔ hell(지옥)
inferiority(열등, 열세) ↔ superiority(우월, 우세)
joy(기쁨) ↔ sorrow(슬픔)
labor(노동) ↔ capital(자본)
latitude(위도) ↔ longitude(경도)
majority(다수) ↔ minority(소수)
maximum(최대) ↔ minimum(최소)
mercy(자비) ↔ cruelty(잔인)
merit(장점) ↔ demerit(단점)
optimism(낙천주의) ↔ pessimism(비관주의)
optimist(낙천주의자) ↔ pessimist(비관주의자)
practice(실행, 실천) ↔ theory(이론)
peace(평화) ↔ war(전쟁)
quality(질) ↔ quantity(양)
revenue(세입) ↔ expenditure(세출)
soul(영혼) ↔ body(육체)
supply(공급) ↔ demand(수요)
synonym(동의어) ↔ antonym(반의어)
time(시간) ↔ space(공간)
vice(악덕) ↔ virtue(미덕)
B. 형용사
absolute(절대적인) ↔ relative(상대적인)
abstract(추상적인) ↔ concrete(구체적인)
affirmative(긍정의) ↔ negative(부정의)
ancient(고대의) ↔ modern(현대의)
arrogant(거만한) ↔ humble(소박한)
artificial(인공적인) ↔ natural(자연적인)
barren(불모의) ↔ fertile(기름진)
bitter(쓴) ↔ sweet(달콤한)
brave(용감한) ↔ cowardly(겁 많은)
cheap(싼) ↔ expensive(비싼)
clean(깨끗한) ↔ dirty(더러운)
cold(추운) ↔ hot(더운)
conservative(보수적인) ↔ radical(혁신적인), progressive(진보적인)
domestic(국내의) ↔ foreign(외국의)
doubtful(의심스러운) ↔ obvious(명백한)
dynamic(동적인) ↔ static(정적인)
empty(빈) ↔ full(가득 찬)
friendly(우호적인) ↔ hostile(적대시하는)
fat(뚱뚱한) ↔ lean(여윈)
full-time(전임의) ↔ part-time(시간제의)
guilty(유죄의) ↔ innocent(무죄의)
general(일반적인) ↔ special, specific(특수한, 특수의)
inner(내부의) ↔ outer(외부의)
junior(손아래의) ↔ senior(손위의)
loose(헐거운) ↔ tight(꼭 끼는)
mental(정신적인) ↔ physical(육체적인)
male(남성의) ↔ female(여성의)
masculine(남성적인) ↔ feminine(여성적인)
material(물질적인) ↔ spiritual(정신적인)
permanent(영구적인) ↔ temporary(일시적인)
private(사적인) ↔ public(공적인)
passive(수동적인) ↔ active(능동적인)
rural(시골의) ↔ urban(도시의)
sharp(날카로운) ↔ dull(둔한)
simple(단순한) ↔ complex(복잡한)
smooth(부드러운) ↔ rough(거친)
subjective(주관적인) ↔ objective(객관적인)
superior(우월한) ↔ inferior(열등한)
tame(길들인) ↔ wild(야생의)
thick(두꺼운) ↔ thin(얇은)
true(참된) ↔ false(거짓의)
vertical(수직의) ↔ horizontal(수평의)
voluntary(자발적인) ↔ compulsory(강제적인)
wholesale(도매의) ↔ retail(소매의)
C. 동사
accept(수락하다) ↔ reject(거절하다)
admire(찬탄하다) ↔ despise(멸시하다)
allow(허락하다) ↔ forbid(금지하다)
attach(붙이다) ↔ detach(분리하다)
attack(공격하다) ↔ defend(막다, 지키다)
borrow(빌리다) ↔ lend(빌려주다)
consume(소비하다) ↔ produce(생산하다)
conceal(숨기다) ↔ reveal(폭로하다)
construct(건설하다) ↔ destroy(파괴하다)
deduce(연역하다) ↔ induce(귀납하다)
descend(하강하다) ↔ ascend(오르다)
dismiss(해고하다) ↔ employ(고용하다)
earn(벌다) ↔ spend(쓰다, 소비하다)
encourage(격려하다) ↔ discourage(낙담시키다)
forget(잊어버리다) ↔ remember(기억하다)
forgive(용서하다) ↔ punish(벌하다)
freeze(얼어붙다) ↔ melt(녹다)
increase(증가하다) ↔ decrease(감소하다)
lose(시계가 늦다) ↔ gain(빠르다)
permit(허락하다) ↔ forbid(금지하다)
praise(칭찬하다) ↔ blame(비난하다)
push(밀다) ↔ pull(당기다)
respect(존경하다) ↔ despise(경멸하다, 얕보다)
separate(분리하다) ↔ unite(결합하다)
shorten(짧게 하다) ↔ lengthen(길게 하다)
succeed(성공하다) ↔ fail(실패하다)
teach(가르치다) ↔ learn(배우다)
underestimate(과소 평가하다) ↔ overestimate(과대 평가하다)
unite(결합하다) ↔divide(나누다)
D. 접두사와 접미사에 의한 반의어
normal(정상적인) ↔ abnormal(비정상적인)
advantage(유리) ↔ disadvantage(불리)
appear(나타나다) ↔ disappear(사라지다)
arm(무장하다) ↔ disarm(무장 해제하다)
approve(승인하다) ↔ disapprove(승인하지 않다)
honour(명예) ↔ dishonour(불명예)
obey(복종하다) ↔ disobey(불복종하다)
mortal(필멸의) ↔ immortal(불멸의)
partial(불공평한) ↔ impartial(공평한)
patient(참을성 있는) ↔ impatient(참을성 없는)
perfect(완전한) ↔ imperfect(무례한)
modest(겸손한) ↔ immodest(건방진)
possible(가능한) ↔ impossible(불가능한)
ability(능력) ↔ inability(무능력)
complete(완전한) ↔ incomplete(불완전한)
convenient(편리한) ↔ inconvenient(불편한)
direct(직접의) ↔ indirect(간접의)
dependent(의존하는) ↔ independent(독립한)
sufficient(충분한) ↔ insufficient(불충분한)
visible(보이는) ↔ invisible(보이지 않는)
decent(품위 있는) ↔ indecent(품위 없는)
organic(유기의) ↔ inorganic(무기의)
legal(합법적인) ↔ illegal(불법적인)
literate(글을 아는) ↔ illiterate(문맹의)
logical(논리적인) ↔ illogical(불합리한)
regular(규칙적인) ↔ irregular(불규칙적인)
rational(합리적인) ↔ irrational(불합리한)
resistible(저항할 수 있는) ↔ irresistible(저항할 수 없는)
responsible(책임 있는) ↔ irresponsible(책임 없는)
fortune(행운) ↔ misfortune(불행)
understand(이해하다) ↔ misunderstand(오해하다)
lead(인도하다) ↔ mislead(오도하다)
guide(안내하다) ↔ misguide(잘못 안내하다)
treat(대접하다) ↔ maltreat(푸대접하다)
content(만족한) ↔ malcontent(불만의)
nutrition(영양) ↔ malnutrition(영양 실조)
noble(고귀한) ↔ ignoble(비천한)
arctic(북극의) ↔ antarctic(남극의)
conscious(의식의) ↔ unconscious(무의식의)
happy(행복한) ↔ unhappy(불행한)
comfortable(편안한) ↔ uncomfortable(불편한)
employment(취업) ↔ unemployment(실업)
fortunate(운 좋은) ↔ unfortunate(불행한)
worthy(가치 있는) ↔ unworthy(가치 없는)
tie(매다) ↔ untie(풀다)
load(싣다) ↔ unload(짐을 풀다)
exclude(배제하다) ↔ include(포함하다)
enable(가능케 하다) ↔ disable(불가능하게 하다)
overvalue(과대 평가하다) ↔ undervalue(과소 평가하다)
good-natured(상냥한) ↔ ill-natured(못된)
ascent(동의) ↔ dissent(이의)
upward(위로) ↔ downward(아래로)
upstairs(위층으로) ↔ downstairs(아래층으로)
hopeful(희망적인) ↔ hopeless(희망 없는)
cheerful(기분 좋은) ↔ cheerless(기분 나쁜)
powerful(강력한) ↔ powerless(무기력한)
harmful(유해한) ↔ harmless(무해한)
heir(상속인) ↔ heiress(여자 상속인)
host(주인) ↔ hostess(여주인)
poet(시인) ↔ poetess(여류 시인)
author(작가) ↔ authoress(여류 작가)
god(신) ↔ goddess(여신)
actor(배우) ↔ actress(여배우)
hero(주인공) ↔ heroine(여주인공)
widow(과부) ↔ widower(홀아비)
duke(공작) ↔ duchess(공작 부인)
waiter(급사) ↔ waitress(여급)
emperor(황제) ↔ empress(황후)
 
 
영어 반의어 활용
 
 
A
about ↔ exactly
above ↔ below
absence ↔ presence
abundance ↔ lack
to accept ↔ to refuse
accidental ↔ intentional
active ↔ lazy
to add ↔ to subtract
to admit ↔ to deny
adult ↔ child
advanced ↔ elementary
affirmative ↔ negative
after ↔ before
against ↔ for
alike ↔ different
alive ↔ dead
all of ↔ none of
ancient ↔ modern
to agree ↔ to refuse, to argue
to allow ↔ to forbid
already ↔ not yet
always ↔ never
amateur ↔ professional
to amuse ↔ to bore
angel ↔ devil
animal ↔ human
to annoy ↔ to satisfy
to answer ↔ to ask
answer ↔ question
apart ↔ together
approximately ↔ exactly
to argue ↔ to agree
to arrest ↔ to free, to set free
arrival ↔ departure
to arrive ↔ to depart, to leave
artificial ↔ natural
to ask ↔ to answer
asleep ↔ awake
to attack ↔ to defend
attack ↔ defence, protection
attic ↔ cellar
autumn ↔ spring
awake ↔ asleep
awful ↔ delicious, nice, pleasant
B
back ↔ in front of
background ↔ foreground
backward ↔ forward
bad ↔ good
bad luck ↔ fortune, good luck
beauty ↔ ugliness
before ↔ after
to begin ↔ to end, to stop, to finish
beginning ↔ end, ending
behind ↔ in front of
below ↔ above
better ↔ worse
beautiful ↔ ugly
big ↔ small, little
birth ↔ death
bitter ↔ sweet
black ↔ white
body ↔ soul
to bore ↔ to amuse, to be interested in
boring ↔ exciting, interesting
to borrow ↔ to lend
bottom ↔ top
boy ↔ girl
brave ↔ cowardly
to break ↔ to mend
broad ↔ narrow
brother ↔ sister
to build ↔ to destroy
busy ↔ lazy
to buy ↔ to sell
C
calm ↔ excited
careful ↔ careless
careless ↔ careful
to catch ↔ to miss
ceiling ↔ floor
cellar ↔ attic
centre ↔ outskirt, suburb
certainly ↔ probably
changeable ↔ constant
cheap ↔ expensive
child ↔ adult, grown-up
children ↔ parents
clean ↔ dirty
clear ↔ cloudy
clever ↔ stupid
to close ↔ to open
closed ↔ open
cloudy ↔ clear, sunny, bright
cold ↔ hot
cold ↔ heat
comedy ↔ drama, tragedy
complicated ↔ simple
compulsory ↔ voluntary
to connect ↔ to separate
consonant ↔ vowel
constant ↔ changeable
construction ↔ destruction
to continue ↔ to interrupt
correct ↔ false, wrong
cool ↔ warm
courage ↔ fear
courageous ↔ cowardly
cowardly ↔ brave, courageous
to create ↔ to destroy
cruel ↔ human, kind
cry ↔ whisper
cry ↔ to laugh
D
to damage ↔ to repair
danger ↔ security, safety
dangerous ↔ safe
dark ↔ light
daughter ↔ son
dawn ↔ dusk
day ↔ night
dead ↔ alive
death ↔ birth, life
deep ↔ shallow
defeat ↔ victory
defence ↔ attack
to defend ↔ to attack
delicious ↔ awful
to deny ↔ to admit
to depart ↔ to arrive
departure ↔ arrival
desperate ↔ hopeful
to destroy ↔ to build, to create, to form
destruction ↔ construction
devil ↔ angel
dictatorship ↔ republic
to die ↔ to live
different ↔ alike, equal, the same
difficult ↔ easy
dirty ↔ clean
disease ↔ health
disk ↔ dawn
distant ↔ near
to divide ↔ to unite
division ↔ unity
to divorce ↔ to marry
divorced ↔ married
divorce ↔ marriage, wedding
domestic ↔ foreign
down ↔ up
downstairs ↔ upstairs
drama ↔ comedy
dry ↔ humid, wet
dull ↔ interesting
E
early ↔ late
east ↔ west
easy ↔ difficult, hard
elementary ↔ advanced
to emigrate ↔ to immigrate
emigration ↔ immigration
empty ↔ full
to end ↔ to begin
end ↔ beginning
ending ↔ beginning
enemy ↔ friend
to enjoy ↔ to hate
to enter ↔ to leave
entrance ↔ exit
equal ↔ different
even ↔ odd
evening ↔ morning
everybody ↔ nobody
everything ↔ nothing
exactly ↔ about, approximately
excited ↔ calm
exciting ↔ boring
to exclude ↔ to include
exit ↔ entrance
expensive ↔ cheap
export ↔ import
exposure ↔ shelter
extreme ↔ moderate
F
to fail ↔ to succeed, to pass
failure ↔ success
false ↔ correct, true
far ↔ near
fast ↔ slow
fat ↔ slim, thin
fear ↔ courage
female ↔ male
few ↔ many
final ↔ first
to find ↔ to lose
to finish ↔ to begin
finish ↔ start
first ↔ final, last
flat ↔ hilly
floor ↔ ceiling
to follow ↔ to lead
to forbid ↔ to allow, to let, to permit
for ↔ aginst
foreground ↔ background
foreign ↔ domestic
foreigner ↔ native
to forget ↔ to remember
to form ↔ to destroy
fortune ↔ bad luck
forward ↔ backward
to free ↔ to arrest
to freeze ↔ to melt
friend ↔ enemy
front ↔ rear
in front of ↔ back, behind
full ↔ empty
funny ↔ serious
future ↔ past
G
general ↔ particular, special
generous ↔ mean
gentle ↔ violent, rough, strict
gentleman ↔ lady
girl ↔ boy
to give ↔ to take
good ↔ bad
good luck ↔ bad luck
grown-up ↔ child
guest ↔ host
guilty ↔ innocent
H
happiness ↔ sadness
happy ↔ sad
handsome ↔ ugly
hard ↔ easy, soft
to harvest ↔ to plant
to hate ↔ to enjoy, to like, to love
health ↔ disease, illness
healthy ↔ ill
heat ↔ cold
heaven ↔ hell
heavy ↔ light
hell ↔ heaven
high ↔ deep
high ↔ low
hilly ↔ flat
to hit ↔ to miss
hopeful ↔ desperate, hopeless
hopeless ↔ hopeful
horizontical ↔ vertical
host ↔ guest, visitor
hot ↔ cold
huge ↔ tiny
human ↔ animal
human ↔ cruel
humid ↔ dry
hungry ↔ thirsty
husband ↔ wife
I
in front of ↔ back, behind
to ignore ↔ to notice
ill ↔ healty, well
to immigrate ↔ to emigrate
immigration ↔ emigration
import ↔ export
to include ↔ to exclude
to increase ↔ to reduce
innocent ↔ guilty
intelligent ↔ silly, stupid
intentional ↔ accidental
to be interested in ↔ to bore
interesting ↔ boring, dull
to interrupt ↔ to continue
J
junior ↔ senior
K
kind ↔ cruel
L
lack ↔ abundance, plenty
lady ↔ gentleman
to land ↔ to take off
land ↔ water
large ↔ small
last ↔ first
late ↔ early
to laugh ↔ to cry
lazy ↔ active, busy
to lead ↔ to follow
to learn ↔ to teach
to leave ↔ to arrive, to enter
left ↔ right
to lend ↔ to borrow
less ↔ more
to let ↔ to forbid
to lie ↔ to stand
life ↔ death
to like ↔ to hate
light ↔ dark
light ↔ heavy
liquid ↔ solid
little ↔ big, large
little ↔ much
to live ↔ to die
long ↔ short
to lose ↔ to find, to win
loser ↔ winner
loud ↔ quiet
to love ↔ to hate
lovely ↔ terrible
low ↔ high
bad luck ↔ good luck
good luck ↔ bad luck
M
major ↔ minor
male ↔ female
man ↔ woman
many ↔ few, some
marriage ↔ divorce
married ↔ divorced
to marry ↔ to divorce
master ↔ servant
maximum ↔ minimum
mean ↔ generous
to melt ↔ to freeze
men ↔ women
to mend ↔ to break
mess ↔ order
midnight ↔ noon
minimum ↔ maximum
minor ↔ major
to miss ↔ to hit
to miss ↔ to catch
moderate ↔ extreme
modern ↔ ancient, old
monarchy ↔ republic
moon ↔ sun
more ↔ less
morning ↔ evening
mountain ↔ valley
much ↔ little
N
narrow ↔ broad, wide
nasty ↔ nice, pleasant
native ↔ foreigner, stranger
natural ↔ artificial
near ↔ distant, far
negative ↔ affirmative
nephew ↔ niece
never ↔ always
new ↔ ancient, old
nice ↔ awful, nasty
niece ↔ nephew
night ↔ day
no ↔ yes
nobody ↔ everybody
noisy ↔ quiet, silent
noon ↔ midnight
none of ↔ al lof
normal ↔ strange
north ↔ south
not yet ↔ already
nothing ↔ everything
to notice ↔ to ignore
now ↔ then
O
occupied ↔ vacant
odd ↔ even
off ↔ on
often ↔ seldom, sometimes
old ↔ modern, new, young
on ↔ off
to open ↔ to close, to shut
open ↔ closed
opponent ↔ supporter
opposite ↔ synonym
order ↔ mess
ordinary ↔ special
other ↔ same
outskirt ↔ centre
over ↔ under
P
parents ↔ children
partial ↔ total
particular ↔ general
to pass ↔ to fail
past ↔ future, present
peace ↔ war
to permit ↔ to allow, to forbid
to plant ↔ to harvest
plenty ↔ lack
pleasant ↔ awful
polite ↔ rude
poor ↔ rich, wealthy
poverty ↔ wealth
powerful ↔ weak
presence ↔ absence
present ↔ past
pretty ↔ ugly
private ↔ public
probably ↔ certainly
professional ↔ amateur
to protect ↔ to attack
protection ↔ attack
public ↔ private
to pull ↔ to push
pupil ↔ teacher
to push ↔ to pull
Q
question ↔ answer
quick ↔ slow
quiet ↔ loud, noisy
R
rainy ↔ sunny
rear ↔ front
to receive ↔ to send
to reduce ↔ to increase
to refuse ↔ to agree, to accept
regret ↔ satisfaction
to remember ↔ to forget
to repair ↔ to damage
to reply ↔ to ask
reply ↔ question
republic ↔ dictatorship, monarchy
to rest ↔ to work
rich ↔ poor
right ↔ left
right ↔ wrong
to rise ↔ to sink
rough ↔ gentle
rough ↔ smooth
rude ↔ polite
rural ↔ urban
S
sad ↔ happy
sadness ↔ happiness
safe ↔ dangerous
safety ↔ danger
salt ↔ sugar
the same ↔ different, the other
satisfaction ↔ regret
to satisfy ↔ to annoy
to save ↔ to spend, to waste
to scream ↔ to whisper
security ↔ danger
seldom ↔ often
to sell ↔ to buy
to send ↔ to receive, to save
senior ↔ junior
to separate ↔ to connect, to unite
serious ↔ funny
servant ↔ master
to set free ↔ to arrest
shallow ↔ deep
shelter ↔ exposure
short ↔ long, tall
to shout ↔ to whisper
to shut ↔ to open
silent ↔ noisy
silly ↔ intelligent
simple ↔ complicated
to sink ↔ to rise
sister ↔ brother
slim ↔ fat
slow ↔ fast, quick
small ↔ big, large, tall
smooth ↔ rough
soft ↔ hard
solid ↔ liquid
some ↔ many
sometimes ↔ often
son ↔ daughter
soul ↔ body
sour ↔ sweet
south ↔ north
special ↔ general, ordinary
spring ↔ autumn
to start ↔ to stop
start ↔ finish, end, stop
to stop ↔ to start
to stand ↔ to lie
strange ↔ normal
stranger ↔ native
strict ↔ gentle
stupid ↔ clever, intelligent
suburb ↔ centre
to succeed ↔ to fail
success ↔ failure
to subtract ↔ to add
sugar ↔ salt
summer ↔ winter
sun ↔ moon
sunny ↔ cloudy, rainy
supporter ↔ opponent
to suspect ↔ to trust
sweet ↔ bitter, sour
synonym ↔ opposite
T
to take ↔ to give
to take off ↔ to land
tall ↔ small, short
to teach ↔ to learn
teacher ↔ pupil
then ↔ now
terrible ↔ lovely
thick ↔ thin
thin ↔ thick, fat
thirsty ↔ hungry
tiny ↔ huge
together ↔ apart
tomorrow ↔ yesterday
top ↔ bottom
total ↔ partial
town ↔ village
tragedy ↔ comedy
TRUE ↔ FALSE
to trust ↔ to suspect
U
ugliness ↔ beauty
ugly ↔ beautiful, handsome (boys), pretty (girls)
under ↔ over
to unite ↔ to divide, to separate
unity ↔ division
up ↔ down
upstairs ↔ downstairs
urban ↔ rural
useful ↔ useless
useless ↔ useful
V
vacant ↔ occupied
valley ↔ mountain
vertical ↔ horizontal
victory ↔ defeat
village ↔ town
violent ↔ gentle
visitor ↔ host
voluntary ↔ compulsory
vowel ↔ consonant
W
war ↔ peace
warm ↔ cool
to waste ↔ to save
water ↔ land
weak ↔ powerful
wealth ↔ poverty
wealthy ↔ poor
wedding ↔ divorce
well (gesund) ↔ ill
west ↔ east
wet ↔ dry
to whisper ↔ to scream, to shout
white ↔ black
wide ↔ narrow
wife ↔ husband
to win ↔ to lose
winner ↔ loser
winter ↔ summer
to work ↔ to rest
woman ↔ man
women ↔ men
worse ↔ better
wrong ↔ correct, right
Y
yes ↔ no
yesterday ↔ tomorrow
young ↔ old

2014년 5월 16일 금요일

IT - EIP


최근(2014) IT 프로젝트에서 오픈소스 이용증가
- 최근 많이 사용하는 오픈소스
  1. NoSQL: MongoDB, CouchDB, Hbase, Infinispan
  2. Messaging: ActiveMQ, ZeroMQ, JMS, RabbitMQ, AMQP
  3. SNS: twitter, facebook
  4. Framework: String, Vert.x, iBatis/MyBatis
  5. Networking: MINA 1/2, Netty, MQTT, SIP
  6. Cloud: Amazon, Google

- 대용량 데이터의 실시간 처리/분석, 고속으로 다양한 시스템과 프로토콜로 메시지 전달
--> EIP(Enterprise Integration Patterns) 을 기반으로 오픈 소스 통합 프레임워크 ==> Apache Camel

EIP: http://www.enterpriseintegrationpatterns.com/

* Apache Camel
  - Concise Application Messageing Exchange Language
  - Apache camel is a powerful open source integration framework based on known Enterprise Integration Patterns

1)Design Pattern: Adapter, Facade, Proxy, Observer....
2)Enterprise Application Architecture: Gateway, MVC, Registry, Repository, Service Layer...
3)EIP: Aggregator, Content Filter, Recipient List, Request/Relay, Publish-Subscribe Channel


2014년 5월 6일 화요일

2014년 4월 8일 화요일

Let it go

Let It Go


The snow glows white on the mountain tonight
오늘 밤 산 위에 눈이 하얗게 빛나
Not a footprint to be seen
발자국조차 보이지 않아
A kingdom of isolation
고립의 왕국
And it looks like I'm the queen
내가 그곳 여왕인거 같네

The wind is howling like this swirling storm inside
지금 내 맘 속의 돌풍처럼 바람은 휘몰아치고
Couldn't keep it in, heaven knows I've tried
숨길수 없었어, 하늘만이 내 노력을 알겠지

Don't let them in, don't let them see
그들을 들여보내지 마, 그들에게 보이지 마
Be the good girl you always have to be
항상 착한 소녀 모습을 보여주렴
Conceal, don't feel, don't let them know
숨기고, 느끼려 하지 말고, 그들이 알게 하지 마
Well, now they know
하지만 이젠 알아버렸네

Let it go, let it go
다잊어, 다잊어
Can't hold it back anymore
더이상 감추고 있을수 없어
Let it go, let it go
다잊어, 다잊어
Turn away and slam the door
뒤돌아서서 문을 닫아버려
I don't care what they're going to say
그들이 뭐라하던 상관 안할거야
Let the storm rage on
폭풍아 계속 몰아쳐라
The cold never bothered me anyway
어차피 추위는 날 괴롭히지 못하니까

It's funny how some distance makes everything seem small
거릴 두고 보니까 모든 것들이 사소해보여 우스워
And the fears that once controlled me can't get to me at all
날 구속했던 두려움도 이젠 날 잡을 수가 없네
It's time to see what I can do
내가 뭘 할수 있는지 알아볼거야
To test the limits and break through
한계를 찾고 돌파하기 위해
No right, no wrong, no rules for me
옳고그름, 규칙따윈 없어
I'm free
난 이제 자유야

Let it go, let it go
다잊어, 다잊어
I am one with the wind and sky
나는 바람과 하늘과 하나야
Let it go, let it go
다잊어, 다잊어
You'll never see me cry
이제 절대 울지 않을거야
Here I stand and here I'll stay
우뚝 여기 서서 바로 이곳에 자리잡을래
Let the storm rage on
폭풍아 계속 몰아쳐라

My power flurries through the air into the ground
내 힘이 하늘에서 땅까지 흩날리네
My soul is spiraling in frozen fractals all around
내 영혼은 눈모양으로 용솟음치고
And one thought crystallizes like an icy blast
각각의 생각는 빠르게 얼음으로 결정화되네
I'm never going back, the past is in the past
절대 안돌아갈거야, 과거는 과거일 뿐

Let it go, let it go
다잊어, 다잊어
And I'll rise like the break of dawn
새벽의 여명처럼 솟아오를거야
Let it go, let it go
다잊어, 다잊어
That perfect girl is gone
착하기만 했던 소녀는 이제 없어
Here I stand in the light of day
여기 햇살 가운데 우뚝 서있어
Let the storm rage on
폭풍아 계속 몰아쳐라
The cold never bothered me anyway
어차피 추위는 날 괴롭히지 못하니까

2014년 3월 24일 월요일

First English Class

Hello! Welcome to the First Course English Class.
This is Silvie Marquez. Ms. Marquez is your English Teacher.
Have fun with Ms. Marquez and the other students in the English class.
Click Next to continue.

In this unit you will learn
classroom directions.
the letters of the alphabet.
how to introduce yourself.
how to write your name on a form.

This is Miguel Morales.
Miguel works at a café.
He is from Mexico.
Miguel speaks a little English.

Miguel does not understand.

Ryan is Miguel's boss.
Ryan says, "Please learn more English."

Miguel is at the adult school.
He is in English class.
He is learning new English words.
Click Next to learn new English words.

Classroom Directions - Learn new words
Click new words to see and hear a word. Click Listen to hear the word again.
ask
listen
point
read
say
spell
type
watch
write

Click Listen. Choose the matching picture. Then click Check.

You say, "Nice to meet you, too"
Now let's watch some people at a party'
Listen to the introductions
Now you ask me
Point to the letter you hear
Pleas spell that
Write your classmates' names on this paper

Watch the students practice introductions in the first English class.

Let me remember!
First and Last Name
practice introduction!

Hello. I'm Natasha.
Hi, I'm Debbie.
Nice to meet you.
Nice to meet you, too.

Listen to the letters of the alphabet

Click Listen. Click the 5 letters you hear. Click Check.
Watch Miguel practice spelling the words on the menu.
pie, coffee, hamburger

Watch Ms. Marquez ask a student his first and last name.

What's your first name?
What's your last name?

Click Listen to hear the names. Read the two forms.
Click the correct form. Then click Check.

Watch Ramon in the café. He is looking for Miguel.


Click play to watch the video again. Read the 2 sentences.
Click the correct sentence. Then click Check.

Miguel is happy in his first English class. Watch and listen.


I can introduce myself
I can say the letters of the alphabet
I can spell my first and last name in English

2013년 12월 27일 금요일

Reactor 패턴

Reactor pattern

reactor pattern 에 대해서 알아보자. Node.js 에서 Event-driven network programming 이 유명해 졌는데, 찾아보니 이미 여러개의 framework 들이 존재했다. 그런데 이런 pattern 을 Reactor pattern 이라고 해서, Reactor pattern 에 대해 찾아보고 설명을 몇자 적어놓는다.

정의
일단 정의를 보면,

서비스를 처리하는 쪽(서버라고 생각하면 될 듯 하다.)으로 동시에 요청이 들어온 service request 를 처리하기 위한 event handling pattern 이라고 한다.
이 때 서버에서는 들어온 요청들을 분류(demux)해서 이 녀석들을 적절한 request handler 에 dispatch 한다. 이 때 동시에 여러개의 요청을 처리하는 것이 아니라, 하나에 대한 처리를 끝내고 그 다음 것을 처리하는 방식으로 하나씩 처리한다.
The reactor design pattern is an event handling pattern for handling service requests delivered concurrently to a service handler by one or more inputs. The service handler then demultiplexes the incoming requests and dispatches them synchronously to the associated request handlers.[ref. 1]
이런 Reactor pattern 을 이용한 여러 web server 가 있는데, Node.js 도 그중에 하나이다. 이외에 여러 개들이 있는데, ref. 1에서 확인하자.

기존의 Design


from : ref. 3
기존의 ThreadPool 을 이용하는 경우를 고려 해 보자.
  1. ServerSocket 으로 request A 가 들어오면 Thread 를 할당 해 준다.
  2. 그럼 이 Thread 는 그 socket 을 가지고 read, write 작업(IO) 등을 할 것이다. 그런데 이 와중에 ServerSocket 에 request B가 들어오면, context switching 이 일어난다.
  3. 그럼 새로 들어온 request 에 대해 Thread 를 배분해주고, 또 이 socket 으로 read()/write() 등의 작업을 할 것이다.
  4. 그러면서 A 의 작업을 하기 위해 중간에 다시 context switching 하고, 그러다 다시 B 작업하려고 context switching 하면서 IO 작업을 모두 처리할 것이다.

그런데 reqest A 가 들어와서 Thread 가 만들어진 후에 또다른 reqeust 가 들어오지 않는 상황을 가정 해 보자.

그럼 request A 를 처리하다가 중간에 request 가 들어왔는지 확인하기 위해 context switching 을 해야 한다. 만약 들어왔으면 Thread 를 만들어주고, 그렇지 않으면 다시 request A 를 처리하러 돌아갈 것이다.

그런데 이렇게 확인하는 시간이 아깝다.

codes

class Server implements Runnable {
   public void run() {
       try {
           ServerSocket ss = new ServerSocket(PORT);
           while (!Thread.interrupted())
               new Thread(new Handler(ss.accept())).start();
        // or, single-threaded, or a thread pool
       } catch (IOException ex) { /* ... */ }
   }
   static class Handler implements Runnable {
       final Socket socket;
       Handler(Socket s) { socket = s; }
       public void run() {
           try {
               byte[] input = new byte[MAX_INPUT];
               socket.getInputStream().read(input);
               byte[] output = process(input);
               socket.getOutputStream().write(output);
           } catch (IOException ex) { /* ... */ }
       }
       private byte[] process(byte[] cmd) { /* ... */ }
    }
}

Reactor Pattern

그래서 나온 것이 Reactor Pattern 이라고 한다.[ref. 2]

Reactor 는 우리나라 말로 하면 "반응로" 이다. 그러니까 event 가 발생하면 반응하는 녀석이다.

Reactor 는 event 가 발생하기를 기다리고, event 가 발생하면 Reactor 는 이 event 를 적절한 event handler 에 넘겨주는 역할을 하게 된다.


********

여기서 부터는 ref. 2 의 내용을 번역하고 각색했다.

ref. 3 에서는 java code 로 Reactor pattern 을 설명해 주는 ppt 이다. ref. 3 의 코드를 바탕으로 설명할 것이다. 참고로 이 java code 는 non blocking io library 인 nio package 를 사용한다.

Reactor pattern 에 중요한 2가지 요소가 있다. 하나는 event 를 받고 전달해주는 Reactor 와 다른 하나는 Reactor 가 보낸 event 를 실제로 처리하는 Handler 가 있다. ref. 3 에서 UI programming 과 연관지어서 설명한 것을 인용하면,
  • Reactor 는 UI 를 처리하는 thread 이고,
  • Handlers 는 UI의 ActionListeners 라고 생각하면 된다.
다시 얘기하면,
  • Reactor 로 event 가 들어오면 알맞는 handler 로 dispatch 주는 역할을 담당하고, 
  • Handler 는 이 dispatch 된 event 를 받아서 처리하는 역할을 하게 된다.
이 추상적인 이야기를 ref. 3 에 있는 java 코드를 통해서 확인하자.

Sigle-threaded codes
먼저, 하나의 thread 를 사용해서 동작하는 것만 고려하자.

소스코드를 이해하기 위해서 몇가지 class 에 대한 이해를 해야 한다.
  1. Channels :non-blocking read 를 지원해 주는 녀석이다.
  2. Selector : Selector 는 어느 channel set 이 IO event 를 가지고 있는지를 알려준다. Selector.select() 는 I/O 가 발생한 channel 을 return 해주게 되는데, return 할 channel 이 없다면 계속 기다리게 된다.(block). 이 block 된 녀석을 바로 return 시켜주는 녀석이 Selector.wakeup() 이다.
    Selector.selectedKeys() 는 Selection Key 를 return 해 준다. Reactor 는 이 Selection Key 를 보고 어떤 handler 로 넘겨줄 지를 결정한다.
  3. SelectionKeys : SelectionKey 는 Channel 과 Handler 에 대한 reference 를 가지고 있다. ServerSocketChannel 에 selector 를 등록하면 key 를 준다. 이 key 가 SelectionKey 이다.
  4. Acceptor : Acceptor 는 handler 다. connection 을 만들기 위한 special handler 이다.


final class Handler implements Runnable {
    final SocketChannel socket;
    final SelectionKey sk;
    ...
   
    Handler(Selector sel, SocketChannel c) throws IOException {
        socket = c;
        c.configureBlocking(false);
        // Optionally try first read now
        sk = socket.register(sel, 0);
        sk.attach(this);
        sk.interestOps(SelectionKey.OP_READ);
        sel.wakeup();
    }
    ...
}

Reactor 동작 : Acceptor 등록

Reactor 는 event 가 들어오면, ServerSocketChannel 을 만들기 위해 accept 를 해야 한다.

class Reactor implements Runnable {
    final Selector selector;
    final ServerSocketChannel serverSocket;

    Reactor(int port) throws IOException {
        selector = Selector.open();
        serverSocket = ServerSocketChannel.open();
        serverSocket.socket().bind(
                new InetSocketAddress(port));
        serverSocket.configureBlocking(false);
        SelectionKey sk =
                serverSocket.register(selector,
                        SelectionKey.OP_ACCEPT);
        sk.attach(new Acceptor());
    }

그러므로 SelectionKey 0 는 Acceptor 에 묶이게 된다.(Bind 된다.)
Acceptor 는 connection 을 만들기 위한 special handler 이다.
Reactor 가 SelectionKey 0 를 보고 Acceptor 에게 넘겨야 겠다는 것을 알 수 있다.
  • SelectionKey sk = serverSocket.register(selector,SelectionKey.OP_ACCEPT);
이 부분을 통해서 selector 와 channel 을 함께 등록을 하고, return 되는 SelectionKey 가 OP_ACCEPT 에 반응하도록 설정한다.

Reactor 동작 : dispatch
public void run() { // normally in a new Thread
        try {
            while (!Thread.interrupted()) {
                selector.select();
                Set selected = selector.selectedKeys();
                Iterator it = selected.iterator();
                while (it.hasNext())
                    dispatch((SelectionKey) (it.next());
                selected.clear();
            }
        } catch (IOException ex) { /* ... */ }
    }

Selector 는 IO event 를 계속해서 찾는다.

Selector.select() 를 호출한 후 selectedKeys() 를 통해 pending 된 event 가 있는 Channel 들의 SelectionKey 들을 가져올 수 있다.

이 때 SelectionKey 0 가 있으면, ServerSocketChannel 에 event 가 발생했다는 의미이고, Reactor 는 이 event 에 대한 connection 을 만들기 위해 Acceptor 에 보낸다.

Acceptor 동작

class Acceptor implements Runnable { // inner

        public void run() {
            try {
                SocketChannel c = serverSocket.accept();
                if (c != null)
                    new Handler(selector, c);
            } catch (IOException ex) { /* ... */ }
        }
    }


final class Handler implements Runnable {
    final SocketChannel socket;
    final SelectionKey sk;
    ...
   
    Handler(Selector sel, SocketChannel c) throws IOException {
        socket = c;
        c.configureBlocking(false);
        // Optionally try first read now
        sk = socket.register(sel, 0);
        sk.attach(this);
        sk.interestOps(SelectionKey.OP_READ);
        sel.wakeup();
    }
    ...
}


그렇게 Acceptor 가 client 1 의 connection 에 대한 channel 인 ServerSocketChannel 1 을 만들게 된다. 그리고 나서 Selector 를 ServerSocketChannel 1 에 등록하고 SelectionKey 를 얻고, 이 key 에 handler 를 attach 한다.

여기서
  • interestOps(SelectionKey.OP_READ)
를 통해서 selector 가 이 selectionKey 를 READ event 가 발생했을 때만 return 하도록 설정해 준다. 쉽게 얘기하면, 이 selectionKey 와 관련된 event type 을 정해주는 것이다.

이제 client 는 이 ServerSocketChannel 1을 이용해서 read from server / write to server 를 할 수 있다. connection 은 Acceptor 를 통해 이미 했기 때문에 이제는 필요없다.

그러고나서 sel.wakeup()[ref. 7] 을 호출하면, select()(code 에서는 selector.select() 가 될 것이다.) 가 바로 return 할 수있는 channel 이 없어도 바로 return 해 주고 그로 인해 blocked 상태에서 벗어나서 thead 가 다시 깨어나게 된다.



정리

정리해서 다시 이야기 하면, Server 는 Selector.select() 를 호출한다.
  • 이 때 SelectionKey 1 이 return 된다면, 이 것은 ServerSocketChannel 1 이 event 를 가지고 있다는 이야기가 되고, Reactor 는 이 SelectionKey1 이 bind 한 Handler 1 에 dispatch 해주게 된다.
  • 만약 SelectionKey 0 이 return 된다면, 이것은 ServerSocketChannel 0 에서 event 가 발생한 것이고, 새로운 client 가 접속한 것이다. 이 SelectionKey 0 는 Acceptor 에 bind 되어 있기 때문에 이 event 는 Acceptor 로 dispatch 된다.

"특정 ServerSocketCannel" 에서 "특정 event" 가 발생했을 때, 해당하는 SelectionKey 가 selector 에게 return 된다. 그러면 "selector 에서 가져온 SelectionKey" 가 가지고 있는 handler 를 실행한다.



여기까지 구현으로는 Reactor 는 어차피 Handler 의 작업이 끝나기를 기다려야 한다. selectionKey 하나를 다 처리하고 나야 다음 selectionKey 를 처리하게 된다. 우리는 이것을 극복하기 위해 multi-thread 를 이용할 수 있다.


codes

class Reactor implements Runnable {
    final Selector selector;
    final ServerSocketChannel serverSocket;

    Reactor(int port) throws IOException {
        selector = Selector.open();
        serverSocket = ServerSocketChannel.open();
        serverSocket.socket().bind(
                new InetSocketAddress(port));
        serverSocket.configureBlocking(false);
        SelectionKey sk =
                serverSocket.register(selector,SelectionKey.OP_ACCEPT);
        sk.attach(new Acceptor());
    }

    /*
    Alternatively, use explicit SPI provider:
    SelectorProvider p = SelectorProvider.provider();
    selector = p.openSelector();
    serverSocket = p.openServerSocketChannel();
    */
    public void run() { // normally in a new Thread
        try {
            while (!Thread.interrupted()) {
                selector.select();
                Set selected = selector.selectedKeys();
                Iterator it = selected.iterator();
                while (it.hasNext())
                    dispatch((SelectionKey) (it.next());
                selected.clear();
            }
        } catch (IOException ex) { /* ... */ }
    }

    void dispatch(SelectionKey k) {
        Runnable r = (Runnable) (k.attachment());
        if (r != null)
            r.run();
    }

    class Acceptor implements Runnable { // inner

        public void run() {
            try {
                SocketChannel c = serverSocket.accept();
                if (c != null)
                    new Handler(selector, c);
            } catch (IOException ex) { /* ... */ }
        }
    }
}

final class Handler implements Runnable {
    final SocketChannel socket;
    final SelectionKey sk;
    ByteBuffer input = ByteBuffer.allocate(MAXIN);
    ByteBuffer output = ByteBuffer.allocate(MAXOUT);
    static final int READING = 0, SENDING = 1;
    int state = READING;

    Handler(Selector sel, SocketChannel c)
            throws IOException {
        socket = c;
        c.configureBlocking(false);
        // Optionally try first read now
        sk = socket.register(sel, 0);
        sk.attach(this);
        sk.interestOps(SelectionKey.OP_READ);
        sel.wakeup();
    }

    boolean inputIsComplete() { /* ... */ }

    boolean outputIsComplete() { /* ... */ }

    void process() { /* ... */ }


    // class Handler continued
    public void run() {
        try {
            if (state == READING) read();
            else if (state == SENDING) send();
        } catch (IOException ex) { /* ... */ }
    }

    void read() throws IOException {
        int readCount = socket.read(input);
        if (readCount > 0) {
            process();
        }

        state = SENDING;
        // Normally also do first write now
        sk.interestOps(SelectionKey.OP_WRITE);
    }

    void send() throws IOException {
        socket.write(output);
        if (outputIsComplete()) sk.cancel();
    }
}

Multi-threaded
Handler 부분을 thread pool 을 이용해서 동시에 여러개를 처리할 수 있도록 한다.

ref. 9 에서는 상속을 이용해서 구현하였지만, 여기서는 차이점을 잘 알아볼 수 있도록 변경사항을 기존의 Handler 에 추가했다.

아래를 보면 PROCESSING 이라는 state 를 더 추가했다.

final class Handler implements Runnable {
    final SocketChannel socket;
    final SelectionKey sk;
    ByteBuffer input = ByteBuffer.allocate(MAXIN);
    ByteBuffer output = ByteBuffer.allocate(MAXOUT);
    static final int READING = 0, SENDING = 1;
    int state = READING;

    
    static ExecutorService pool = Executors.newFixedThreadPool(2);
    static final int PROCESSING = 2;
    

    Handler(Selector sel, SocketChannel c)
            throws IOException {
        socket = c;
        c.configureBlocking(false);
        // Optionally try first read now
        sk = socket.register(sel, 0);
        sk.attach(this);
        sk.interestOps(SelectionKey.OP_READ);
        sel.wakeup();
    }

    boolean inputIsComplete() { /* ... */ }

    boolean outputIsComplete() { /* ... */ }

    
    synchronized void process() { /* ... */ }
    


    // class Handler continued
    public void run() {
        try {
            if (state == READING) read();
            else if (state == SENDING) send();
        } catch (IOException ex) { /* ... */ }
    }

    
    synchronized void read() throws IOException {
        int readCount = socketChannel.read(input);
        if (readCount > 0) {
            
            state = PROCESSING;
            pool.execute(new Processer(readCount));
            
        }
        //We are interested in writing back to the client soon after read processing is done.
        selectionKey.interestOps(SelectionKey.OP_WRITE);
    }
    

    void send() throws IOException {
        socket.write(output);
        if (outputIsComplete()) sk.cancel();
    }

    
    synchronized processAndChageState(int readCount){
        process(readCount)
        state = SENDING;
    }
    
    class Processer implements Runnable {
        int readCount;
        Processer(int readCount) {
            this.readCount =  readCount;
        }
        public void run() {
            processAndChageState(readCount);
        }
    }
    
}

See Also

  1. Proactor Pattern 발표 자료
  2. proactor design pattern (번역),2012년 5월 18일 금요일
  3. http://www.tornadoweb.org/en/stable/

Reference
  1. http://en.wikipedia.org/wiki/Reactor_pattern
  2. http://jeewanthad.blogspot.kr/2013/02/reactor-pattern-explained-part-1.html
  3. Scalable IO in Java, Doug Lea, State University of New York at Oswego
  4. SelectionKey (Java Platform SE 7 )
  5. Selector (Java Platform SE 7 )
  6. SelectableChannel (Java Platform SE 7 )
  7. Java NIO Selector By Jakob Jenkov
  8. http://jeewanthad.blogspot.kr/2013/03/reacter-pattern-explained-part-2.html
  9. http://jeewanthad.blogspot.kr/2013/03/reacter-pattern-explained-part-3.html