참여하세요참여하세요

리버's 아름다운 소풍

강동구 성내동에 오징어 전문 "오징어 청춘"이란 식당이 개업을 햇다. 오징어회, 오징어물회, 오징어통찜 등 오징어 전문 메뉴만 7가지이고 가격은 모두 만원이다.

사용자 삽입 이미지
 가게는 작지만 내부는 매우 깔끔하다.

사용자 삽입 이미지
가격은 모두 만원이다. 오징어 뿐만 아니라 광어회, 해삼, 멍게 등
다양한 해산물을 맛볼 수 있다.


사용자 삽입 이미지
싱싱한 오징어회


사용자 삽입 이미지
산낙지


사용자 삽입 이미지
서비스로 주는 오징어 튀김


사용자 삽입 이미지
매콤한 오징어 무침


사용자 삽입 이미지
Daum 블로거뉴스
블로거뉴스에서 이 포스트를 추천해주세요.
추천하기
이올린에 북마크하기(0) 이올린에 추천하기(0)
이 글의 관련글
일주일간 인기글
오늘 인기글
올림픽 공원이 지금 철쭉꽃이 한창이다.  시간 나시는 분은 카메라 들고 가보시는 것도 괜찮을 듯.
사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지

사용자 삽입 이미지
Daum 블로거뉴스
블로거뉴스에서 이 포스트를 추천해주세요.
추천하기
이올린에 북마크하기(0) 이올린에 추천하기(0)
이 글의 관련글
일주일간 인기글
오늘 인기글

VBScript는 객체 지향적인 측면에서는 많이 부족한 언어다. 상속이나 다형성을 전혀 제공하고 있지 않아서 클래스를 만드는게 오히려 불현할 때가 더 많은 게 사실이다. 조금이나마 이런 단점을 보안해 줄 수 있는 함수가 하나 있는데 GetRef 이다.

GetRef는 인자로 넘긴 문자열에 해당하는 함수 포인터를 반환하는 기능을 하는 함수이다.  이 함수를 이용하여 VBscript에서 간단하게 이벤트 드리븐(event driven) 프로그래밍하는 좋은 예제가 있어서 소개할려고 한다.

VBScript doesn't have an event implementation so if you fancy having features like attaching handlers which will respond to specific events on your object you can do it simply by using the GetRef function and a bit of "syntactic sugar".

I'm using ASP in these examples cos it's easy.

Example 1 - Simple Events

'Create a handler
Function MyHandler()
   Response.Write "Hello from the handler!"
End Function

'Create an event
Dim OnLoad
Set OnLoad = GetRef("MyHandler")

'Fire the event
OnLoad()

Here we've created a simple event which takes one handler function and fired the event which in turn has called the function we attached.

To turn this in to a more useful event system we can use an array for the OnLoad event variable thus...

'Create some handlers
Function MyHandler1()
   Response.Write "Hello from handler 1!"
End Function

Function MyHandler2()
   Response.Write "Hello from handler 2!"
End Function

'Create an event
Dim OnLoad
OnLoad = Array(GetRef("MyHandler1"), GetRef("MyHandler2"))

'Fire the event
For Each handler In OnLoad
   handler()
Next

Example 2 - Event Arguments

In most event implementations the event handlers take one argument, passed to them by the fired event, which contains things like the type of event and a reference to the object on which it was fired etc.

'Create a handler which takes one argument
Function MyHandler(e)
   Response.Write "Hello from the handler - i was called by " & e
End Function

'Create two events
Dim OnLoad
Set OnLoad = GetRef("MyHandler")

Dim OnUnload
Set OnUnload = GetRef("MyHandler")

'Fire the events
OnLoad("Load")
OnUnload("Unload")

Wrapping it up

We've established we can do all the basics of events, now all we need to do is wrap it up in a few classes to make it usable.

First we need an Event class that we can instantiate for each event we want. This will have to expose an event arguments property and methods for attaching handlers and firing the event. It will also have to keep track internally of the attached handlers. Lets have a go...

Class clsEvent

   'An array to keep track of our handlers
   Private aryHandlers()

   'Our event arguments object to be passed 
   'to the handlers
   Public EventArgs

   Private Sub Class_Initialize()
      ReDim aryHandlers(-1)
      Set EventArgs = New clsEventArgs
   End Sub

   Private Sub Class_Terminate()
      Set EventArgs = Nothing
      Erase aryHandlers
   End Sub

   'Method for adding a handler
   Public Function AddHandler(strFunctionName)
      ReDim Preserve aryHandlers(UBound(aryHandlers) + 1)
      Set aryHandlers(UBound(aryHandlers)) = _
         GetRef(strFunctionName)
   End Function

   'Method for firing the event
   Public Function Fire(strType, objCaller)
      EventArgs.EventType = strType
      Set EventArgs.Caller = objCaller
      For Each f In aryHandlers
         f(EventArgs)
      Next
   End Function

End Class

Next we need an EventArgs class for passing data about the event to the handlers. This just needs three properties; event type, caller and an arguments collection for event type specific things.

Class clsEventArgs

   Public EventType, Caller, Args

   Private Sub Class_Initialize()
      Set Args = CreateObject("Scripting.Dictionary")
   End Sub

   Private Sub Class_Terminate()
      Args.RemoveAll
      Set Args = Nothing
   End Sub

End Class

Next our class that has an event, in this case an OnLoad which fires after the object's Load method is called. We'll also create a few handlers and do a trial run.

Class MyClass

   Public OnLoad

   Private Sub Class_Initialize()
      'Setting up our event
      Set OnLoad = New clsEvent

      'Adding an argument
      OnLoad.EventArgs.Args.Add "arg1", "Hello"
   End Sub

   Public Function Load()
      Response.Write "loading the object here!<br />"
      
      'Firing the event
      OnLoad.Fire "load", Me
   End Function

End Class


'A couple of handling function for the events
Function EventHandler(e)
   Response.Write "<h2>EventHandler</h2>"
   Response.Write "<p>Event """ & e.EventType & """ fired by object
of type " & TypeName(e.Caller) & ".</p>"
End Function

Function EventHandler2(e)
   Response.Write "<h2>EventHandler2</h2>"
   For Each x In e.Args
      Response.Write x & ": " & e.Args(x) & "<br />"
   Next
End Function

'instantiate the object, attach the handlers and call the load
Set myObj = New MyClass
myObj.OnLoad.AddHandler("EventHandler")
myObj.OnLoad.AddHandler("EventHandler2")
myObj.Load()

Event based programming reverses the responsibility for code execution within your program. In conventional procedural programming it would be the responsibility of the myObj class to make sure the two event handlers were fired when it's Load method was called. By using an OnLoad event instead myObj doesn't have to know anything about the environment in which its executing, it just blindly fires the event and any attached handlers will be called. In this way you can add additional functions which run when myObj's Load method is called without modifying MyClass.

In more complex systems being able to add functionality with a minimum of intrusion into other parts of the system is a big bonus and event based programming is an easy way of achieving it.



출처: http://derek-says.blogspot.com/2006/10/simple-event-driven-programming-using.html

이올린에 북마크하기(0) 이올린에 추천하기(0)
이 글의 관련글
일주일간 인기글
오늘 인기글

ASP에 URL을 인코딩하려면 Server 객체의 URLEncode 메쏘드를 사용하면 된다. 그럼 디코딩은 어떻게 하지? ASP환경이 아닌 환경- 예를 들면 도스창에서 VBScript로 스크립트를 짤 때 - 에서는 Server 객체가 제공이 안되는데 이곳에서는 인코딩이나 디코딩을 어떻게 해야 하는가?

여기에 대한 대안으로 사용할 수 있는 함수인 URLEncode, URLDecode를 소개한다.

이올린에 북마크하기(0) 이올린에 추천하기(0)
이 글의 관련글
일주일간 인기글
오늘 인기글
한국정보진흥원(KISA)의 SEED 암호알고리즘을 ASP에서 사용하기 위해서 만든 ECPlaza.Seed 컴포넌트의 소스를 공개합니다. 이 컴포넌트는 ANSI X.923 패딩을 사용했고, BASE64 인코딩 절차를 한번 더 거쳤습니다.

사용법은 간단합니다.

ECPlazaSeed.dll을 다운로드 받은 다음 적당한 폴더에 복사한뒤
regsvr32 ECPlazaSeed.dll

을 하면 컴포넌트 등록이 끝납니다.

등록 확인은 테스트 스크립트를 다운 받아서
cscript test.vbs

를 도스창에서 실행해서 오류가 발생하지 않으면 제대로 둥록이 된 겁니다.


이 컴포넌트는 두가기 메쏘드를 제공합니다.

Encrypt(sPlainText, sKey)
sPlainText 평서문을 sKey를 가지고 SEED 암호화 및 Base64
인코딩한 결과를 반환합니다.









Decrypt(sCipherText, sKey)
sCipherText 암호문을 Base64 디코딩을 하고, SEED 복호화를
거쳐서 원 평서문을 반환합니다.


사용 예제


소스를 컴파일 하기 위해서는 Visual C++ 6가 필요합니다. 전 아직도 이걸 쓴답니다.ㅜ.ㅜ
Visual Stuio .Net에서는 컴파일 해보지 않앗습니다. 아마 컴파일이 안 될것 같습니다.


다운로드:
소스:



DLL :


테스트 스크립트 :




참고:
한국정보진흥원 SEED 알고리즘
SEED 알고리즘 - Java API
Seed알고리즘을 이용한 암호화 복호화 기능 수행하는 DLL 만들기

Daum 블로거뉴스
블로거뉴스에서 이 포스트를 추천해주세요.
추천하기
이올린에 북마크하기(0) 이올린에 추천하기(0)
이 글의 관련글
일주일간 인기글
오늘 인기글
올림픽공원 체조경기장에서 듀란듀란(Duran Duran) 내한 공연이 있었다. 친구가 공연 초대권이 있다고 해서 설레는 마음으로 공연장을 향했다. 19년만에 50대의 나이로 한국을 다시 찾은 이들, 중학교 시절 참으로 좋아 했던 그룹이었는데 세월이 많이 흘렀지만 실제로 공연하는 모습을 볼수 있다니 너무 흥분되었다. 내 방 벽에 이 그룹 사진을 걸어 놨던 오랜 기억도 생각이 나고.
사용자 삽입 이미지

공연을 찾은 관객분들은 연령층이 댜양했는데, 특히 30대 여성분이 많아 보였다. 이 분들은 아마 10대였을 때의 소녀의 마음으로 이 공연장을 찾았을 것 같다.
사용자 삽입 이미지

8시 조금 넘어서 조명이 켜지면서 공연이 시작되었다. 과연 듀란듀란은 얼마나 변한 모습으로 나타날까 궁금했다. 역시 세월은 어쩔 수 없었다. 이제는 나이살이 좀 붙은 사이몬 르봉, 예전에는 정말 미소년 같았지만 지금은 너무 말라보이기만 한 존 테일러. 아직도 이쁘다고 표현을 해야 만 할것 같은 닉 로즈. 그리고 로저 테일러.


The Valley로 시작해서, 80년대 히트했던 Hungry Like the Wolf, The Reflex, A View to a Kill, Girls on Film, Ordinary World, Notorious, Wild Boys 로 공연이 마무리 됐다. 라이브로 들으니깐 사이몬 르봉의 음색이 참 멋있게 들렸다.

관객의 앵콜요청에 태극기를 두르고 나타난 사이몬 르봉. 앵콜곡은 예상한대로 Rio였다. Rio를 끝으로 10시반에 공연은 끝이 났다. 80년대 한창 전성기대의 인기만큼은 아니지만 다양한 연령의 관객분들은 정말 열정적이었고, 중학교때 뮤직비디오로만 볼 수 있었던 이들을 직접 만날 수 있어서 너무 좋았다.


사용자 삽입 이미지사용자 삽입 이미지

사용자 삽입 이미지사용자 삽입 이미지


첫 노래 The Valley

Hungry Like the Wolf

비틀쥬스님이 호주에서 있었던 듀란듀란 공연 동영상을 많이 올려놓으셨네요. 공연을 못보신 분들은 이 동영상을 보시면 좀 그 감흥을 느끼실 수 있지 않을까 합니다.  근데 비틀쥬스님 대단하십니다. 호주까지 가서 공연을 보시다니^^
듀란 듀란 (Duran Duran) in V. Festival
Daum 블로거뉴스
블로거뉴스에서 이 포스트를 추천해주세요.
추천하기
이올린에 북마크하기(0) 이올린에 추천하기(0)
이 글의 관련글
일주일간 인기글
오늘 인기글