All entries for September 2008

September 26, 2008

Sleeping Patterns and My Sanity

I have recently spent far too much time sleeping. Consequently Vic and I have decided that we will be undertaking a polyphasic sleeping pattern. Starting tomorrow we will be attempting to arise at 6am – exactly at the time the alarm clock rings. This period of preparation will continue until 8th October. Starting the 9th of October we will be undertaking Buckminster-Fuller’s Dymaxion Sleep pattern. Buckminster Fuller tried this for 2 years, and remained sane during the period of time.

The schedule involves taking 30 minutes of sleep every 6 hours – one is consequently able to stay away for 22 hours of the day. This may sound insane – but it is backed up by SCIENCE! Essentially at the beginning one enters a period of sleep deprivation, with the consequence that the Brain forces the body into REM sleep when one immediately starts sleeping. The result is that sleep time for unnecessary activities (stuff not involving the brain) isn’t wasted and one can stay away for much longer.

Consequently if you meet me at any time soon after 9th October, I am likely to be acclimatising and in a state of sleep deprivation (since my brain won’t have shut down non-essential sleeping functions). I may be making less sense than usual.

September 22, 2008

Hello Hilarity

Andrew Neill’s interview of representatives from Compass and Progress on the BBC Daily Politics gets cut off at the point where Andrew Neill asks, “is anyone listening”.

September 14, 2008

Stop getting history wrong!

Earlier in the week I attended a dinner at Warwick Castle. Whilst there we were entertained by people dressed up in historical costume. This is fine, though I felt a certain sense of deja vu . For completeness sake, have a photo:

The only issue with this is that they served potatoes with the meal, which wasn’t imported until Sir Francis Drake brought the potato in from Peru in 1586. It is commonly cited as being Sir Walter Raleigh, but apparently thats incorrect. They also asked people to stop smoking ‘the vile weed tobacco’, which has a similar historical issue. Also many of the songs played on the lute weren’t composed until many years later.

This didn’t spoil my enjoyment of the evening, but one is inclined to question the accuracy of historical material provided by institutions such as castles that are offering entertainment simultaneously.

September 06, 2008

Straw Men burn easily

Tony Morris posted an article to his blog giving an example program. The blog title predicates a comparison between languages on one example. This is sensible if one does it infinitely often, and aggregates the results, unfortunately in order to effectively compare languages one must be fair with the examples from each language. I dislike the style in which the haskell/scala/functionaljava examples were written – trying to be far too clever. Anyone who uses “uncurry (flip (,))” is thinking backwards about a problem: Pun intended!

I asked in the wuglug IRC channel if anyone had any more interesting solutions to the problem. I haven’t seen any other algorithm that isn’t either based on the stack, or repeatedly deleting matching pairs of brackets. Faux came up with:

private static boolean parse(String test)
    int prev;
        prev = test.length();
        test = test.replaceAll("\\(\\)", "").replaceAll("\\[\\]", "");
    } while (test.length() != prev);

    return test.length() == 0;

Its incredibly easy to see intent in this code, and it can be easily generalised according to Mr. Morris’ comparison by abstracting ”\\(\\)” etc. into an array and wrapping a for loop around it:

private static String[] pairs = {"\\(\\)", "\\[\\]"};
private static boolean parse(String test)
    int prev;
        prev = test.length();
        for(String pair:pairs)
            test = test.replaceAll(pair, "");
    } while (test.length() != prev);

    return test.length() == 0;

Lamby provided the awesome regex: /(? (\((?>(?&r))\))|([(?>(?&r))\]))*/ . This is completely unreadable, however, it is very neat, and could be reasonably commented. In my opinion it is no harder to read than Mr. Morris’ Haskell.

As someone who does rather like the Haskell programming language, I felt it would be interesting to come up with an example in that. The stack based algorithm is more efficient being O(n), rather than O(n^2) – so I decided to play around with that. Its very prology, and might be better written in that language.

parse x = stack x []
stack [] [] = True
stack ('(':x) y = stack x ('(':y)
stack ('[':x) y = stack x ('[':y)
stack (')':x) ('(':y) = stack x y 
stack (']':x) ('[':y) = stack x y 
stack _ _ = False

In comparison with the original Haskell example, this imports nothing outside of prelude, is
(in my opinion) easier to understand, is probably faster – since it uses very simple recursion – and is 8 characters shorter. If anyone has a better solution that doesn’t use a parser generator, and preferably makes minimal use of libraries.

September 04, 2008

Apparently Clarke is right about something

Charles Clarke’s prediction of disaster at the next election is based on very firm ground. The latest polls by Populus and Yougov have Labour behind by 16% and 19% respectively. Historical precedent for this kind of margin between the leading two parties is hard to come by. Thatcher’s famed 1983 win was taken by a popular vote margin over Labour of 14.8% and granted her 397 of the possible 633 seats (63%). For reference, New Labour’s 1997 victory had a 12.5% popular vote margin, achieveing 418 of the 639 seats (65%). In order to find an election where the popular vote margin between the two primary parties is over 16% one has to go back to 1931, where Stanley Baldwin’s conservatives took a 24.2% lead over Labour, resulting in 473 of the 556 of parliamentary seats (85%). The background to that election was in fighting within the Labour that resulted in their leader, Ramsey Macdonald being expelled from the party.

Clarke’s suggested solution, changing party leader, might not be a particularly strong idea. None of the viable alternatives (Harmen, Milliband, Straw) are particular popular or well known, though this didn’t seem to hamper Michael Howard in 2005. The public dislike party leadership changes without electoral mandate (still ranks as one of the highest criticisms of Brown) and party infighting. If they were hold a general election immediately after the leadership change, they would also get slammed on the party unity vote, as happened to the Conservatives in 1997. Another important consideration is that while the public dislike Gordon Brown, and would be inclined to protest vote him, they appear to have similar feelings to the whole New Labour Brand.

Finally the question comes up as to what substantive changes would one actually make to Labour? Judging from public statements party members seem to think the problem is primarily presentation – Milliband argues for rallying round, Clarke for replacing Brown etc. This seems to ignore the public who have genuine economic grievances and a strong belief that the country is on the wrong track. Something I’ve definitely noted amongst successful politicians is that you have to genuinely stand either against an idea, or for an idea.

The constant list of policy tweaks that Brown has announced whilst in office don’t say much to the public. Since they seem to be on the same track with the new economic policies being announced at the moment – its hard to see them coming back from this. Frankly Labour leadership could do a lot worse than this simple exercise: in one sentence why would we vote for you over the Conservatives? The answer to this shouldn’t be a rehash of existing policy or ideas, but a simple, bold, new concept.

September 2008

Mo Tu We Th Fr Sa Su
Aug |  Today  | Oct
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30               

Search this blog



Most recent comments

  • Apart from the plea "can I have your old one?" (the yearning never diminishes) I'd like to leave you… by Sue on this entry
  • Unfortunately I still haven't seen a film for which you have to read up on quantum mechanics as I mi… by Sue on this entry
  • I've never been to watch a film before when it's been recommended that you first read up on quantum … by Sue on this entry
  • Well this is very interesting, i really liked reading this blog, this was very informative and very … by Mio Navman Spirit S300 on this entry
  • I thought it was fascinating. Griffin isn't like any other, media–trained, polished politician, and … by Tim on this entry

Blog archive



Not signed in
Sign in

Powered by BlogBuilder