Faster DoEvents in Visual Basic

This is an interesting way of speeding up DoEvents, which is useful in a loop. It’s expensive, but necessary in your programme if you want it to respond to user actions. GetInputState() is cheaper, and it’s easy enough to use Windows API calls in Visual Basic code.
If GetInputState <> 0 Then DoEvents

Faster DoEvents in Visual Basic

Finding the offset of a page item

A couple of functions from my friend Jonathan Beckett for finding the x and y offsets of an item on a page. Basically, it works it’s way back up the DOM finding the offset of each parent item. There may be better ways; I haven’t checked that hard.
function get_x(obj){
var xpos = 0;
if (obj.offsetParent){
while (obj.offsetParent){
xpos += obj.offsetLeft;
obj = obj.offsetParent;
}
}
else if (obj.x) xpos += obj.x;
return xpos;
}

function get_y(obj){
var ypos = 0;
if (obj.offsetParent){
while (obj.offsetParent){
ypos += obj.offsetTop;
obj = obj.offsetParent;
}
}
else if (obj.y) ypos += obj.y;
return ypos;
}

Finding the offset of a page item

Stopping Installshield

At work, sometimes I get to see some truly bad bits of design – and my current winner is some awful design from Installshield and their ‘Update Engine’. There is, quite simply, no easy way of turning the damn thing off, disabling it, stopping the service, or uninstalling it. What crap! I did find a solution eventually…

I found the answer here and I’d give Pluck a 10/10 for walking away from an installer program like this. I had installed some software that we were reselling to a customer, to check it worked. Now, I know that the supplier won’t be updating through installshield – it really isn’t that kind of a program. But it still installed this update engine. “Okay”, I thought, “I’ll turn it off”.

So now it’s disabled for all programs, never checks for updates, and it still pops up a window asking to check for updates. F$%king thing! It positively fails Andy’s test for Software – it doesn’t do exactly what it says on the tin.

Anyway, the solution. Run ‘msconfig’ from the ‘start menu > run…’. Find ‘issch’ and uncheck the checkbox next to it. It is still installed, but it doesn’t run, at least.

And I’d recommend to everyone that they use a different installer. I like Innosetup myself, and use it at work. It does what it says on the tin, and is free, although I’d suggest donating.

Stopping Installshield

Thoughts on Coding

When writing web applications, ultimately, you probably want to look at performing load testing. This is most easily done by an application, running a script, and pretending to be a number of users.

Of course, if you’re doing something like, say, creating nodes in some sort of a hierarchy (think messages, or files/folders), then you might need to do some stuff before performing other operations – like see if your node was created, get its ID, that sort of thing.

So here’s my thought – make that easy. Put things like ‘New Node ID = ‘ into HTML comments near the top of the page. That way, it should be possible to find and read them with many of these tools.

At the moment, we’re using OpenSTA, which works. That’s about the best that can be said for it. I like the look of Webload but it’s probably too expensive.

Thoughts on Coding