Monday, December 2, 2013

Speculaas Biscuits

  • 2 Cups Bakels Gluten Free Flour
  • 2 tsp Cinnamon
  • 1 tsp Ground Ginger
  • 1 tsp Nutmeg
  • 1 tsp Baking Powder
  • 1/2 tsp Salt
  • 125g Olivani 
  • 5 tbsp Almond Milk
  • 1 Egg
  • 1/2 Cup Brown Sugar

Preheat oven to 180 Deg C

Add all ingredients into a bowl aside the Milk.

Add 1 tbsp of the Almond Milk and beat till well combined. The mixture will still be crumbly at this point.

Add the rest of the milk and beat till the mixture sticks to the beater.

Remove from bowl/beater onto a floured bench and hand knead / add flour till the mixture has just about lost its stickyness, take care not to add too much as it will quickly end up too dry to roll.

Add flour to bench / rolling pin and roll to desired thickness.

Cut shapes and add to oven tray, cook for 10 / 15 minutes until turning golden.

Wednesday, July 24, 2013

WCF Template auto-redirects

Just a post to consolidate the various information on the net regarding preventing WCF from redirecting upon a request passing or not passing a trailing slash when it differs from the UriTemplate declared on the service.

The bits needed....

First of a message inspector to check for the wcf redirect property and remove it from the Message.
internal class 307MessageInspector :IDispatchMessageInspector
{
private const String RedirectPropertyName = "WebHttpRedirect";
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
{
// This explicitly removes WCF generated redirects caused by added/removed slash from uri templates.
if (request.Properties.ContainsKey(RedirectPropertyName))
{
request.Properties.Remove(RedirectPropertyName);
}
return null;
}
public void BeforeSendReply(ref Message reply, object correlationState)
{
// Do nothing as we dont want to override anything in the pipeline.
}
}

Next you need to implement a custom contract behavior to make sure its applied high enough up the pipeline to prevent WCF doing its usual redirect.
internal class 307ContractBehavior : IContractBehavior
{
public void Validate(ContractDescription contractDescription, ServiceEndpoint endpoint)
{
// Not required
}
// Adds the 307MessageInspector to the contact to prevent 307 redirects on incorrect template match.
public void ApplyDispatchBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, DispatchRuntime dispatchRuntime)
{
dispatchRuntime.MessageInspectors.Add(new 307MessageInspector());
}
public void ApplyClientBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
// Not required
}
public void AddBindingParameters(ContractDescription contractDescription, ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
{
// Not required
}
}

Finally add it to your service host in the OnOpening override.
protected override void OnOpening()
{
base.OnOpening();
Log.Debug("Applying prevent 307 redirect behavior");
endpoint.Contract.Behaviors.Add(new 307ContractBehavior());
}
And you should now find you no longer get redirected when passing an incorrect url to your WCF application.

Friday, July 5, 2013

Liquid Nerdz

Something the sproglets are bound to love and pretty good winter drink, called it liquid nerdz as they are as close to the taste as I could think of ;)

Throw the below into a mug add hot water and your good to go.

1 Twinings echinacea and raspberry teabag

1 decent tsp good quality honey

1 decent sized lemon

1 tsp raw sugar

Leave to brew after honey has dissolved .

Bit of a help to the immune system over winter and shouldn't have any trouble getting the kids to drink it :)