Freesteel Blog » 2008 » May

Wednesday, May 7th, 2008 at 12:03 pm - - Whipping

I know, why not catch the train down to Crewe where there is a by-election and deliver this leaflet to 5,000 doors.

Tuesday, May 6th, 2008 at 10:08 am - - UN, Whipping

More time wikipedia-ing UN information. I dipped into a recent Security Council transcripts where there is a satisfying whinge from the ambassador of Costa Rica about just what a stitch-up these resolutions are among the “Group of Friends” (their code name for the Permanent Five):

It is especially difficult for Costa Rica to understand the opposition to including a reference to the human rights component in the text of the draft resolution. During the negotiation process, we proposed two options for incorporating such a reference. Today, to our surprise, the representative of the Russian Federation threatened to exercise a technical veto of any reference to human rights, despite the fact that the issue of human rights is the object of mutual accusations made by both parties, that it has been raised in consultations by various delegations, and that several references are made to it in the reports of the Secretary-General. In his most recent report, Secretary-General Ban Ki-moon himself refers to the United Nations duty to uphold human rights standards in all its operations, including in Western Sahara, and to the need to coordinate action in that sphere.

Costa Rica cannot understand the reasons that have been put forward for rejecting a specific reference to the framework of international law when we are calling on the parties to assume a realistic position in the negotiations, nor do we understand the fact that the Group of Friends should sideline the members of the Security Council in the preparation of the texts of draft resolutions and in the building of consensus. In this case, just a week ago the Group of Friends provided us with the text on which we are about to vote and in which my delegation continued to insist that some of its amendments be included.

I did far too much digging back and this incident boiled down to one line in the Wikipedia MINURSO page. The problem is that all the resolutions relating to the UN intervention in Western Sahara appear to tilt towards the Moroccan government, and are cleansed of all references to human rights, which means that the UN is blocked from doing anything about it. So to the outside world they look incompetant, when they are merely working in a framework set out by the major five nuclear armed states (the Permanent Five). I’d like the citizens of those countries to know that.

Also, all the code has been moved to be under the GNU Affero General Public License, due to the recognition that the General Public License is practically obsolete in relation to server side software which you can interact with on someone else’s computer through the all-pervasive internet, yet not have any access to the source code of because you never touch the compiled code.

Also, the General Assembly is finally publishing some post-December transcripts. I hadn’t noticed because the parser ran cleanly without an error.

Saturday, May 3rd, 2008 at 2:04 am - - Whipping 1 Comment »

There’s an astonishing number of Liverpool local elections wikipedia pages set up by administrators, which need investigating.

Yesterday we got up at 4:45am, and Becka pulled me out of the house at 4:52am having had no morning tea and forgetting to put a banana into my pocket for breakfast. Things were already busy over at John Coyne’s house in St Michael’s Ward where everyone had converged to do the early morning mail drop. Coyne had printed out a handful of personalized letters to certain addresses urging residents to vote Green, and we also had these very dull little post-cards to post through the doors of all the others.

I bagsied Floral Wood and surrounds because I’d found its spread-out American-style pavement-free suburban mock-tudor architecture stunning when I leafletted the area earlier in the week. These houses had enough room to park all their cars at once, which is important because the only way to the doors without stepping on the grass was up the driveway. I couldn’t understand why they don’t have swimming pools out the back as well.

In the other streets, such as Westward View or Thistledown Close, people don’t have space to fit their regulation three cars and no bike, so you’re constantly having to walk round the sparkly BMW on the pavement. I hope to live long enough to see the automobile age end and these proud beasts go to the crusher. In the long run, all of the Green policies will be adopted by society, in the same sense that whale hunting has ended. The only question that matters is whether it stops before or after the whales (or we) become extinct.

The sun gradually rose. The milkman came and went. I saw the LibDem guy doing his morning leaflet drop — it was a big yellow A4 piece of paper shouting: “Good morning!” on every doormat beneath the letterboxes in the porches. I taunted him with the stiffness of my Green Party postcards that were strong and durable enough to push through the bristles behind the letter flaps if you applied just the right amount of longitudinal curl when you did so.

Letterslots! Now that’s a major case of User Interface design satisfying the common criteria of an obvious problem which could be solved if only the person who had the power to do something about would ever happen to notice. You can own a house for 20 years and never once in all that time experience what it is like to push a thin envelope through your own letter-slot! I can push the over-sprung flap inwards with my left hand, but, unless I aimed exactly right for the gap between the thick black brushes, it crumpled. Some places have an extra inner flap on the other side — with an inward hooked lip!. What kind of &*@%#~?!!! You have to insert your entire left hand in to get it through. Luckily there was no dog on the other side. The other mind-bogglingly stupid type of letter slot is the kind that’s vertical and hinges upwards instead of sideways. And, while we’re at it, why is it legal to sell front doors where the slot is 5cm above ground level?

We got home, did our other stuff, then got our tickets to go to the count because Becka was a candidate and I was an invitee.

It was a fantastic experience!

I had expected to be sitting in a waiting room while the technical counting staff did their work a safe distance away, until the boring announcements made by a boring person at 3am in the morning told us of our fate.

But it was nothing like that. Instead we had free reign to mill around a huge sports hall where the tables were laid out in areas according to the wards of the city. The ballots were counted right there in front of you in the open. You could lean over and point to them.

There was a huge crowd of Greens over at the St Michael’s Ward desk (all the Green candidates who’s names were put up in the other wards were there), some with clipboards making their own tally as each ballot sheet was unfolded and flattened out into a stack. This was the first stage in the counting process.

Becka and I drifted off so as not to put too much pressure on the counting people. At the other side of the hall we found the BNP dudes hovering over the desk for Belle Vale looking like typecast characters selected for a play. Two of them were even wearing blazers, one with war medals — and he was probably less than 30. I felt intimidated until I saw the Labour Party leader, Joe Anderson, nearby. He out-thugs anyone by appearance. The last time we crossed paths was when Condoleeza Rice visited Liverpool and I was part of the crowd shouting at him not to go in to watch the show put on in her bloodthirsty honour.

Without doubt, the desk I felt most sorry for was for Allerton & Hunts Cross where Flo Clucas presided like a stern pensioner watching her pound notes being counted out at the Post Office.

Kirkdale had this complicated double-length ballot sheet because there were two seats and you could put a cross in two places. What they did to count this is too complicated to explain.

Back at Princes Park where Becka was a candidate, the sharply dressed Labour candidate Timothy Moore (seems to be no picture available on the web) was having kittens. The local MP Louise Ellman was at his side. Later in the evening when his seat was secure, they got a bit chattier. Of course she recognizes me. And of course local MPs always show up for these counts — they depend on these party activists when it’s their turn to be elected.

After unfolding and flattening all the ballot papers, they’re sorted into piles. This stage is done across the desk so the piles are on our nearside (their farside) and we can see that they are being put into the correct places. There’s a tray for spoilt ballots (eg “no – faith – in – any – of – you” written down the column).

After this, the piles are bundled up into batches of fifty and given a colour coded piece of paper according to the candidate. Now the amounts are easy to see, like bricks of hundred dollar bills in a businessman’s suitcase.

Our Green candidate, Sarah Jennings, won her seat. She’d been canvassing solidly since January and has attended every Liverpool City Council meeting in the public gallery for a year, so the system works to some extent. Though I do have a lot of unanswered questions about voting behavoir and what really drives it on.

As the most interesting individual result, Sarah was interviewed several times by earnest young reporters who took notes in shorthand. One of the main Green Party organizers, Peter Cranie, was always at her side to help with the questions. We clustered in a group to cheer for the cameras when the result was officially read out. Someone gave her forms to fill in relating to the acceptance of the position of city councillor.

Becka and I sloped off at 1:30am on our bikes, the only ones in the whole of the carpark. It’s was an experience of hope and joy. An antidote, and proof positive that it’s possible, and totally desirable, for elections to be counted with complete fairness and transparency — unlike the misery they experience across the pond in the greatest democracy in the world.

It also explains why the idea of electronic voting has never been an issue in the United Kingdom — in spite of the fact that the UK political class are demonstrably more ignorant than anyone else about what can and cannot be effectively computerized; while several other European countries with better informed elites have completely fallen for it.

Electronic voting is off the table in this country, not because it is hugely expensive, woefully unreliable, and vulnerable to fraud in an unbelievable number of ways — all points in its favour for the people in charge, since it’s not their money or votes that get ripped off!

No, electronic voting is off the table because it would take away the thrill provided by this absolutely perfected proper paper count process.

At present, no one is sure how the balance of power has shifted. And I don’t really care.

The Audit Commission report from February 2008 says that Liverpool is the worst financially managed council in the country and that (p8):

Member behaviour at times is poor and affecting capacity. There has been inappropriate behaviour dealing with some officer issues. Information is sometimes ‘leaked’ to the press and other sources for short-term political advantage. Behaviour of some members at Council meetings is poor with personally abusive language used and aggressive behaviour regularly demonstrated. As a result, some members said that they would not speak at a Council meeting for fear of being shouted at or ridiculed. Trust between officers and members is not effective. Members recognise that the culture of the organisation is not appropriate and stated that the culture needed to change. Behaviour of some members is damaging the reputation of the Council which is recognised by all members.

Shame they don’t stick it on television, like they do Parliament. Couldn’t be any worse.

I was reminded that the late Frank Zappa was right when he told kids:

“… and I’ve been telling kids for quite some time, is first register to vote, and second, as soon as you’re old enough, run for something.”

With this glow of positiveness, the question now more than ever is how does it get so bad from here? Where exactly does it go wrong?

Saturday, May 3rd, 2008 at 1:12 am - - Machining

It’s critical to be able to calculate the orientation of a triangle correctly, particularly if it’s the long thin kind where the endpoints differ by 1e-15 in the y direction. The orientation is either clockwise or anticlockwise, and it should be the same no matter which of the three vertices you start with.

For a triangle with points a, b and c, we consider the vectors u = b - a and v = c - a. If

CPerp(u) . v

is positive, then the triangle is oriented clockwise, where CPerp((x,y)) = (y, -x) is the function that turns a 2-dimensional vector 90 degrees clockwise.

Writing this in individual coordinates gives:

CPerp(b - a) . (c - a)
    = (by - ay, ax - bx) . (cx - ax, cy - ay)
    = (by - ay) (cx - ax) + (ax - bx) (cy - ay)

which you can either expand out into 8 terms (two of which are ±ayax which cancel immediately) and add them up, or you can evaluate them as they stand. You can get different answers; sometimes one is zero and the other is non-zero, and since the sign of the result determins the orientation of the triangle, we pick the non-zero answer.

To reduce loss of precision, sumations are done from large to small; after putting the six terms into the array double s[6];I write:

sort(s, s + 6, FabsOrder());
double sum = (((((s[5] + s[4]) + s[3]) + s[2]) + s[1]) + s[0]);


struct FabsOrder {
bool operator()(double a, double b)
{ return fabs(a) < fabs(b); } };

That’s the C++ done with. Now the problem. There was a conflict in the sign between one value and the other which was highlighted by the debug code, but, because it seemed infinitesimally small and we’d forgotten the significance, we commented it out and encountered a situation much later in the algorithm where there was a gouge that took a while to isolate.

The calculation problem.

In the above equation, if by = cy, then the the alternative ways to calculate the result are given by the two sides of the equation:

p (r - s) - q (r - s) = p r - p s - q r + q s

And if r - s is positive, then the result should be positive whenever p > q

But here’s a table of calculations that happens.

s 13.014700000000001 * t – 13.014699999999999 * t
20.0 5.6843418860808015e-14
20.677 0.0
21.0 5.6843418860808015e-14
1e15 2.0

Now I had been counting on the right hand column to be increasing, because 13.014700000000001 - 13.014699999999999 > 0, but unfortunately it does not. This explains how I can get the wrong sign in the answer, rather than 0.0 when the precision falls off the end, because I am taking the difference of two values where s is increasing in the expectation that the difference of the products will increase too.

This has been a day’s work. I’ve marked this down as yet another of many things to watch out for with floating point arithmetic.

Meanwhile, after scratching my head all day over this problem, the BBC reported that some computer keyboards are dirtier than a toilet seat. If I saw a toilet seat as grubby as this keyboard is now, I wouldn’t sit on it.