30 July, 2013

Proportional Representation in the hereditary peers section of the House of Lords

The (UK) House of Lords has 15 seats elected by the approximately 800 hereditary peers, with a lifetime appointment.

As elections only happen on a seat by seat basis as they become vacant, for example through death; and never through general elections, many electoral systems cannot apply. The present system used is AV/IRV (single seat STV).

I'm not particularly interested in reform of the way this particular bit of the House of Lords, but I started wondering how one would achieve proportional representation in such a system: where you have seats where candidates are elected for life and do not stand for re-election.

To start with, why do I think there wouldn't be PR in the system described above? Because each seat is elected individually, by the same set of electors, so whichever power bloc was dominant in those electors would win every election. (so very similar to the problem of using First-Past-The-Post in House of Commons elections). Potentially 49% of electors could form a power bloc but end up with no representation. That doesn't seem to happen too much in the lords, though - the by-elections that have taken place seem to return a few different parties, but the turnout is low (50%) and so you only need 150 of the 800 potential votes to get a seat.

Because the seats are elected one at a time, many existing PR systems can't work. But I have been pondering if such systems could be adapted to this lifetime appointment, one seat at a time model.

Some PR systems (STV and Reweighted Range Voting) operate basically as:

  • Everyone starts with a vote worth 1.
  • A round happens, in which a single seat is filled. Any vote which was not used to elect that seat keeps its present value. Any vote which was used to elect that seat is reweighted to a lesser value so that it will have less impact in the next round; and ranking/choice information for that elected candidate is removed from each ballot.
  • Rounds are repeated until there are no free seats.
(Some other systems, such as CPO-STV, are not round-based and so not amenable to this treatment)

My idea for adapting any voting system which has that form into the Lords model is as follows:

  • Everyone starts with a vote worth 1, at the initial election of the first members.
  • In the initial election of first members, one round will happen for each seat (so 15 rounds)
  • Subsequently only one round will happen at one time, as a seat becomes vacant.
  • When a ballot is reduced in strength by a particular amount, because it was used to elect a candidate, then that reduction is recorded against the seat (so in the Lords case, 15 seats x 800 electors = 12000 numbers)
  • When a by-election happens, voters are given the new choice of candidates, but retain their weakened vote strengths from the previous round (previous by-election) except that any vote fractions recorded against the now vacant seat are added onto the vote strength of each voter.
  • This procedure continues forever, one round per vacant seat.

I haven't done any mathematical analysis of this. But it feels like it might give proportionality: two distinct power blocs A and B should end up with seats in proportion to their relative strengths. When an A seat comes up for election, it will release a bunch of votes to the A-bloc voters and they can elect a replacement, if 30 years later they're still in the same bloc.

How would you add this into the present system where the 15 seats are already elected? Give everyone a vote worth 1 and start as if the next by-election is the first. As time passes, more and more seats will be elected with this method until (assuming each lords is mortal) all the seats are elected this way.

It needs to store a lot of information between elections: the product of the number of seats and the number of electors. This is feasible in the above case because only about 12000 numbers need be managed. It does not seem so easy when the electorate is an entire population.

In the lords case, there are almost no new electors: the set of hereditary titles is basically fixed and vote strengths can be attached to those titles rather than to the individual with that title at any one time. In the case of changing membership, new members must be given an initial voting strength. Giving them an initial strength of 1 would mean that new members would be more powerful than existing members in their initial vote. Another approach would be to encumber their votes against the existing seats based on some kind of average so that their vote strength is released over time.

(modified with a few more notes on 2013-07-31) (modified with CPO-STV reference on 2013-08-12)

29 July, 2013

mailinator-like service for QA

We're testing email based registration validation on a project. We started by using mailinator but a few times this has failed apparently because screen-scraping an ever-evolving AJAX UI is not particularly stable.

I decided to hack something up using my trusty old linux toolset.

Make a user account, maildump.

Get sendmail running.

Turn on FEATURE(`virtusertable`) in sendmail.mc

Add @maildump.example.com maildump

Set up an apach2 virtual host to ~maildump/web/






cat > $FN

TARGET=$(cat $FN | formail -z -x "To: " | sed 's/[^0-9a-zA-Z\@\.\-]/X/g' )

chmod a+r $FN

mv $FN /home/maildump/web/$TARGET.html
exit 0

Now I wonder what security holes this has.

03 July, 2013

5 layer NAT

in a hotel I'm staying in, looks like NAT 5 layers deep... (yes they could be just routed with a final single NAT layer...)
 1.                                                      0.0%     6    1.2  15.4   1.1  84.9  34.1
 2.                                                      0.0%     6    2.4  36.4   2.3 206.1  83.1
 3.                                                       0.0%     6    3.8  28.7   2.9 154.5  61.6
 4.                                                    0.0%     6   86.7 107.1  77.9 195.2  43.9
 5.                                                   0.0%     6   28.2  56.0  27.2 141.7  46.8
 6.                                                    16.7%     6   26.6  55.1  26.6 115.7  35.0
 7.                                                   25.0%     5   31.1  33.7  30.9  39.1   4.7