Archive for November, 2007


Stress-o-Matic

Jim Roberson recently published a scaling test of Seaside on VW7.6
Now I wanted to show, that you can write a stress tester on your own in ObjectStudio.
For this, you don’t even need ObjectStudio8. We make use if an OLE objectcomponent ‘MSXML2.XMLHTTP’

Let’s assume we have a controller with 3 entry fields.

  • one for the URL
  • one for the number of iterations
  • one for the delay between the calls

During the openInitialization we instantiate the OLE object and get the dispatcher

http := (OLEObject newLongTypeName: 'MSXML2.XMLHTTP') dispatcher.

The interesting part is, how to call the methods. Well, ‘interesting’ is not the right word, since ObjectStudio does all the right things for you.

Here is the code:

sendHTTPRequest
 | resp url |
 url := efURL getValue.
 url isNilOrEmpty ifTrue: [ ^self ].
 http call: 'open' params: (Array with: 'GET' with: url with: false).
 http call: 'setRequestHeader' params: (Array with: 'If-None-Match' with: 'qwerty').
 http
 call: 'setRequestHeader'
 params: (Array with: 'Cache-Control' with: 'no-cache,max-age=0').
 http call: 'setRequestHeader' params: (Array with: 'Pragma' with: 'no-cache').
 http call: 'send'.
 resp := http call: 'responseText'.

You can put all sorts of tests in there, measure the time, etc.
It just shows again, that you should know your platform and what’s available.
Sometimes it saves you a great deal of time and effort.

Andreas
———————————————
Quis Custodiet Ipsos Custodes?

OutputDebugString

Most Windows programmer already know about the API OutputDebugString.
But with Cincom Smalltalk you can combine the power of OutputDebugString with the power of MethodWrappers.

What are MethodWrappers?

MethodWrapper is a class, which wraps compiled methods in other classes.
Each subclass of MethodWrapper does something specific and my subclass calls OutputDebugString with the receiver, the selector and the arguments. These calls can be made visible by a tool like DebugView, which can be downloaded for free.

But what’s the advantage to just writing a log file?
Well, first of all, you can follow the output live, while testing your system.
Second, you could enable (install) those wrappers at your deployed image, use DebugView to connect to the computer and diagnose the system at runtime.

Sometimes that saves you hours of going back and forth with the end-user.

You can find the parcel in the public Store repository, called “OutputDebugPackage”.

Andreas
———————————————
Quis Custodiet Ipsos Custodes?