Phillip Pearson - Second p0st

tech notes and web hackery from the guy that brought you bzero, python community server, the blogging ecosystem, the new zealand coffee review and the internet topic exchange

2003-3-20

Does Mozilla's HTML editor control work now?

I totally missed this; here's a page about Mozilla's version of the Microsoft DHTML control on mozilla.org. I wonder if it works, or if that's a preliminary spec. More on embedding.

Have any Mac Radio (or PyDS) users looked into getting this going there?

Goto statement considered useful

Try breaking out of nested while loops without it.

In Python, we use exceptions:

class Done:
    pass

try:
    while foo:
        while bar:
            baz()
            if time_to_exit:
                raise Done
except Done:
    pass


But in C, or C++ if we're using an old compiler (or targetting a platform that doesn't have good C++ support):

while (foo)
{
    while (bar)
    {
        baz();
        if (time_to_exit)
            goto Done;
    }
}
Done:


The goto here has saved us a comparison, and actually makes the C code shorter than the Python code.
... more like this: [, ]

Eve of the war

No-one would have believed, in the last years of the nineteenth century,
    that human affairs were being watched from the timeless worlds of space.
No-one could have dreamed that we were being scrutinised,
    as someone with a microscope studies creatures that swarm
        and multiply in a drop of water.
Few men even considered the possibility of life on other planets.
And yet, across the gulf of space, minds immeasurably superior to ours
        regarded this earth with envious eyes
    and slowly, but surely, they drew their plans against us.


        (H. G. Wells, War of the Worlds)