Freesteel Blog » 2010 » January

Saturday, January 30th, 2010 at 11:09 pm - - Machining, Vero, Whipping 2 Comments »

The week began with a few days getting ScraperWiki more into shape, and then I had to go to Cheltenham on Wednesday morning (following a business breakfast) to help my old programming pals in Vero with their desperate constant scallop stepover bug that had been in the code since I left them with it in NC Graphics back in 2002 (eight years ago) in a set of undocumented functions nobody understood, that just worked — except when it didn’t.

It really did take two days of the three of us (me and the two fellows in Vero) of hard going at it to finally identify the problem, helped by various recollections of the way the algorithm worked that came to my mind during the hours of grind. The code was nowhere near as rough as I thought I’d left it, which was interesting. It was very educational because we chased the bug back through almost every stage of the algorithm from the point of the crash to the source where it joined a six-way cell in an invalid manner that was almost impossible to notice due the encoding of vertical segments using duplicate coordinates. Now they know everything about the algorithm they can extend it properly to various N-way cells to get rid of many of the remaining glitches caused by a design that originally intended only to handle 4-way cells because I mistakenly guessed that every case could be simplified by subdividing it tighter.

Now, according to the rules of corporate capitalism, I should never have been there in the first place, because it is in my interests for a competitor’s software to be unnecessarily buggy, with their programmers frustrated and unproductive, in order that their customers suffer enough costly consequences to consider switching to a rival system like the one I now work on. But this is just another of those specific bitter consequences ingrained into the system of institutionalized selfishness that seems to go unrecognized by our ideologically bent scholars. In actual fact I wasn’t losing anything because, (a) I know that CADCAM systems don’t actually compete on toolpath quality and innovation (because if they did I’d now be rich and in demand), and (b) I am trying to set an example that programmers should be on good terms with programmers in competitive companies because that’s where the jobs are.

Anyways, on Thursday night I caught the train back to Birmingham — using part of my Liverpool to Cheltenham return ticket — and bought another return ticket from Birmingham to London for the Hacks & Hackers Hack Day (sponsored by ScraperWiki). Francis joined me on Friday, and we spent the night with Earl, another friend in London, getting back to Euston station at around 13:30 on Saturday. Francis required a dosa, and I humoured him with a curry buffet, and we got back at 14:15 whereupon he bought a train ticket to Liverpool because he had no return ticket.

Francis’s ticket from London to Liverpool cost £65 if it was a single, and £66 if it was a return. So he bought the return and will once again wind up out-of-phase back in London without a ticket to Liverpool sometime in the next month.

This pricing has always pissed me off. All I can find to acknowledge it is this note in the Delivering a Sustainable Railway – 2007 White Paper CM 7176:

10.32 The Government has also reviewed the case for changing the regulation of ‘Saver’ return fares. These fares were regulated at privatisation, even though there was no particular justification on grounds of competition. The consequence is that passengers can be faced with a ‘Saver’ single fare of £69 and a ‘Saver’ return of £70, neither of which is actually the ideal fare for the journey they want to make. Focus groups show that most long-distance passengers would prefer an approach more in line with airlines’ practice of quoting ‘single-leg’ fares for the outward and return legs of a journey.

So that explains it: The rail monopoly prices on unregulated tickets are the highest they logically can be, which means that single tickets are basically the same price as regulated return tickets.

If, instead, they had chosen to regulate the cost of a single ticket, then return tickets would be exactly double the price of a single ticket, and the system would function as part of an integrated service where people who were able to take the opportunity of a lift on another form of transport one way could do the other way on the train without getting totally screwed for a price that was the same as having used the train both ways.

And that’s why I was attempting to optimize my ticketing by buying a return train ticket from Liverpool to Cheltenham (via Birmingham) for £60.50, going back to Birmingham, and then taking a return ticket from Birmingham to London for £41.90, which meant that I would have to return to Liverpool via Birmingham rather than take the direct train and use fewer train resources overall.

Francis didn’t believe me, and we parted company so we could both get some work done.

I got busted by the ticket inspector on the Birmingham to London train because the stamp on my ticket from the Cheltenham to Birmingham part of the journey was two days old.

I had been told in an earlier incident that while I could not break the outward train journey, I could break the return journey, and this was what I did. The ticket inspector said, Not for longer than 24 hours. I said, How am I supposed to know that limitation when all I was told was that I could break the journey? He said it’s perfectly clear in the rules, and you have to enforce a line to stop people using the same ticket over and over again for the whole month. I said, Do you have a copy of these rules? No he didn’t, but it says on every ticket:

Travel is subject to National Rail Conditions of Carriage (NRCoc) and to the conditions of carriage of other operators on whose services this ticket is valid. Copies of the NRCoC can be obtained from any staffed national rail station of from website:

As a consequence, he would now have to sell me a single ticket from Birmingham to Liverpool. This is always the policy gleefully announced on all train services because they know that single tickets are such an awesome rip-off they don’t need to complicate the situation with a further penalty fine.

I refused and bailed out onto the platform in Wolverhampton. I tried to get a bus, but they were all local. Eventually I had to go back into the train station to buy a single ticket from Wolverhampton to Liverpool. It was the only way home. “Are you sure you want a single? You are not coming coming back?” the lady asked. “No,” I said calmly as I handed over £25.50. She didn’t have a copy of the National Rail Conditions of Carriage, and it didn’t exist among all the crappy leaflets and fliers dotted around the station where it could have served to warn anyone attempting to optimize their triangular journeys in the way that I had.

Now… can anyone guess what document is not linked from the front page of the website in spite of being mentioned on every single one of billions of tickets, when they could have made it accessible on a domain such as

On the front page there is one link to something known as Terms and conditions, which begins:

Terms and Conditions for using the National Rail Enquiries website (the “Web Site”) . For the purposes of these Terms & Conditions the term Web Site also includes the web services, XML and any other data source supplying the Web Site

The Conditions of Carriage page is number 3 when you search for conditions of carriage.

From the front page, this important document is available by clicking on Train times & tickets, followed by Tickets & fares, followed by the 16th link in the column of links where it is positioned as though it is a subset of “Traveling around London”, from where you can download the 30 page 450kB NRCOC pdf document in handy clear-as-mud legalese, where it explains:

16. Starting, breaking or ending a journey at intermediate stations

You may start, or break and resume, a journey (in either direction in the case of a return ticket) at any intermediate station, as long as the ticket you hold is valid for the trains you want to use. You may also end your journey (in either direction in the case of a return ticket) before the destination shown on the ticket. However, these rights may not apply to some types of tickets for which a break of journey is prohibited, in which case the relevant Train Companies will make this clear in their notices and other publications.

For the purposes of this Condition and Condition 11, you will be treated as breaking your journey if you leave a Train Company’s or Rail Service Company’s stations after you start your journey other than:
(i) to join a train at another station, or
(ii) to stay in overnight accommodation when you cannot reasonably complete your journey within one day, or
(iii) to follow any instructions given by a member of a Train Company’s staff.

So what gives? There are absolutely no further “notices and publications” available on the London Midland train website.

To London Midlands
Dear sir,

This week I used the train to travel Liverpool->Cheltenham, and Cheltenham->London (where I stayed for two nights), and then London->Liverpool.

Unfortunately, it is evidently the policy to price (unregulated) single fares at around the same cost as a (regulated) return fare, so I chose to purchase a Liverpool->Cheltenham return, and a Birmingham->London return, which required me to travel back from London via Birmingham.

However, this broke the rules and I was put off from the Birmingham->Liverpool train by the inspector due to my ticket having a stamp from two days before (when I used it to travel from Cheltenham->Birmingham on my way to London). He told me that the limit was 24 hours.

Having obtained a copy of the National Rail Conditions of Carriage, I note that Condition 16 says:

“You may start, or break and resume, a journey (in either direction in the case of a return ticket) at any intermediate station, as long as the ticket you hold is valid for the trains you want to use.”

There is no reference to any time limit in these Conditions, and my return ticket was valid on both trains. Nor can I find any statement of any further rules on the London Midlands website.

Can you point me to a clear statement of the rules for which I was put off the train, so that I (and others) can ensure that I do not again get caught out by them when attempting to complete a non-standard journey at a reasonable price?

To National Rail feedback:

This is a question about website design. Every single ticket issued states that “Copies of the NRCoC can be obtained… from the website”

In view of this, do you think it would be reasonable to have a link to it from the front page, rather than buried four deep among the navigation toolbars?

Is it possible I have found something the millions of train nerds in this country have failed to scrutinize?

PS For all you guys using the NCG source code what I wrote, but which made some other people millionaires:

The error is in PSsubcell.cpp, line 869:
bool SetLinksAsBestLinkData(const PSCpairboundparams& pscparams, PSsubcell& scell)
where near the bottom in the loop following the comment
// Set the pointers to make the connections.
setting the back-pointers across the cell according to the best connection, we found that it was able in a 6-way cell to connect 0->3, 2->5, 4->1 because the function (using this Link Data) didn’t take account of whether the connections crossed one another.

The function is irreparable. The quick fix is to detect when there is a crossing condition, and return false if there is so it drops back into the less sophisticated PSsubcell::SetLinksAsBest() function which will give you a result that doesn’t have self-crossing. Then in the medium term you need to code the 4-way and 6-way cells independently and properly considering all the alternatives. It’s not possible to get the right answer by picking the single “best” connection first, because it’s the the gaps between the connecting passes that make it good or bad.

Drop me a line of this helped.

Tuesday, January 19th, 2010 at 9:23 am - - Cave, Weekends 1 Comment »

I can’t keep up. I have some very technical blogposts to put together on important matters such as Total Place, but there’s too many things I should be doing, like machine tool bugs.

So here’s some photos that don’t even cover the half of it.

Our new office in Liverpool Science Park 2. Can you guess what their password on the wireless is going to be?

Going caving on a wet Sunday 17 January to Low Douk again for more surveying.

Here’s the programming team for Scraperwiki down in the Mendips starting another feature that was not on the godamn to do list — to build an igloo (14 January).

Who can blame them? They’d just spent a hard week ganging up on me for trying to do stuff that was not in the to do list while living in this place. But it’s okay, because the igloo was going to be deleted the following week once we’d tried it out.

Previous week over new year involved my first trip to Low Douk on Leck Fell. We had to walk up from the bottom of the hill because it was all too icy.

There was some more mapping of caves. In 8 days, I caved once and Becka caved on 7 days. One of those days I spent in the car because of too horrible a hang-over.

Monday, January 4th, 2010 at 12:59 pm - - Machining

I thought I was doing well with the pencil overthickness routine, until I got this Christmas present from Cimco.


The strategy works by making (bitangent) pencil milling passes with an enlarged cutter, and projecting the smaller cutter from each location on the pass towards the half-way point between the two contact points.

(The black “stitching” lines show the perpendicular passes of the smaller cutter sweeping between the two contacts points for the enlarged cutter.)

The idea is to produce useful pencil passes when the model has fillets with equal or greater radius than the cutter, as in this diagram:


The difficulties include:

  • avoiding the noise from the positions of the contact points producing a wobbly toolpath
  • missing the corner when there are bitangency points for the smaller cutter because there is no fillet
  • joining the projected passes up at the junctions
  • two bitangency points for the same pass because the overthickened cutter runs up a channel

Now, I either have to argue that this example above is asking too much of the strategy, or try and solve it and possibly cause other problems if it doesn’t get it right.

The expectations that I should produce a reliable algorithms are unfortunately high.

Cimco have done well. Their example displays almost everything that can go wrong with this algorithm. Notice, for example, how the shelf causes the projection to hit the floor instead of anywhere near the corner.


Also, you can see a fold-back at the 3-way junction near the bottom of the picture as the larger tool directs the smaller tool to project back into the channel.

Have I got so much else to do! Just got back from 7 days of not caving (and one day of caving) in the icy wastelands of Yorkshire. (Becka did 7 days of caving and one day of not caving.) Pictures to follow eventually.