Wednesday 30 September 2009

How bread gets made in this house

My bread recipe is an adaptation of Mollie Katzen's in The Enchanted Broccoli Forest (I know that is twee but her later books have more grown-up titles). I have been making it pretty much ever since we left Germany (12 years ago) because I couldn't find any nice English bread. Things look better these days but I still like my own.

This recipe produces bread that is half wholemeal and half white. It has a good texture, provided by the nuts and grains and most people love it. I do NOT use a breadmaker, I think they are silly. I have 6 loaf tins, each for a roughly 750g loaf, and that fills my oven. I freeze 5 and we start eating the other one. I make two amounts of her recipe. I must mention, it has one "bug", in that she asks for 2 cups of water. This will never work with such a lot of flour! use 3.

cup = 250ml
tablespoon = 5ml


Ingredients
  • 3 cups warm water
  • 1 tablespoon dried yeast
  • pinch sugar or honey
  • 4 ½ cups strong wholemeal flour
  • 4 cups strong white flour
  • 1 cup cooked grains (barley, quinoa or millet for example)
  • ½ cup seeds (sunflower, linseed, pumpkin, sesame, poppy - poss. not all at once)
  • 1 tablespoon salt
  • ¼ cup oil
  • 1 dessertspoon honey or molasses

Method
  1. Cook ½ cup of grain (barley, millet or quinoa, for example) in 1 cups of water. You need to bring it to the boil and then cover up and simmer for 10 minutes. Then leave to cool until just hand-warm.
  2. Get a large mixing bowl and add 3 cups hand-warm water.
  3. Add the dried yeast and a pinch of sugar or honey.
  4. After about 5 mins you will see the yeast start to move around. At this point add 1½ cups of wholemeal flour and whisk it in. Leave for ½ hour or so until it has a foamy top. This stage is called the sponge and is important, as the yeast gets a chance to grow without lifting a lot of heavy flour.
  5. Now add a lot more stuff! Stick a dessertspoon in some honey or molasses and add to the mix.
  6. Now add the salt and the oil
  7. Stir in the cooked grains and the seeds
  8. Beat in three more cups of wholemeal flour
  9. Stir in two cups of white flour. this will be much harder
  10. Mix in the last two cups of white flour with your hands. After a while, the dough starts to come together. Sometimes you have to add more flour, sometimes it is hard to incorporate it all. Tip it onto your work surface and knead it until you have a nice smooth ball of dough
  11. Put it back into the bowl and leave to rise for at least two hours. More than four and it will reach its maximum size and collapse but this has never caused me any problem
  12. Oil three loaf tins
  13. Take out the dough and knead it again on a floured surface. Divide it up into three portions and press one down into each tin
  14. Leave to prove for about an hour (it really depends on the weather, yeast likes it warm)
  15. When the dough is starting to rise above the rim of the tin, turn the oven on to 190°c (fan oven)
  16. Put the bread in only when the oven has reached temperature (this is baking, not stew!) and bake for 45 minutes
  17. To test the bread, turn it out of the tin and tap the bottom. It should sound hollow
  18. You might want to give it at least 5 minutes so you don't burn your mouth on the first gorgeous slice with butter!
Variations
I always make two batches, as I said. A common combination is barley for the grains plus pumpkin and sesame seeds. I use molasses in this one. In the other bowl I would have quinoa or millet for the grains plus poppy and sunflower seeds. I would use honey in this mix.

Mollie Katzen also suggests chopped dried fruit. As a family of marmite addicts, this is not all that appealing, since we use this as our everyday bread. I have alos at times replaced most of the wholmeal flour with rye, or the white flour with spelt. Both of these work fine. The grains and seeds are also optional, bear in mind that leaving them out means you have less mass, so perhaps marginally smaller loaves.

I find the American habit of using cups to be well suited to measuring flour. I have tried putting all 8½ cups of flour for one batch on my scales and it just runs over. Far easier just to keep a clean cup measure and dip it into the flour bag. You could use an ordinary cup (not mug!) and work out roughly where 250ml would reach to. For a ¼ cup you could try an egg cup. This is only used for measuring oil, so it need not be accurate. Our egg cups have holes in the bottom for water to drain away, so I don't measure liquids with them!

I think I'll take pictures of the sponge and dough stages next time I bake, so you can see them.

Tuesday 29 September 2009

Many threads make light work



Today is the final episode in my threading story. Next time, I'll talk about bread, and possibly Wicken Fen as well. The image on the left is of my coffee cup in front of its cafetière. The strange felt object is a coffee cosy, kindly made by my sister. Bet you don't have one of those!

Previous episode

As I hinted before, the separation of incoming stream from the list of words created, nice though it is as far as Object Orientation is concerned, makes even more sense if you are building up words from several streams and adding them to the same wordlist. Like trying to find out how many times the word "thriller" came up just after Michael Jackson's death (I'm trying to think of a one-word example!).

So, this time we'll start with an array of readers. This one has three. I amended the assignReaderContent function to give each one two different paragraphs from The Star by Arthur C Clarke (the first 6, in fact). I then created a single WordList and a list of WordListBuilder and a list of Threads. All Threads (there will be three) must share the same WordList. The function setupBuilderList is passed all three lists plus the WordList object, and associates them all together:

    static void setupBuilderList(List<WordListBuilder> bList,ICharReader[] rArray, List<Thread>threadList, WordList wList)
    {
        for (int i = 0; i < rArray.Length; i++)
        {
            bList.Add(new WordListBuilder(rArray[i], wList));
            WordListBuilder.buildWordListStarterOp listStarter = bList[i].buildWordListStarter;
            threadList.Add(new Thread(new ParameterizedThreadStart(listStarter)));
        }
    }
There is a lot going on here, and quite a few new parts of ASP.NET and the classes I have created to explain. Of course, at this point there are no Threads or WordListBuilders, so we have to make one builder to enclose each reader and associate each with a thread. We create a new builder for each reader, as before, passing the reader and the wordlist to the constructor. Then we declare a delegate, called buildWordListStarterOp for the builder in question to communicate with the rest of the operation.The starter op. in question is a member function called buildWordListStarter, which has to be passed an object (as does the delegate):

        public void buildWordListStarter(object state)
        {
            if (state is BuildWordListParams)
            {
                BuildWordListParams oP = (BuildWordListParams)state;
                oP.myWordListBuilder.buildWordList();
            }
        }

        public delegate void buildWordListStarterOp(object state);

In the setup function, a ParameterizedThreadStart object is required, so we can give the thread something to work with. The parameter has to be of type system.object. the BuildWordListStarter member function expects to be handed an object of the class BuildWordListParams:

class BuildWordListParams
    {
        public WordListBuilder myWordListBuilder;
        public BuildWordListParams(WordListBuilder a)
        {
            myWordListBuilder = a;
        }
    }

Of course, since we are only passing a list, and a list is already a system.object, it is not necessary to go to the trouble of declaring BuildWordListParams. On the other hand, it is now there, and if I wanted to pass something else, for example and instruction to ignore common words such as "the" and "it", I can just add them to this declaration and it remains just one object.

This class simply passes on an object of type WordListBuilder. Assuming all goes well (and I confess, we don't have any exception handling here) this means you can take the BuildWordListParams object and just call its buildWordList member function, the same one we have been using all along.

In the static void function, this buildWordListStarterOp is called listStarter and is then passed to the new Thread in its constructor. It is perhaps not necessary to delve into the workings of threads in general. I take the view that the ASP.NET team write Thread libraries so I don't have to.

We have a list of builders and a list of thread. We now set up the timer with just the same function as last time.

The last static function (startThreads) is to start each thread off, giving it the correct parameter as it goes:

    static void startThreads(List<thread> tList, List<wordlistbuilder> bList)
    {
        int i = 0;
        foreach (Thread t in tList)
        {
            BuildWordListParams p = new BuildWordListParams(bList[i]);
            t.Start(p);
            i++;
        }
    }

Each Thread is passed the corresponding WordListBuilder.

One more, rather important, point. If you have three threads able to access a resource, such as a list of words at the same time, you may well end up with rubbish results. The content of both member functions of WordList, AddNewWord and makeReportCalledBack are enclosed in a lock statement. This ensures only one thread (we hope, containing a builder) will access it at any one time. It will then be released for another thread to use.

Here are some screenshots:

Here, you can see that the main thread is number 9, and that numbers 10-12 have been assigned to the different builders.

Here, the main thread has finished, all builders have been assigned their char readers and all threads have been started.


We are getting the first report from thread 6, which is the Timer/WordList.













At this point most or all of the content has been read. I counted up instances of the word "that" in my 6 paragraphs and there are, indeed 10.

Here, two of the threads have hit the EndOfStreamException  and have been closed.
What I do find odd is that all reports cease at this point. The previous version kept making the same report over and over again. I do not understand this, and suspect I have introduced a bug.

AT some point I will try to get all of my files up here in a zip, so you can have them, if you want.