JavaScript onload

Here's a way to use window.onload that won't break other scripts that also need to use it: Store the current value of window.onload before you set the new value, then call it as part of your own initialization.

I've written this short helper function to do the job …

View comments more ...

EventCalendar 3.0 Beta

The release candidate of EventCalendar 3.0 is now available. The main new feature is a piece of JavaScript (AJAX) wizardry that allows you to flip backwards and forwards through the calendar without refreshing the entire page. The 'Forthcoming Events' list is also far more flexible. Many many other requested …

View comments more ...

Ambiguous String_var operator

GCC is quite pedantic, so code like this can cause problems:

CORBA::String_var s = ...
s[0] += 1;

GCC 3.3 gives the following error (twice!):

file.cc:10: error: ISO C++ says that
  `char& _CORBA_String_var::operator[](long unsigned int)'
  and `operator[]' are ambiguous even though the worst
  conversion for the …
View comments more ...

JavaScript Find Position

I've been trying to use the findPosX() & findPosY() functions from Peter-Paul Koch's excellent 'quirksmode' site. The purpose of these functions is to find the absolute X and Y co-ordinates of an HTML element. They work well in both Internet Explorer and Firefox, but the results can be pretty rubbish on …

View comments more ...

Thread yield after mutex unlock?

Is is sensible to unlock a mutex and immediately re-lock it? Consider this example:

pthread_mutex_lock(mutex);
while(1) {
    /* Do work. */
    pthread_mutex_unlock(mutex);
    pthread_mutex_lock(mutex);
}

The intention here is to make other threads wait until we've finished doing work. Then we give them a chance to get in before we go …

View comments more ...

dig: segmentation fault on UML

The 'Native Posix Thread Library' (NPTL) is not supported by User Mode Linux (UML). NPTL is the much-vaunted 'new' threading implementation in the Linux 2.6.x kernels. There can be many symptoms of this problem, but the one I seem to always get is a crash whenever a program …

View comments more ...

Object-Orientated JavaScript

Object-oriented JavaScript for the C++ programmer.

This article presents a bestiary of JavaScript constructs, set against their equivalent in C++. Most of the basic class and object tools are available in JavaScript, and the syntax is often recognisably similar.

C++ is listed first in maroon followed by the corresponding JavaScript …

View comments more ...

Xerces: Attribute already used

Today the Xerces XML parser gave me this bogus fatal error:

The attribute 'aMixedCaseAttr' is already used in element 'anElement'

I was sure I'd seen it before, and sure enough it's bugzilla bug #26627. Turns out it's a bug in Xerces v2.4, It sometimes gives this error when the …

View comments more ...

The 'Single Thread Model' is useless.

Normally a CORBA application processes each request in its own thread. So the author of a CORBA servant must always be aware that their methods may be running concurrently in multiple threads. Critical sections must be identified and locked accordingly.

Multi-threaded programming can be quite a pain, and all that …

View comments more ...

Wake up America!

Anne Applebaum argues that Amnesty International is biased when they accuse the US government of human rights abuses. The truth is that Amnesty are neutral observers who tell it how they see it. It really worries me that Americans can blame the messenger but ignore the message.

Perhaps the USA's …

View comments more ...