Tuesday, November 10, 2009

From the ridiculous to the... even more ridiculous?

I've been following the progress of In Re Bilski before the US Supreme Court, because it's got the potential to set the rules for business method (and thus software) patents for the next few years.

Unfortunately, it seems that lawyers' view of what constitutes a "good" patent has hit a new and hilarious low. Take this extract from the oral arguments (thanks to Groklaw for pointing it out):

JUSTICE KENNEDY: But it would be different, it seems to me, than what you are -- let's assume you can't patent an alphabet. I assume that is true. And you can take an alphabet to make beautiful words, and -- and so forth. You -- you want to say that these -- these electronic signals can be used in a way just like the alphabet can be used. And many of the scientific briefs say that their process is different, that they are taking electronic signals and turning them into some other sort of signal. But that's not what you are doing.

MR. JAKES: That may be, but those signals could also be transmitted. On -- on your question about the alphabet you said look at the Morse claim 5, which was an alphabet to Morse Code. That's exactly what it was.

CHIEF JUSTICE ROBERTS: So you reject -- you reject the substitute. You think you can patent an alphabet because it is a process of forming words.

MR. JAKES: It could be, yes.

In what world does this seem like a sane and reasonable way for patentability rules to evolve?

Thursday, November 05, 2009

ACTA: write to them!

I've now written to both the Green MEP in my region, Caroline Lucas, and my MP, Humfrey Malins.

My e-mail to Caroline Lucas was fairly straightforward to write. Firstly, she's an MEP, and thus European-level matters are more directly relevant to her interests. Additionally, the Commission have been ignoring direct calls, by MEPs, lead by the Green Party, for more transparency in ACTA, so I know that she already agrees that there's a problem.

Dear Dr. Lucas,

In December 2008, lead by the Green Party, the European Parliament adopted a resolution regarding ACTA which:

"... Calls on the Commission and the Member States to negotiate ACTA under conditions of the utmost transparency towards EU citizens, especially with regard to the definitions of the terms "counterfeiting" and "piracy" and the criminal sanction measures foreseen; takes the view that the social impact of the agreement as well as the impact on civil liberties must be assessed; supports the establishment of a task force to examine the implementation of the agreement, by promoting this subject in dialogue between the European Union and third countries and as part of cooperation measures with those countries..." [P6_TA(2008)0634]

Furthermore, in March 2009, the Parliament and Council adopted a Regulation that required that:

"In accordance with Article 255(1) of the EC Treaty, the Commission should immediately make all documents related to the ongoing international negotiations on the Anti-Counterfeiting Trade Agreement (ACTA) publicly available. [Am 109]" [P6_TA-PROV(2009)0114]

Nevertheless, many months later, the ACTA text under discussion is still being discussed behind closed doors, without the opportunity for review or discussion by those whom it will affect if adopted. I would greatly appreciate an explanation as to why this is, and what the Parliament, the Green Party and you yourself are currently doing to address this.

Yours sincerely,

Peter Brett

Writing to Humfrey Malins was more challenging. Firstly, European Commission-level negotiations aren't something that the Commons has any real direct influence on. However, the fact that the Baroness of Uphallow is the European Commissioner for Trade provided a way to demonstrate the ACTA negotiations' direct relevance.

Dear Humfrey Malins,

The UK, as part of the European Commission, is currently in the process of negotiating the plurilateral Anti-Counterfeiting Trade Agreement.

This process has been concealed behind a veil of utmost secrecy, despite repeated demands by the European Parliament and Council for greater transparency (see: P6_TA(2008)0634 and P6_TA-PROV(2009)0114). Only a rough outline of the structure of the proposed treaty is available to the billions of people who will be affected by its provisions. I do not believe that, in the case of a trade treaty, such secrecy serves the public interest. The quality and fairness of the results of the process can only be improved by allowing the people in whose name the treaty is being negotiated to see and discuss the actual provisions being suggested.

I have already written to my MEPs, but the Commission has made it quite clear that they intend to continue to ignore the European Parliament's position on this issue. Catherine Ashton is the UK Commissioner and holder of the Commission's Trade portfolio, and as such is responsible for the Commission's role in the ACTA negotiations. (It is interesting to note that the Baroness of Upholland has no background in trade issues and has never been elected to public office.)

Would you be willing to ask the Prime Minister to direct Baroness Ashton to encourage the EU ACTA delegation to open the process to public scrutiny, please? It seems to me this would greatly serve the public interest.

Yours sincerely,

Peter Brett

Hopefully I'll get some useful and timely replies. We'll see!

ACTA: what lurks in the shadows?

Over the last two years, a number of countries and multi-national blocs have been negotiating a new treaty called the Anti-Counterfeiting Trade Agreement (ACTA). The UK Intellectual Property Office, for example, claim that:

The Anti-Counterfeiting Trade Agreement (ACTA) seeks to coordinate international cooperation on IPR enforcement practices, to tackle effectively counterfeit and pirated goods.

Whether or not you feel that the premises on which the proposed treaty is founded are benign (the Pirate Party UK, of which I am a member, opposes it in principle), the most disturbing thing about this treaty is the veil of total secrecy behind which all of the negotiations and details of the proposed treaty provisions have been concealed. (Recall that, in most countries, international treaties which have been ratified by the government have the force of law).

Indeed, the public was not even aware of what, exactly, the proposed agreement would cover until a discussion paper was leaked in May 2008.

On the EU side, the negotiations are being carried out by the European Commission, which has routinely denied or stalled all attempts to give transparency to the process. They have even ignored repeated demands from the European Parliament for drafts and documentation of the process. In December 2008, for example, the European Parliament adopted a resolution which:

Calls on the Commission and the Member States to negotiate ACTA under conditions of the utmost transparency towards EU citizens, especially with regard to the definitions of the terms "counterfeiting" and "piracy" and the criminal sanction measures foreseen; takes the view that the social impact of the agreement as well as the impact on civil liberties must be assessed; supports the establishment of a task force to examine the implementation of the agreement, by promoting this subject in dialogue between the European Union and third countries and as part of cooperation measures with those countries.

The Commission failed to comply. Several months later, in March 2009, the European Parliament and Council adopted new regulations on transparency in government, and as part of this they specifically singled out the ACTA negotiations as an area in which transparency was sorely needed.

In accordance with Article 255(1) of the EC Treaty, the Commission should immediately make all documents related to the ongoing international negotiations on the Anti-Counterfeiting Trade Agreement (ACTA) publicly available.

Nevertheless, these documents are still not available. Although there are judicial procedures by which the Parliament can compel the Commission to act, these take a long time, long enough that the details of ACTA might not be made available until the negotiations are concluded and the treaty's provisions presented as a fait accompli.

It's therefore been recommended that citizens of EU countries pressure our individual governments to make the process more transparent. For example, I have recently filed a request under the Freedom of Information Act for details of the UK's part in the ACTA negotiations and, specifically, for draft documents, and I'll be writing to my MP later today to ask him whether he feels that such secrecy in negotiations of a trade treaty is really in the public interest.

Watch this space.

Update: I've made additional FOI requests of the Department for Business, Innovation and Skills, and the Foreign and Commonwealth Office.

Update 2: BIS say that I should contact UKIPO. How fortunate that I already have done so!

Thursday, August 20, 2009

Perception of reality

In late 2005, shortly after arriving at Girton College to begin my undergraduate course in Engineering, I met a young lady who would change my life forever. She was tall; she was slender; she was a stunning brunette; she was intelligent; she was witty. She was the most wonderful woman I had ever met.

She was also quite shy, which meant it took a long time -- months -- for me to win her trust. We chatted online most days of the Christmas vacation, and in the Lent term we drank late night cocoa together while commiserating about the length and difficulty of our examples papers. Just after Easter in our first year at Cambridge, we began going out. It was the 17th April 2006, and it was the happiest day of my life.

We had a wonderful time together. I remember one evening in June 2006, after finishing our exams, we packed a dinner of boiled eggs, rocket, cheshire cheese and crusty brown bread, cycled into the fens to the north of Cambridge and enjoyed a relaxing picnic on the verge outside the Queensholme Bloodstock Stables near Willingham. I remember her laughing as she snapped a photograph of a big green caterpillar crawling around in the grass near her lap.

I remember my 21st birthday, at her house in the Alps, with a delicious carrot cake and beautiful, hot continental weather to travel up a funicular railway and enjoy a meal overlooking the mountain lakes.

I remember a second year in Cambridge, living next door to each other on a corridor of our friends at Girton's Wolfson Court. I remember fondue evenings followed by games of Mario Kart 64 in my room, with people sitting on the bed and huddled on the floor to gather round and watch. She always won, no matter how hard we tried! I remember visiting her home again -- this time at the New Year -- and travelling far into the highest mountains to find a resort with ski-able snow. I remember carrying her new kayak to the river on her 20th birthday in the pouring rain, and watching the fireworks with her at the First and Third Trinity May Ball.

I asked her to marry me, and she said, "Yes." We went to a jeweller together, and together we decided to have a beautiful ring made to order: a sapphire flanked by two smaller diamonds. It was the second happiest day of my life.

At College again in our third year, we lived next door to each other again. I remember my happiness and her joy as I watched her win all of her kayaking varsity events, and I remember her endless months of struggling with mountains of horrendous maths problems. I remember punting on the Cam, our finals behind us, and not a care in the world. I remember her graduation, and looked forward to her being there at mine.

But then things changed. In September 2008 she went to York, to do a PGCE in secondary mathematics, while I remained in Cambridge, plugging away at the final year of my MEng. And suddenly it was not "we" who told the story any more, it was "she" and "I." I dutifully dragged her bicycle and her clothes and her books up to York on the train, longing to spend as much time as I could with the one I love. She seemed unwilling to make the time to come down from York to visit me, and when she came seemed to wish she hadn't. When I was there, it was as if she resented my presence, as if I was intruding into her privacy. Something had changed, and I was bewildered and confused.

She spoke to me less and less on the telephone, and never seemed to want to chat with me online. I was distraught. "What is going wrong?" I wondered. "Was it something I have done? Was it something I didn't do?" Yet I loved her still, with all my heart, and arranged a surprise visit to her in York. It was a cold night in March, but she was icy. It seemed like the relationship I cherished as much as life itself was hanging by a tenterhook.

The final examinations of my MEng began on the 17th April 2009, and it was on the 19th April I received the letter that I had expected but which I hoped would never come. Just over three years after our relationship had begun, it was over. It was the worst day of my life.

That was four months ago, and now she is with a new man, or at least, that is what her Facebook status says. Four devastating months, in which my life has crumbled to pieces around my ears as if struck by a tsunami; not only my future, but my past as well.

I looked forward to marrying her, starting a household together and eventually starting a family together, and now that will never happen. All my hopes, all my dreams are the wreckage of jagged splinters left after the box of Christmas baubles is hurled down the stairs. My heart is a broken mess of mingled sorrow, love, jealousy and anger.

But worse, I find myself doubting whether the way I saw things was in fact the way they really were. Towards the end of the relationship, I was fooling myself when I told myself that she loved me and that this was just a hiccough that could be put right by showing her that I loved her. But for how long? How long did she hide the way she felt about me? Did she do it out of some misplaced wish to avoid "hurting my feelings," or because she was afraid of how I might react? What did I do, or not do, or what about me was it that drove her away from me? Is the truth of the matter that I was too devoted, too trusting?

I fear -- I so dreadfully fear -- that even when our friends were sending us cards to congratulate us on our engagement, even then she was doubting whether I was the man for her, and she didn't tell me. And that would mean that, for more than a year and half of my life, the reality I perceived did not exist. I was living in a dream world.

How I wish, how I so terribly desire for that dream world to be real. Because, at the same time as I continue to love her wholly, I know now that we will never -- can never -- be together again. She has changed my life forever; but I hadn't expected it to be like this.

My days are swifter than a weaver's shuttle, and are spent without hope.

--Job 7:6

Friday, August 14, 2009

US NEO detection programme not on schedule

In space-related news:

According to a new interim report from the US National Research Council, NASA's current near-Earth object surveys will not meet the congressionally mandated goal of discovering 90 percent of all objects over 140 meters in diameter by 2020. Funding for near-Earth object activities at NASA has been constrained, with most costs being met by funds from other programs.

What a surprise! Underfunded science programmes have difficulty meeting targets! In addition to complaining about funding, the full report (which is free to download) has some interesting information on the current technology and facilities used for detecting near-Earth objects.

Another of the report's findings was that:

The Arecibo Observatory telescope continues to play a unique role in characterization of NEOs, providing unmatched precision and accuracy in orbit determination and insight into size, shape, surface structure, multiplicity, and other physical properties for objects within its declination coverage and detection range.

I find this particularly interesting in the light of concerted efforts in recent years to shut the Arecibo facility down "to save money."

Congress should make up their minds: they can mandate and fund public research, or do neither.

Thursday, August 13, 2009

Response to illicit filesharing legislation consultation

In the wake of the recently-release Digital Britain report, the Department for Business, Innovation and Skills recently opened a consultation on proposed legislation to combat illicit peer-to-peer filesharing. I have published my rather lengthy response on my website.

I hereby disclaim all responsibility for permanent brain damage caused by extreme boredom induced by reading the document linked above.

Sunday, August 09, 2009

gEDA build system redesign

One of the items on the gEDA "Todos" list as a prerequisite for the 1.6.0 release has been a refactor of the gEDA build system. Instead of using several distributed source archives (one for each major component), it was decided to distribute the gaf suite as a single archive, with one unified build system.


The advantages of this strategy were seen as follows:

  1. The system would be less confusing for new testers or "power" users who want to try out the latest changes in git.
  2. The whole suite could be built and tested before installing any files. In the past, it's been necessary to install the libgeda and symbols packages before any of the other packages could be built.
  3. It would reduce the labour involved in keeping the version numbers, ChangeLogs, and required dependency checks up-to-date. Maintaining multiple configure scripts in parallel is labour intensive, and there is the ever-present risk of missing one.
  4. It would simplify the job of distribution packagers. In the RPM case, it would only be necessary for a packager (like the maintainer of the Fedora Electronic Lab distribution, Chitlesh Goorah) to maintain a single SPEC file, rather than nine.
  5. It would simplify building using parallel make (see the -j option to make), which can significantly speed up compiling gEDA on machines with multiple or multi-core processors.
  6. It would improve detection of targets requiring rebuilding. This is particularly important for working on libgeda; only changes which affect the public interface require a rebuild of the applications, but it's often hard to keep track of what's changed. What often happens with the 1.4.x build system is that people end recompiling the applications completely just to make sure, at a cost of time and energy.


The rework had been on the "Todos" list for several months when I started looking into it at the beginning of June 2009 (just after handing in my MEng project), and some ideas came to mind about how the current structure of the build system could be improved.

  • One idea that crossed my mind extremely briefly was not to use GNU Autoconf and Automake, but to adopt another build infrastructure. Autotools was retained, because not only is it well known by current gEDA developers, but it has worked well enough for us in the past, and it doesn't require developers or users to install yet another tool in order to be able to compile and install gEDA.
  • I had recently been looking at the configure.ac file for DTN2 (the reference implementation for the Delay Tolerant Networking Bundling Protocol), and I noticed that they used a very minimalist, clearly-laid-out configure script will almost all of the configure checks being described in separate m4 files, as self-contained Autoconf macros. This appealed to me, because configure.ac files are often very confusing to a newcomer, and this method offered the potential to make it much, much clearer.

Problems encountered

There were two major problems encountered while carrying out the work.

Firstly, internationalisation of desktop integration files (.desktop files to appear in menus etc., and MIME-type info files to make file browsers show the right icon. In previous releases, intltool has been used to do this, but intltool suffers from a major flaw: it doesn't support more than one gettext domain in a single package, and we would need to use at least three (one each for libgeda, gschem and gattrib).

I was very surprised to find that there wasn't an existing solution to this problem in widespread use. In the end, I had to actually write my own tool from scratch to carry out this task, a 550-line shell script called desktop-i18n. Although enormously hacky, it works remarkably effectively!

The second major problem was in getting the testsuite to pass without gEDA being installed. The number of issues encountered was innumerable (one of my "favourite" examples was the way that libgeda used to call exit(-1) if it couldn't find the gEDA font, even in gnetlist which doesn't need to display any text objects anyway). By a combination of actually fixing bugs (few) and horrible nasty hacks (many), I eventually surmounted this issue too. With this, there were more than a few occasions where I felt like I was banging my head against a brick wall.


On Friday 7th August I merged the "build-system" branch into the main git repository, and the new build system seems to be a genuine and successful enhancement (despite a few minor issues). However, I can hardly believe how much work it took to do!

Sunday, July 26, 2009

Double-chocolate brownies

While CURA were at Bisley for the Imperial Meeting this year, I made the team some of these brownies. They were very much enjoyed by all!

This recipe is designed to make quite firm brownies that travel easily (e.g. on the back of my bike). If you like your brownies nice and squidgy, put less flour in (175 g instead of 225 g).

  • 275 g plain chocolate (50% cocoa solids)
  • 220 g unsalted butter
  • 85 g walnut pieces
  • 170 g milk chocolate (cut into chunks)
  • 225 g plain flour
  • 1 tsp baking powder
  • 4 large eggs, lightly beaten
  • 1 tsp vanilla essence
  • 325 g caster sugar

Pre-heat oven to 170°C (155°C if you've got a fan oven). Line a 30x20x3.5 cm cake tin with lightly buttered greaseproof paper. I find that it makes the brownie easier to extract from the tin if you butter the base of the tin as well.

Melt the plain chocolate and butter in a large (preferably metal) mixing bowl over a pan of simmering water. Remove the pan from the heat and stir in the sugar, followed by the eggs and vanilla essence.

Sieve the flour and baking powder into the mixture, and fold in. Fold in the nuts and chocolate chunks.

Pour the mixture into the cake tin, place in the oven and cook for 20-25 mins. The corners will cook fastest; do not allow them to burn! When cooked, a skewer inserted into the centre of the brownie should come out mostly clean, but it's no big deal if you get a squidgy middle.

Allow to cool in the tin. When cool, remove the brownie from the tin and cut into squares (you should be able to get 24 good-sized pieces from this recipe).

Update: Avoid oil-based chocolate and/or HFCS-based chocolate for this recipe. It won't work.

Simple unit tests in Scheme

One nice feature of the Scheme programming is the ridiculous, over-the-top power of its "hygienic" macro system, which allows a programmer to effectively redefine the language to suit the task at hand.

A few days ago, I needed to write some simple unit tests for some Scheme code I was in the process of developing. The Guile Scheme implementation doesn't come with a library for unit testing by default, so it was necessary to create one of my own. This is it:

(define *failed-tests* '())
(define *passed-tests* '())

(define (assert-true result)
  (if (not result)
      (throw 'test-failed-exception
              (lambda ()
                (display "  assert-true: ")
                (display "got: ")
                (write result))))))

(define (%begin-test name test-thunk)
  (let ((test-success #t)
        (test-fail-msg #f))
    (display name) (display "... ")

    (catch #t test-thunk
           (lambda (key . args)
             (set! test-success #f)
             (set! test-fail-msg
             (if (eqv? key 'test-failed-exception)
                 (car args)
                  (lambda ()
                    (display "  unexpected exception: ")
                    (write (cons key args))))))))

    (if test-success
          (display "passed")
          (set! *passed-tests* (cons name *passed-tests*)))
          (display "failed")
          (if test-fail-msg
                (display test-fail-msg)))
          (set! *failed-tests* (cons name *failed-tests*))))

(define-syntax begin-test
    (syntax-rules ()
      ((_ name . test-forms)
       (%begin-test name (lambda () . test-forms)))))

(define (report-tests)
  (display "Test summary")(newline)
  (display "Passed: ") (display (length *passed-tests*)) (newline)
  (display "Failed: ") (display (length *failed-tests*)) (newline))

Note that this effectively adds a keyword (begin-test) to the Scheme language, and this very simple macro has a massive effect on the readability of the resulting testcase code. For example, a trivial unit test using this minimalistic framework might look like:

(begin-test 'SuccessfulTest
  (assert-true #t)
  (assert-true (equal? 1 1)))
(begin-test 'FailTest
  (assert-true (equal? #t "string")))

The framework is completed with the addition a few more assert- functions (left as an exercise to the reader). This code will form part of a future release of gEDA.

(In case you want to use this code in your own project, it is licensed under the GNU LGPL v3 or later). But there are probably better unit test systems for Scheme out there!

Saturday, July 18, 2009


While I'm on a roll with the recipes, here's my recipe for chicken enchiladas. It's probably not particularly authentic, but I enjoy them! This recipe serves 2 moderately hungry people.

Enchilada sauce

  • 400 g can of chopped tomatoes
  • 1 clove garlic, chopped
  • Fresh chilis, chopped
  • 1 tbsp olive oil

I usually use 2-3 of the normal chilis sold in Tesco or Sainsbury's (with the seeds left in), but I like my echiladas nice and spicy! With those chilis, I find them a bit impotent with the seeds left out.

Fry the chilis and garlic in the olive oil for 2-3 minutes over a medium heat. Add the chopped tomatoes and simmer for 20-30 minutes until most of the excess liquid has evaporated leaving a thick, spicy tomato sauce.

This can easily be made in advance, and freezes well.

Fried chicken filling

This is a very simple filling -- use your imagination and come up with your own! Try other meats, fried peppers or mushrooms, seafood, cheese... Also consider marinating the chicken with spices before frying.

  • 300 g chicken breast, cut into strips
  • 10 g fresh ginger, grated
  • Dried paprika
  • Salt & pepper
  • Half a medium cooking onion, coarsely chopped.
  • 1 tbsp olive oil

Heat the oil over a high heat in a wide-based frying pan. Add the onion, chicken, ginger, and paprika, and season the chicken to taste. Fry until the chicken is cooked through, then set aside.

Like the sauce, this can easily be made in advance.

Putting it all together

  • 4 corn tortilla wraps
  • 150 g grated cheese (cheddar works okay)

Pre-heat the oven to 150°C. Microwave the tortilla wraps for 15-20 seconds until they are warm and flexible. Divide the filling between them, roll them up, and place them together in a small roasting tin. Spread the enchilada sauce generously over the tortillas (making sure to coat them all over). Top with the cheese and salt and pepper to taste.

Bake in the oven for 15-20 minutes, and serve with green salad and spring onions.

Friday, July 17, 2009

This will seem like bragging...

This will seem like bragging, but in retrospect I really did rather well at Cambridge. These are the prizes and scholarships I was awarded over my four years:

  • Emily Davies Scholarship (twice)
  • Henry Tompkinson Scholarship
  • Beatrice Mills Prize
  • Rosalind, Lady Carlisle Prize
  • Raemakers Prize
  • Accenture Second Year Computing Prize
  • i2 Ltd. Third Year Computer-Based Project Prize

Of course, those successes paled into insignificance alongside the accomplishments of some of my peers at certain prestigious inner-city colleges, but I think I did okay for a hick from the sticks (i.e. a Girtonian)!

Edit: I forgot to mention that I also blagged a (large) award from the academic funds for a plane ticket to a conference at MIT. But that was more of a success in terms of "social engineering" than actual engineering!

Wednesday, July 01, 2009

Starting my PhD!

As I mentioned in January, I was awarded a PhD studentship at Surrey Space Centre. I graduated from Cambridge last Friday, with I Class honours in my BA and a Distinction in my MEng, moved down to south-west Woking at the weekend, and started at SSC today!

I'm having to fight a bit to get a Linux workstation -- other groups in the same building (and serviced by the same IT staff!) use Fedora on their desktops, but SSC has historically been an all-Windows environment. In a corporate setting, I might put up with Windows -- there, at least, there is often a reasonably well-staffed IT services department to take care of the innumerable things that go wrong -- but in my experience, PhD students don't get quite that level of support. If I'm going to be solving my own problems, I want to do it with more powerful tools. (Also, Emacs on Windows isn't nearly as much fun. How can I possibly survive without a properly-functioning compilation-mode?)

Nevertheless, I think I'm eventually going to win the battle. In the meantime, it looks like I'll have to make do with Cygwin.

As far as the research is concerned, I've barely start to dip my big toe into the scalding bathtub of things I don't know, and it feels like I've got a long, long way to go before I get to the things no-one else knows either!

Update: I managed to persuade the computing folks to give me second PC running Linux and a USB KVM switch. So that's alright, then.

Chorizo and tomato pasta

Another chorizo recipe that I made to use up what was left over from the previous one. Note that I use Spanish chorizo, not Mexican (as most commonly found in the USA).

Ingredients (serves 3-4):

  • 150 g dried chorizo sausage, diced finely
  • 1 medium cooking onion, coarsely chopped
  • 1 clove garlic, chopped
  • 100 g mushrooms, sliced
  • 400 g can chopped tomatoes
  • Olive oil
  • Balsamic vinegar
  • Dried tarragon
  • 2 small bay leaves
  • Black pepper

In a wide-based saucepan, heat a tablespoon of olive oil, and fry the onion and chorizo for 2-3 minutes (or until the onion is translucent). Add the mushrooms and garlic, and continue to fry until the mushrooms begin to darken and shrink. Add the tomatoes, and stir in the dried tarragon, bay leaves, black pepper, and about a tablespoon of balsamic vinegar. Cover and simmer gently for 20-30 minutes.

Serve with pasta and fresh green salad.

Monday, June 29, 2009

Baked pork chops with chorizo

Here's a simple but delicious recipe I adapted from a dish served at Girton's cafeteria sometime in early 2009.

Ingredients (serves 2):

  • 2 pork chops
  • 60 g dried chorizo sausage, diced finely
  • 1 medium cooking onion, coarsely chopped
  • 1 clove garlic, chopped
  • Salt and pepper

Pre-heat the oven to 180°C (fanless oven 200°C). Sprinkle both sides of the chops with salt, and place in a small roasting tin. Pile garlic, onion and chorizo on and around the meat. Add pepper on top. Cover the roasting tin with tin foil and bake in the oven until the meat is cooked (usually between 45 mins and one hour).

Serve with boiled potatoes and fresh cabbage.

Saturday, January 24, 2009

PhD studentship at SSC

I've been accepted for a PhD studentship at Surrey Space Centre, working on applications of satellite-based Synthetic Aperture Radar (SAR). Even better, I've been awarded a Doctoral Training Grant by the EPSRC, so as long as I pass my MEng I'm going to be going exactly where I've wanted to go for the last couple of years, doing (more or less) exactly what I want to do!

gschem, log files and X selections

Just over a week ago, I posted a series of [RFC] posts to the gEDA-user mailing list suggesting six reasonably non-trivial changes to libgeda and gschem. Although the discussions they started off weren't quite as productive as I was hoping, they did attract quite a bit of interest.

I haven't been afraid to put my money where my mouth is. Since then, I've implemented two of the changes I suggested: a modification of the way gEDA apps create logfiles, and support for copying and pasting bits of schematics between gschem windows. I thought I'd post here to explain the amount of careful design work that goes into even relatively minor changes to the gEDA suite.


Historically, gschem (and the other gEDA apps) have created logfiles in the current working directory when they were launched. This behaviour quickly resulted in a user's home directory becoming littered with the files, gschem.log files especially.

My initial suggestion was to just not create log files by default, and require users to specifically enable them. However, it was quickly pointed out that since one of the most common reasons for gschem failing to start was that a new user had made a mistake in their configuration file, and that it would be best to carry on with generating logfiles as the default behaviour.

Instead, it was suggested that the logfiles should be put in a centralised, out-of-the-way location, and ~/.gEDA/logs/ was suggested, with the caveat that it would be necessary to make sure that multiple copies of gschem accessing the directory would have to be supported safely, even on different machines, but also that a user could quickly easily find the most recent log file -- so just adding a random suffix with mktemp wouldn't work either!

Having worked out a way of doing this (a secure algorithm for generating sequentially numbered, dated log files), I then realised that on some operating systems, such as Microsoft Windows, $HOME might not even be defined, and that there might be platform-specific differences in the standardised place to keep configuration data. Since the gEDA applications had no existing way of handling these variations, I ended up abstracting out the methods for locating the system and user data and configuration files, and updating all of the gEDA apps to use them.

All in all, changing the location where log files are stored used up at least eight hours of development time.

Clipboard copy, cut and paste

For a long time, gschem has supported copying and pasting schematic data between pages and windows in the same gschem process, but it was never made clear to users that this mechanism didn't use the X clipboard, and thus sometimes copying and pasting didn't work when it would have made sense for it to.

X Window System selections are complicated. There are two selections normally used by X applications: the PRIMARY selection and the CLIPBOARD selection. Traditionally, the PRIMARY selection is contains the most recent piece of text selected by the user with the mouse, and can be pasted by clicking the middle mouse butten, while the CLIPBOARD selection is accessed via "copy" and "paste" actions explicitly invoked by the user. In order to match up with other applications (and because nothing like the PRIMARY selection is available on Microsoft Windows or OS X), we decided to use the CLIPBOARD.

For the same portability reasons (and also because the raw X API is horrendously complicated), we decided to use the GTK Clipboard API to manage the clipboard.

A neat feature of clipboards (and X selections in particular) is that it's possible for the source application to provide the data in different forms, depending on what the "pasting" application wants. We needed a format for transferring between gschem instances, so we decided to use the gEDA schematic format (application/x-geda-schematic). Fortunately, as part of my rewrite of the symbol library back in mid 2007, I'd made libgeda able to "load" and "save" schematics from memory buffers, so I simply hooked the clipboard code into that and things started working!

I then, of course, had to work through the boilerplate required to update the GUI to support it. This took as long as implementing the actual feature.

I've also been working on some other features, using some code that I've had floating around for a long time. But more of that another time!