독도 광고 모금 캠페인


2009. 1. 15. 09:50

[야탑 소극장]천방지축 꼬마마법사



2008.11.29 야탑 소극장.. ^^

솔빈이랑 정말 오랜만에 소극장 나들이.. ^^
주말마다 뭐가 그리 바쁜지.. 계속 밖으로만 놀다가
다시 조금씩 추워져서 소극장에 왔다.

천방지축 꼬마마법사..
오랜만에 보는 거고 상휘도 없는데.. 빈이 잘 봐준다. ^^
심술쟁이 꼬마마법사가 착한 마법사가 되어 마법사 파티에 갈 수 있게 되었다는 이야기.. ^^

다시 시작된 공연장 나들이..
올 겨울 솔빈이의 감성을 많이 자극하려나? ㅎㅎ

나오는 길에 뉴코아 아울렛 6층에 크리스마스 분위기 왕창 내어주시는 포토존이 있어서
울 빈이도 찰칵~!!


볼이 빨갛네.. ㅎㅎ

이왕 엄마랑 나온김에 그 좋아라 하는 놀이기구도 타 주시공.. ㅎㅎ
(완전 신난 솔빈 ㅋㅋ)


아주아주 즐거운 하루를 보냈어요~!!

'People > Bin's Story' 카테고리의 다른 글

국립과학박물관에 갔어요~  (0) 2008.12.30
광명역에 언니들 마중간 상휘랑 솔빈.. ^^  (0) 2008.12.30
[동요]밀림으로  (1) 2008.12.19
2009. 1. 14. 13:48

Writing JavaScript with DWR

DWR 을 처음한 나에게 제일 도움이 되는 글이다.. ^^
callback 함수를 처음 써본 난 이 한줄이 왜 그리 어려운건지..
이렇게 쭉~~~ 늘여진 걸 순서대로 줄이니 그야말로 이해가 쉽네..


출처 : http://directwebremoting.org/dwr/browser/intro


Writing JavaScript with DWR

DWR generates Javascript code that is similar to the Java code that exported using dwr.xml.

The biggest challenge in creating a remote interface to match some Java code across Ajax is the (usually) asynchronous nature of Ajax, compared to the synchronous nature of a normal Java call.

DWR solves this problem by introducing a callback function that is called when the data is returned from the server.

There are 2 recommended ways to make a call using DWR. Either using by appending a callback function to the parameter list or by appending a call meta data object.

It is also possible to put the callback function at the start of the parameter list, however this option is not advised because there are some issues when dealing with automatic http objects (see "Alternative Method"). This method mostly remains for backwards compatibility.

Simple Callback Functions

Suppose we have a Java method that looks like this:

public class Remote {
    public String getData(int index) { ... }
}

We can use this from Javascript as follows:

<script type="text/javascript"
    src="[WEBAPP]/dwr/interface/Remote.js"> </script>
<script type="text/javascript"
    src="[WEBAPP]/dwr/engine.js"> </script>
...

function handleGetData(str) {
  alert(str);
}

Remote.getData(42, handleGetData);

'42' is just the parameter to the getData() Java function - see above.

Alternatively you can use the all-in-one-line version:

Remote.getData(42, function(str) { alert(str); });

Call Meta-Data Objects

The alternative syntax is to make use of a call meta-data object that specifies the callback function and (optionally) other options. The example above would become:

Remote.getData(42, {
  callback:function(str) { alert(str); }
});

This method has some advantages: Depending on your style it may be easier to read, but more importantly it allows you to specify extra call options.

Timeouts and Handling Errors

In addition to the callback meta data you can also specify a timeout and an errorHandler. For example:

Remote.getData(42, {
  callback:function(str) { alert(str); },
  timeout:5000,
  errorHandler:function(message) { alert("Oops: " + message); }
});

Finding the callback method

There are some instances when it might not be tricky to distinguish between the various callback placement options. (Remember that Javascript does not support overloaded functions). For example:

Remote.method({ timeout:3 }, { errorHandler:somefunc });

One of the 2 parameters is a bean parameter and the other is a call meta-data object but we have no way of telling which. In a cross-browser world we have to assume that null == undefined. So currently, the rules are:

  • If there is a function first or last then this is the callback function, there is no call meta-data object and the other parameters are the Java args.
  • Otherwise, if the last param is an object with a callback member that is a function then this is call meta-data the other params are Java args.
  • Otherwise, if the first parameter is null we assume that there is no callback function and the remaining params are Java args. HOWEVER we check to see that the last param is not null and give a warning if it is.
  • Finally if the last param is null, then there is no callback function.
  • Otherwise, this is a badly formatted request - signal an error.

Creating Javascript objects to match Java objects

Suppose you have an exposed Java method like this:

public class Remote {
  public void setPerson(Person p) {
    this.person = p;
  }
}

And Person looks like this:

public Person {
  private String name;
  private int age;
  private Date[] appointments;
  // getters and setters ...
}

Then you can call this from Javascript like this:

var p = {
  name:"Fred Bloggs",
  age:42,
  appointments:[ new Date(), new Date("1 Jan 2008") ]
};
Remote.setPerson(p);

Any fields missing from the Javascript representation will be left unset in the Java version.

Since the setter returned 'void' we did not need to use a callback and could just leave it out. If you want to be notified of the completion of a server-side method that returns void then you can include a callback method. Obviously DWR will not pass any data to it.


'Works > My Project' 카테고리의 다른 글

[스크랩]Spring MVC - 구성 요소 및 처리 흐름  (0) 2009.01.19
OZ Report  (0) 2008.11.18
OZ Report Designer  (0) 2008.11.18
2009. 1. 14. 00:33

The Brave One, 2007


처음에 자막없이 보다가 주인공이 라디오 진행자라는 것을 안순간..
나래이션(라디오 진행이었지..) 하는 부분만 자막을 봤다.

사건이 터지고 총을 사고 사람을 죽이고..
이부분을 보면서 Death Sentence, 2007  이 영화와 같은 내용은 아닌가 했다...

한시간쯤 지나고 형사와 인터뷰 하는 부분을 보다가 아무래도 대사도 중요한 것 같아서
다시 자막을 열고 보기 시작.. 
(역시 영화는 자막 없어도 이해는 된다.. ㅋㅋㅋ.. 말은 안들려도..)

처음 생각한 것과는 다르게 영화에 점점 빠져들었다.. 
긴장감.. 긴장감.. 
그리고 훌륭한 연기.. 에리카의 감정이 그대로 녹아 드는 것 같았다. 

결말.. 
예상치 못한 결말이었다... 
경우의 수로는 남겨두고 있었지만 그래도 그렇게 결말이 나리라고는.. 

영화를 다보고 검색했다. 
정말 오랜만에 본 "조지 포스터"이다. 
어쩐지 연기를 정말 잘한다 했다. 
너무 오랜만에 본 조지포스터 영화라 몰랐다..

학교 다닐 때 교수님이 내주신 리포트 중에 법정과 관련된 영화를 보고 판결에 대한 의견을 작성해라고 했을 때
제출 했던 영화가 피고인 이었던 것 같다... 정말 끔찍한 영화였는데..
그리고 무서워서 제대로 보지 못했던 양들의 침묵..

그외는 조지포스터의 영화를 보지 못해서 기억하니 못했나보다..
세월이 지난 지금.. 그때도 연기가 멋졌지만 오늘 본 영화도 마찬가지다..
그녀가 아니면 이 영화를 잘 소화하지 못했을 듯..
매력적인 그녀의 목소리가 아니였다면 성공하지 못했을 영화같다.. 

 

'Enjoy > Movie' 카테고리의 다른 글

Waitress 2007  (0) 2009.01.31
My Blueberry Nights,2007  (0) 2009.01.11
Enchanted, 2007  (0) 2009.01.11