Sunday, 23 December 2012

Numbledenumps

Numbledenumps

A take on the recipe for rumbledethumps on the BBC website.
Basically, I just used what was available in the local shops and what was in the fridge that needed using up

Ingredients:


750g potato, peeled and diced.
500g parsnips, peeled and diced.
50g butter
A bit of cooking oil of choice
1/2 white cabbage, quite finely sliced into 2cm lengths (sliced one way, then turn it a quarter and chop it again a couple of times)
1 onion
salt and pepper
a bunch of cheese, grated (i used up some mozzarella and mature cheddar)

Method:

Put the potato and parsnips in a pan, cover with water and add a teaspoon of salt.
Put a lid on, bring to the boil, remove lid, turn down and simmer until very tender.
While that's cooking, hear the butter with a bit of normal cooking oil in another pan with that has a lid.
Turn it up high, fry the onion until golden.
Turn it down, add the cabbage and stir.
Put a lid on and sweat it for 5 minutes. Don't over do it, they must still be quite firm.
Drain the veg. Return them to the pan.
Add the onion, cabbage and butter mix.
Mash, season with salt and pepper to taste (about 1/4 tsp salt and 10 turns of pepper)
Transfer to a lidded casserole dish, cover the top with the cheese.
Put the lid on and put in the oven at 180C for 30 minutes.
After that, remove the lid and put back in the oven for a further 15 minutes.

Nom the hell out of it.
Lie down and wonder why you tried to eat so much.

Bisto++ Mk1.

This is my first attempt to make fancy tasting gravy for beef using ordinary cupboard ingredients and not having to roast some beef for that proper gravy taste.

Bisto++ Mk1.


Ingredients:

1 onion, finely diced
4 cloves garlic, crushed
About 12 mushrooms
1 miniature of red wine (about 185ml)
1 tbsp tomato puree
1/2 tbsp Worcestershire sauce
1/4 tsp dried mixed herbs
1/4 tsp dried thyme
350ml beef stock made with 1 stock cube (I use Kallo brand)
1 tbsp plain flour made into thin paste with cold water (Or thickening granules or corn flour I guess)
2 heaped tsp of beef gravy granules (I use Bisto)
1-2 tbsp high temp cooking oil (I use rice bran oil)

Method:

Heat the oil in a frying pan.
Fry the onion until golden, get some brown/black crispy bits on it.
Turn down the heat to low
Add the garlic, fry for 3 minutes
Add the mushrooms, fry until just started to soften
Tip in the wine, add the tomato puree, Worcestershire sauce, mixed herbs and thyme
Cook on that low/medium heat until almost all of the liquid has gone. It will be thick and gloopy.

(At this point you can switch it off and leave it until you are ready for the gravy)

Make your stock with the stock cube and boiling water, tip into the wine, veg and spice mix and stir.
Tip in your thin flour paste. Not too thick or you get lumps. If you do get lumps, don't worry they break down.
Sprinkle over your two heaped teaspoons of gravy granules.
Cook for a few minutes then clap a lid on it and switch the heat off.
Gravy is done.

This worked really well, apart from the flour lump mini-panic.

Thursday, 29 March 2012

Automatic Reg Free COM Script

Here's a windows batch file I wrote that automatically takes a .NET Assembly who's classes have been suitably decorated with COM visibility tags and embeds all the information necessary for Reg Free COM to work.

UPDATE1: OK, some fixes added. But this one really works.
However, I wrote a command line app to get the version number of an assembly called GetAssemblyVersion.
Source code is at the end of the post, unless you know of a better way, in which case let me know!
It also doesn't work for signed assemblies, you'll need to add another command to add something like %PublicToken% to the client manifest

ECHO OFF
REM Show usage if no parameters are passed in
IF %1==[] GOTO :NoParams
SET DLLFilename=%1
REM Kill any old manifests, mt won't overwrite one
IF EXIST %DLLFilename%.manifest DEL %DLLFilename%.manifest
REM Get MT to autogenerate a reg free COM manifest from the COM decorated classes in the assembly
mt -nologo -managedassemblyname:%DLLFilename% -nodependency -out:%DLLFilename%.manifest
REM Optional VB Script that uses XMLSpy to auto-format the Xml into something readable
WSCRIPT PrettyPrint.vbs //NOLOGO //B //T:60 %~dp0%DLLFilename%.manifest
REM Now poke the manifest file into the target DLL at the right location
reshacker -addoverwrite %DLLFilename%,%DLLFilename%,%DLLFilename%.manifest,24,1,1033
REM Generate the COM interface that isn't present in .NET assemblies.
tlbexp /silent %DLLFilename%
REM Again, use reghacker to poke it into the DLL
reshacker -addoverwrite %DLLFilename%,%DLLFilename%,%~n1.tlb,TYPELIB,1,1033
REM Clear up all the rubbish, because we don't need all these files hanging around anymore!! 8D
DEL %DLLFilename%.manifest

FOR /F "tokens=*" %%i in ('GetAssemblyVersion %~dp0\%DLLFilename%') do SET AssemblyVersion=%%i
REM Now generate a client manigest for the EXE/DLL that's going to be referencing our component
IF EXIST %1.client.manifest DEL %1.client.manifest
ECHO ^<?xml version="1.0" encoding="UTF-8" standalone="yes"?^> >> %1.client.manifest
ECHO ^<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"^> >> %1.client.manifest
ECHO ^<assemblyIdentity type="win32" name="client" version="1.0.0.0"/^> >> %1.client.manifest
ECHO  ^<dependency^> >> %1.client.manifest
ECHO   ^<dependentAssembly^> >> %1.client.manifest
ECHO       ^<assemblyIdentity name="%~n1" version="%AssemblyVersion%" processorArchitecture="msil"/^> >> %1.client.manifest
ECHO   ^</dependentAssembly^> >> %1.client.manifest
ECHO  ^</dependency^> >> %1.client.manifest
ECHO ^</assembly^> >> %1.client.manifest

GOTO :End

:NoParams

ECHO Usage: RegFreeMe DLLFilename

:End

If you're not using Xml pretty printing, remote the WSCRIPT... line

There are some pre-requisites for that, you need the following software installed and in your PATH variable:

mt (provided by the MS Windows SDK or Visual Studio)
rc (provided by the MS Windows SDK or Visual Studio)
tlbexp (provided by the MS Windows SDK or Visual Studio)
reshacker (Follow the link, download and install)

Optional (pretty prints the Xml manifest embedded in the DLL to allow easy reading)

wscript, the Windows scripting host
Altova XMLSpy

The following VB Script:

'Pretty Print XML
Dim objSpy ' As XMLSpyLib.Application
Set objSpy = GetObject("", "XMLSpy.Application")
'objSpy.ShowApplication (False)
Dim objDoc' As XMLSpyLib.Document
Set objDoc = objSpy.Documents.OpenFile(Wscript.Arguments(0), False)
objDoc.SwitchViewMode 0
objDoc.SwitchViewMode 1
objDoc.SaveAs Wscript.Arguments(0)
objSpy.Quit

TBD: Publish the script to auto-merge many client manifests into one and embed it in a target EXE (embedding is required for this to work in Win7, side by side manifests don't work anymore)

Embed this in your build scripts.
There, I've saved the world from reg free COM.
But will anybody ever read it?
Or buy me beer?

Source code for GetAssemblyVersion:

using System;
using System.Reflection;

namespace GetAssemblyVersion
{
    static class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            if (!string.IsNullOrEmpty(args[0]))
            {
                Console.Out.WriteLine(Assembly.LoadFile(args[0]).GetName().Version.ToString());
            }
            else
            {
                Console.WriteLine("Usage: GetAssembly AssemblyFilename");
            }

        }
    }
}

Monday, 12 March 2012

All Watched Over By Machines Of Loving Grace (playlist)

('http://www.youtube.com/p/6CAC1A8A9BEFAB04?version=3&hl=en_GB',)

Finally got round to finishing my YouTube playlist for Adam Curtis' "All Watched Over by Machines of Loving Grace"