I'm actually here in the US all the way from Australia with nothing in particular to do until the 7th of July. So if anyone's in the area and wants to meet up to talk about Fnorb, Python, or whatever, that would be cool. I have rental car, so my range is pretty huge.

I managed to find about 7 hours total to work on Fnorb this weekend - which I haven't managed to do in some time now.

I've made a good start on writing proper POA (Portable Object Adapter) tests (and even found a couple of bugs, and sorted out some minor nits that I just wasn't satisfied with), I figure it'll be one more session like that to finish the tests, and (say) two or three more to sort out all the minor issues, and actually put together a new release. Huzzah! (For those that care, this release will have a very bare bones POA implementation, and basic support for value types)

So given the way life intrudes, even optimistically that will probably be late February or early March. Honestly, I don't see how anybody does open-source work in their spare time at any kind of decent pace. Even when I find the time, it takes me forever just to figure out what's going on again!

I said I'd stay away from code today, but I found myself with nothing to do tonight after kicking people out and so started mucking around with the new Python "decorator" syntax. Trouble is, the documentation on this new feature is very terse and there are certainly no examples, and so it took me a little bit of fiddle work and experimenting to figure out exactly how to write my own decorators.

So, as my Xmas present to my/. friends who put up with my occasional rantings here, I will try to present a quick overview of what it's all about plus a couple of examples that I've come up with that I think are pretty interesting and, even better, that no-one else seems to have implemented - namely a "synchronized" and a "private" method decorator, both of which I've wanted Python syntax for since, well, since forever.

Here's the problem: Python has a simple, clean syntax. But often there's a lot of things you want to declare about a method that isn't necessarily functional - its scope (class or instance), its accessibility (private, public, etc) and so on for the superset of all such declarations in your favourite other language.

The solution: The common idiom in Python is to "wrap" your method in *another* method that provides the new additional capability. For example, to declare a method "class scoped", you might say something like:

class Klass:
def method(class):
# Does something
pass

method = classmethod(method)

So, the "classmethod" call creates a new method that wraps the original method and implements whatever is required to make it a class method.

Trouble is, as you may have realized, this isn't even slightly clear to the reader - it's backwards for a start (the fact that it's a class method should be declared up front), and this "wrapping" phase could in fact occur *anywhere* in the class after the initial method declaration, making for incredibly unreadable code. So the answer the Python development people came up with was to preserve the whole idea of flexibly extending methods by wrapping them with other methods - which is very Python-ic and very extensible - but to have a clear and convenient syntax for it. So they decided on the "@" notation, where the code above becomes:

class Klass:
@classmethod
def method(class):
pass

This has exactly the same semantics as the earlier code. Even better, they can be chained:

@some_decorator@other_decoratordef method(self, arg1, arg2):
pass

This is exactly equivalent to:

def method(self, arg1, arg2):
pass

method = some_decorator(other_decorator(method))

So, what's this give you? Out of the box, Python 2.4 comes with two standard decorators, "classmethod" and "staticmethod". Which makes sense as one of the most common questions is "how do I create a static/class method in Python?" C++ and Java coders may not see why there needs to be separate "classmethod" and "staticmethod" decorators, but for the curious it's explained in the library reference.

What did disappoint me a little was the lack of a standard "synchronized" decorator. We've needed this in Python for a while - using the "try/finally" idiom, while okay, was just noisy and verbose and possibly error-prone. So I thought I'd have a go at this one myself as a learning exercise.

First of all, obviously the synchronized decorator is going to need a lock to work with, so any class that uses this decorator will have to derive from a base class that provides the lock. In Python, this isn't so bad as multiple inheritence is actually supported.

So, here's the base class:

class Synchronizable:
def __init__(self):
self.lock = RLock()

This just gives us a lock to work with. Now here's the decorator function itself:

This function has to return a new function that will be called in place of the decorated method. So as you can see we create a new function that simply wraps a call to the *actual* method in an acquire/release pair. Note the use of "try/finally" to guarantee that the lock is released even if the method exits with an exception.

By the way, "increment" is unnecessarily complex because I wanted to force a race condition. It's hardly a rigorous test, more of a demonstration, but without the @synchronized decorator you get problems when more than one thread tries to call "increment" on the same object - which is exactly what you would expect.

I might bug the Python dev team and see if they want to add this - but I can see now why they're holding off. Basically, the problem is this: what if people don't want to use an RLock? It is possible for decorators to be function calls themselves that accept things like arguments with default values, so maybe I'll make it customizable that way first. I'll have to think about it.

The other kind of declaration I've always (kind of) wanted Python to have was "private". In practice, this never comes up. You declare that these methods here are your public interface with a comment, and these over here aren't to be used, and I've never had any problems with people being evil. However, it is one of the first things people want for whatever reason, so after seeing it suggested on usenet when looking for a "@synchronized" implementation, but with no actual implementation yet, I thought I'd try it. Basically, you have to work up through the call stack and see that your caller is another method in the same class, and if it's not, throw an exception. Here's my rough and highly experimental first try:

# Look's like everything's fine, so just call the method
return func(object, *args)

return private_wrapper

Okay it *works*, but obviously we need to throw some specific class instance, not just a string. Also, it would be nice to have a test up front to see if this checking has been switched off - you would want to switch it off transparently in production code.

And now "get_value" can only be called from methods of the "SafeInteger" class - notice I've slightly altered "increment" to call "get_value" to test that. It seems to work okay, and the traceback error message you get when the exception is thrown is actually pretty informative. I guess the next step is to add "protected", which checks that the caller is either the same class or a derived class.

So, I'm going to see what people think, and maybe get these decorators or something like them added for a future Python release. However, I'm probably just going to find it's happening already, and in a much neater way than I've done. I hope, at least, for those of you that do use Python my examples can get you started with writing your own decorators - as I said at the start the documentation on this new feature is incredibly sparse and brief so it took a little mucking about just to get anything working at all. I think there's a lot of potential here for adding all kinds of interesting decorators - tracing, remote accessibility, optional argument type declarations... and those are just the *sane* ones that I can think of!

After a series of increasingly bizarre press releases from this organisation comes this headline: ACS pushes own IT 'licence'

"THE Australian Computer Society (ACS) has called on government to support its bid to become the accreditation agency for the IT profession, making membership mandatory for computer staffers ranging from Microsoft Certified Engineers to high-level project managers."

So, let me get this straight: in order to practice programming, I have to join the ACS despite the fact that they don't know what a kilobyte, a megabyte, or a megabit is? Too bad if I would prefer to join some competing society, right? Or none at all. Why work to stay relevant if you can just force people? I guess a crusty old-boys club will just get to say if I can work, what I should be working on, where I can work, how much I should be paid and for whom. Too bad if we disagree with their insane politics. Or their *continual* kissing up to any large company with a little cash. So much for freedom of association. "Join the local union or get out!" Great news.

The chances that any of the people behind this are listening are zero, but just in case, get this - this is the absolute last straw, I will NEVER JOIN YOU. If you can NOT get me to give you my money of my own free will, then PUT YOUR HOUSE IN ORDER, and GET A CLUE. Do *not* attempt to force me to - that is simply fascism and it is immoral. I don't care what you do, I will move to a free country instead if this should happen, because this one certainly won't be any more.

Rant over.

23/10/2004: I decided to take the swearing and cheap shots out. I wrote the original in extreme anger, and that won't help. Since some people seemed to like the original, I'll email to if you like.

So this idea of doing more formal study has entered into my head for one reason or another.

Could be because of the looming threat of "outsourcing" - although honestly the only time I've noticed its supposed vast negative effect has been here on/., so maybe it's just hype or maybe I'm insulated somehow. Could be because I've always felt that pure programming can't possibly last long as a profession. Actually it never really has existed - outside of academia you're building systems for some actual purpose. It's just that being a domain expert (or even vaguely clueful) was never really taken seriously, you were/are allowed to change at the drop of hat, and I tend to think maybe we should consider this more carefully. That is, pick some field that has an actual use for computing and get into that. There's also the problem that as I get older the body of "stuff I don't know" seems to be getting larger and larger. And as an all-round smart-alec since the first year of school that just bugs the shit out of me. Of course, I'll just have to learn to live with it - our lives are far too finite, sadly, and I'm never going to cover everything:(

Anyway, I pick at various topics that interest me (number theory a bit lately for some convuluted reasons) but without any kind of structure I put a book down, leave it for weeks, read something else, come back, etc. So I think I need the external discipline. I also can't get any pointers when stuck - and after literally weeks of research I discover what some tutor could have told me in 0.5 seconds. Usually I've gone off on a tangent without realizing, and that's a bit frustrating.

So the question becomes - what? My instinct is some really hard-core maths and/or science stuff, because I'm just interested in how things work and that lies at the bottom of it. But from the "protection against outsourcing" point of view that's useless - there's no reason a Malaysian can't do, say, Computational Chemistry or whatever (waves at gnuLNX). But then again, what is "safe"? Are we stuck forever on the treadmill of re-training? Doing this part-time will take at least 6 years, I'd say. I won't be able to do it again in all likelihood. I should choose wisely - but on the other hand there's not really anything that isn't theoretically in danger in time.

So I look at stuff like law, but being the science bigot I don't consider that to be intrinsically "hard" enough. Intellectually, that is. I'm sure there's lots of work involved. But like I said I'm a bigot, so what do I know?:) Like most of my kind, I just dismiss things with "no hard maths" with extreme prejudice. Maybe I should grow out of that? Maybe such things are interesting, somehow, in reality. But that's hardly out-sourcing proof either. Sure, someone has to turn up in court, but I get the impression that represents about 1% of the jobs available to law graduates. The rest are ripe for out-sourcing.

That's far too many times that I've mentioned out-sourcing. Like I said, it's barely impinged on me in real life - however I can't help but feel with this outstandingly paranoid early warning system that is the internet I should at least take it into account.

There's also the various humanities to consider, but although I can obviously see that being a well-known (or even vaguely recognisable in certain circles) journalist or author or historian (*) or whatever is clearly out-sourcing proof, I just can't get past the whole "I want to do something really brain-bendingly hard" thing. I know, as is stated in Pulp Fiction, "That's just pride, fucking with you", but I can't get past it. It's hard-wired I think.

I've looked at bizarre combinations, but it doesn't look like anyone can cater for that.

So that's my plight. What to do, what to do? I have managed to move myself closer to a field I might be able to take a long-term interest in, by changing jobs (out of finance and into defence), so that's a start, definitely, but it's not enough really. I don't want to leave it for another year, that smacks of one of those "something I intend to do but never will" deals - on the other hand the deadline for applying for next year is fast approaching.

(*) Historians are an interesting one. With the popularity of things like "The History Channel", people who know this stuff and can communicate it effectively are suddenly hot property. I saw an article about this on the web recently somewhere, and it turns out that all of a sudden history faculties can't find staff because all the potential employees have been lured away with (for a historian) ludicrous amounts of money. It's a funny old world, I guess.

Driving home tonight, I passed the local "Sizzlers" restaurant franchise which brought to mind a scene of blasphemous horror I had witnessed recently that defied all logic and common sense - and indeed made me question my own sanity and the nature of the world in which we find ourselves. However, even at the risk of being though a madman, I feel the tale should be told to serve as a warning to others.

I was picking up our order of food on Saturday night from the nearby excellent chinese place, when I was faced with the horror and the madness. Before I go any further, some context may be useful. "Sizzlers" in Australia is a restaurant chain in Australia similar in many was to "Dennys" in the US. So it's better than, for example, a truck stop, if you're passing through an unfamiliar town and wish to obtain sustenance of tolerable quality quickly, cheaply, and in a familiar setting. The chain exists in the US, but I never saw a franchise so I've no idea how similar it is to ours. But you get the idea - better than McDonalds, better than Kentucky, but not exactly a big deal. "Mediocrity" is perhaps the word I'm after.

Firstly, I couldn't find anywhere to park close to my intended destination. That's when I knew something odd was going on. But, I don't usually go there on Saturdays, so I shrugged off my forbodings, parked across the road, and proceeded on foot.

It was rounding the corner of the carpark, before I crossed the road, that the unholy sight greeted my eyes. There was a line into the Sizzlers that not only filled all of the queuing space inside the establishment, but spilled out onto the street and down the road at least twenty meters. Can you imagine my horror at seeing this line of dead-eyed zombies, shuffling slowly towards the "all you can eat" salad bar? The bored children whining and moaning? The barely contained frustration of the parents? The glazed stares of the couples who have run out of all possible small talk that can be made while standing for hours out on the road adjacent to a carpark for no good reason?

Why?! Why?! This is the question that burned in my mind. Why not go somewhere else? Somewhere better? Given that it's Sizzlers, that wouldn't be hard. I considered questioning one of the legion of the damned, but I was afraid that I too might fall under the same accursed influence that had drawn, and held, those wretches to that blasted spot.

It shames me to admit it, but I averted my eyes, steeled my will, and walked around the lost souls. Obtaining our order from the nearly empty Chinese restaurant (which, did I mention, is excellent?) I made the trek back to my vehicle, casting only one glance back at the unfortunates - who seemed to be as one gazing at me, and through me, at the same time. I could see what was left of their minds grappling with the concept that I had somehow obtained far better quality food - almost instantly - than the poor fare for which they were condemned to spend a relative eternity standing on the hard bitumen, exposed to the elements. But they could not act, nor really comprehend what was happening to them, such is the hopeless state of the damned in hell.

Perhaps I should have risked everything, and attempted to save at least some of them. Cured them of the blindness that had somehow afflicted their vision - that there was only one place in the world they could go, and that even if that place had a line that would make a Soviet waiting for his monthly roll of toilet paper give up in disgust then there was nothing for it but to wait for as long as it took. Curse the demonic and blasphemous influence that brings men and women to such an end!

But I made no attempt at rescue. I had not the courage for such a thing, lest I also be damned along with them. I returned to my home, and my food that would normally have been a highlight of my culinary week tasted like ashes in my mouth. My friends did not believe my tale of horror, thinking it to be surely a fancy brought on by an over active imagination and the tricks of the light that can occur on a starry night. Even as I recount the tale now, I find it hard to believe myself. There simply is no rational reason for such a thing - I can only conclude that the workings of beings incomprehensible in form and ancient before the continents began their separation are working their dark designs on the innocent, drawing them into their lair after their baleful influence has torn any trace of free-will from the minds of their victims.

I write this now, even though it may seem like the nonsensical ravings of the mad, so that you may think twice before considering going to cheap family restaurants. Once you take that first step to degredation, it will only be a matter of time before you too are standing literally on the road waiting to get in - to the Sizzlers of Madness.

So I resolved early this year to actually get myself an upgrade in the vehicular department - then I promptly decided I was going to change jobs and so decided to put it off until that was done.

Well, now that the "change jobs" phase of my so-called master plan is over, I can work on the "get car" bit.

So, Saturday afternoon after doing minimal research I grabbed a couple of mates and headed towards an area packed with car-dealerships (Newstead, for the curious locals). Something I quickly discovered - having some obnoxious friends around is an excellent way to do this. Picture it - a group of guys standing around a car, asking impertinent questions and making blunt observations while the unfortunate sales guy tries to a) talk sensibly to many people at once, and 2) figure out who has the actual money.

It shouldn't be hard to figure out - I was the only one not saying anything (as I know next to nothing about such matters) and looking generally bemused.

Now, just in case one of my American friends decides to make a recommendation - remember that cars in the US are incredibly cheap compared to here in Australia. And it's not just the exchange rate - the government just cranks up the price arbitrarily to "protect" incompetent and lazy car manufacturers here. Or something like that, anyway. And the more expensive the car, the worse it gets. All this means, of course, is that all "local" vehicles are overpriced and utter crap, and I wouldn't buy one on principle anyway even if they weren't. Of course, if you can figure a neat way to smuggle a car over here, then I'm all ears - just remember it's a 14,000K drive and there's a bit of water to get through on the way.

So, the requirements. I'm also pretty much settled on a new car - I've been through the used car dance for too long now. I figure I'll use up the warranty, then just get another one. I'm sick of dealing with what the last guy did to it, basically. Other than that, something relatively "sporty" - at my age I may not get another chance (without it looking like a mid-life crisis sort of deal). I also want to get a house *next* year, so it has to be cool without being extravagant (sadly).

So, we've covered Mazda, and some Honda thus far. Toyota, more Honda, and anything else I think of next weekend. I've got to say, it's a lot of fun doing this, and I think I'm going to drag it out for as long as I possibly can...

When last we left our hero, he had refused to submit to the "all your base are belong to us" IP agreement, and had parried with some proposed changes of his own. And now, back to the action...

So, I'd sent off the proposed wording to my new manager, and from there it had gone to the local legal people, and from there to the external legal people the company keeps around to consult on such things.

The good news is that it was a complete victory for me. When the project manager read out the reply from the legal experts, I just couldn't believe what I was hearing. I had to get a copy for myself, it was so astounding.

I can't reproduce any of it here I don't think, but basically it said (loosely translated from legalese): "This is a problem. He's right, these claims over all IP produced are not legitimate. We need to not only fix this for him, but for all new employees from this point on, for all time. Did anyone with half a clue even look at this?"

So, it's a total victory. They incorporated what I wanted using, I admit, much better wording than mine and I am satisfied. Doesn't happen often. Not only that, but everyone joining from now on will get the benefit of my sticking my neck out. So remember to thank me if it ever ends up being you!

I'm also extremely pleased to have fixed a stupid and broken thing in the company before I even started. Or at least to have been the catalyst for it. It's amazing to think that no-one could have questioned this before, and that as far as I can tell it wasn't really looked at very closely by legal people at all. I'd always assumed, when reading these things, that at least it was written by competent and qualified people - but now all bets are off. From this point on I'm going to assume all employment agreements were just thrown together by howler monkeys based on fragments from random sources, and given an overlay of even more evil just for fun - and that therefore all of it is highly questionable and won't stand up to even the slightest scrutiny.

So, I've been trying to complete the POA stuff in the Fnorb documentation this afternoon - it's really slow going when you haven't touched it for months. I can't remember what half these POA policy values are for, let alone what they mean or how much of it I actually implemented. So I've got a window with the POA spec in it, a window with the documentation I'm editing open, and about 20 other windows viewing different parts of my POA code as I try to put it all together in my head again.

But I've completed the policies and configuration bit and now I'm moving on to the "using the POA" part which will hopefully be less tedious. This is why OSS stuff sometimes has less than complete documentation - it's just no fun at all if you don't do it right away, and on a part-time project that's not always feasible.

Update 9:17pm: POA section finished. It probably needs revising and rearranging a little, and certainly the references aren't right, but the basic content is done.

Crawled out of bed late this morning after a night spent drinking with friends from current and previous employers... while I'm not in complete agony or anything (I never get headaches so that particular symptom is out of the question) I'm definitely feeling the effects, light-headedness and a definite inability to face solid food - this never *used* to happen:(

*And* I wanted to make some progress on that pile of books I'm each x% into... not today by the looks of it! I've rented out the 3rd series of the Sopranos on DVD, so it'll be a quiet afternoon recovering while watching those I think.

I *must* be recovered tomorrow - I promised myself I'd finish the last bit of documentation for Fnorb that needs to be done for the next release. I've been putting it off for a month under the umbrella of the "I'm too busy because I just changed jobs" excuse. That and look at this intriguing bug report someone submitted. It's looking horrifyingly like they might be right and there's a problem! (but it is a good thing that it was found - I can't possible test interoperability with all other ORBs, especially not the commercial ones).

I have been allocated 5 moderation points once more. It's been a long, long time since I was given any.

I had basically given up meta-moderating for months now - what's the point if you're *never* going to get mod points, again? And, since I've been very busy with my new job I have, for the past two and half weeks, looked at/. maybe once every two days and made only a couple of posts in that time.

The message is clear - only lurkers and people who access and post anonymously get mod points. What kind of a system is that? I just don't get it - isn't that exactly what you *don't* want? No wonder confident sounding ignorance that has been seen and refuted countless times before is *constantly* being modded to high heaven.

So, once again, same rules as before - if you see (or make a post) you want moderated just tell me. I don't have time to scour the comments at level 0 for worthwhile posts anyway!

Today, my new employer subjected all staff to 3 hours (mercifully cut from 4) of "ethics training" today. I certainly didn't pick my starting date very well. Anyway, this quote came to mind in the midst of it all.

Which leads to the obvious question - how much ethics training would Sutekh the Destroyer, Unicron the Chaos-bringer, Cthulu or any other all-powerful personification of pure evil require exactly? And considering that "all life is my enemy" and all that, aren't they already perfectly ethical within their own frame of reference? Being, you know, all powerful personifications of pure evil.

These are the kinds of important questions you ponder during a mind-numbing video-lecture with the only actual content being "do the right thing". In order, as Douglas Adams might put it, to avoid gnawing off your own right arm to relieve the boredom.

Anyway, full report on the new job and the outcome of the IP agreement negotiations later - it turns out apart from the above incident I'm quite happy so far.

I've gone through the long and draining process of searching for and finding a new job, so that I can leave my current employer for a whole bunch of reasons, most of which come down to "I'm bored". I'll go into detail in a later entry, maybe.

The only hurdle remaining is the intellectual property "agreement" I've been asked to sign. I put the word "agreement" in quotes as the process is absolutely nothing like two parties reaching an agreement. The process usually goes something like this - you are given the "agreement", you ask for changes to the more onerous clauses, and you are then told that it's never changed for individual employees and is a "standard contract" (an oxymoron if ever there was one). Then I basically have to threaten to not sign on for the job, then the legal department (or whoever is stonewalling) finally allows at least *some* change in, and we compromise.

It is an incredible pain in the neck. The problem with this one is that is basically says "all your IP base are belong to us". Anything I create, or even *think* of without doing anything about, becomes the "property" of the new employer. And not just code, but all kinds of documents and even *music* as well. And all regardless of whether it has anything to do with the new employer's actual business or not. If it is successful, they can just take it, as it stands. I can understand them not wanting me to compete with them - but this is just *ridiculously* broad. I can't understand the motivation for wording it like this, apart from the obvious evil ones. I just hope it's unintentional.

This is a real problem for me right now as I have one or two open source projects I work on, and I would like to *continue* working on them! That's what gives me the motivation to ask for the changes. I can certainly see why most people don't seem to be bothered standing up for themselves over this - it's not an easy thing to do, and you have to be careful not to be seen as a troublemaker before you even start. Fortunately, this time around, it seems like everyone I've spoken to about it seems to be on my side - it's like they just didn't realize how the wording hurts open source development, and are willing to make the small changes I need. So that's good.

I've sent off my proposed changes, based loosely on wording provided by SAGE-AU. If anyone else needs examples of OSS-friendly wording, this is a great place to start. The discussion with the legal people on their side is underway, so I should hear back tomorrow.

Right now I really wish I had a regular lawyer type person I could use to help me with these issues quickly. I'm having to do things like propose the wording for the changes, and I'm just not comfortable doing that. Since I've never had any legal problems, I just don't have anyone to see. Maybe I should break some laws or something, then I'll have an excellent working relationship with a wide variety of legal professionals. Or maybe I should find out if it's possible to find a good lawyer, and give them a brief overview of my situation so that when something like this does come up I'll be ready. It seems dangerous to sort of wait for something to happen, then you have to find a lawyer who understands the issues *and* have them understand your point of view and situation immediately.

I haven't done that since about 1998:) So, yes I'm posting on/. from work and I'm proud of it!

I remarked to some team-mates the other day that we know Java has finally come of age and is ready for large scale serious computing etc... because the build times are getting up there with what C++ build times used to be.

It's an exaggeration, of course. It's only half an hour to build our entire code base, and the C++ code base I'm thinking of took 3-4 hours back in 1996. Still, this whole "waiting for a build" thing is bringing those memories flooding back...

All we need to make Java build times "enterprise level" (ie. totally unbearable) would be templates (those could take hours to build, I would watch them slowly being compiled individually), and they are coming in Java 1.5. Hooray!