Thursday 16 January 2014

RE Golf

http://regex.alf.nu/ has a fabby little puzzle 'regular expression golf' which has taken up far too much of my time, but got a tidy score of 3673 and learned all about backreferences.

My Answers:

  • Plain Strings (207) - foo
  • Anchors (208) - k$
  • Ranges (199) - ^[abcdef]*$
  • Backrefs (195) - (.)([^a]).*\1\2
  • Abba (190) - ^((?!(.)(.)\3\2).)*$
  • A man, a plan (168) - (.)(.)(.)?.?(\3?\2\1)$
  • Prime (201) - ^x(x*)\1$
  • Four (198) - (.).\1.\1.\1
  • Order (198) - ^.....[^e]?$
  • Triples (561) - [031][0][3694]|[053][126][25]|[7][14][4]|^0*$|217|422|895|914|177|734
  • Glob (349) - err|lle|tud|ogi|ide|ris|hob|ney|orl|tef|igh|ark|tog|rom|ial|ppe|der|thw
  • Balance (267) - ^((?!<<>>>|<><>>|<<<<<<)<(<>|<<|>>|><)*>)?$
  • Powers (63) - ^(((((((x|xxxxxxxx)\7?)\6?)\5?)\4?)\3?)\2?)\1?$
  • Long count (192) - 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 111
  • Long count v2 (212) - 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 101
  • Alphabetical (265) - te [ea][aes][sr]|st ar|nt ass|rn re|at en|(ne|et|ar|ta) te|(st|er) sn|ee ta
I probably cheated on Glob, having given up with trying to match the subtleties of the semantics of a glob * on the left & right.

Wednesday 1 January 2014

Chicken Mulligatawny


Ingredients


  • couple of chicken legs
  • olive oil
  • 1 onion
  • 3 cloves garlic
  • 1 carrot
  • 1 sweet pepper red (not green - sour flavour)
  • 1 eating apple 
  • 1 tube tomato puree
  • 2 tsp curry powder
  • 1 tsp coriander
  • 1 tsp cumin
  • 1 tin green lentils
  • handful long grain rice (easy cook is good)
  • salt & pepper
  • dash of cream to serve

Steps

  1. Half the onion, place in a pan (with well-fitting lid) with the chicken legs. Cover with water, bring to the boil then simmer for several hours - or overnight.
  2. Pour the liquid (stock) off the chicken into another container, then remove the cooked chicken legs and set aside the onion.
  3. Pull the chicken apart, carefully separating the meat from the skin & bone. Slice the meat - aiming for around 5mm square pieces and place in a clean pan. Discard the skin/bones. 
  4. Chop the onion into similar sized pieces (5mm) and add to the chicken
  5. Chop the remaining vegetables - carrot, peppers and apple to similar sized pieces and put in the pan with the chicken and onion.
  6. Finely chop the garlic and add
  7. Add the rest of the spices, tomato puree lentils and the handful of rice.
  8. Skim the fat off the chicken stock and then add the stock back in with the chicken and other ingredients.
  9. Gently stir, heat and simmer the soup for 20 minutes until the rice is cooked.
  10. Serve - adding a dash of cream to each bowl.

Alternative

Instead of using the chicken leg, use the leftovers from a roast chicken - strip the remaining meat and use a pint water/chicken stock cube in place of the stock made above.

Monday 30 December 2013

Windows 8.1 upgrade on Virtual box

Wanted to update the Windows 8 VM I keep handy on my MacBook Air to Windows 8.1 but:
The more info being:


OK sounds easy - first tried turning on PAE and NX in the virtual box settings, rebooted and retried. But the same error occurs.

Quick google later and discovered it's connected to this Bug 11899 - CMPXCHG16B instruction is disabled by default. Enabled it for this VM:
vboxmanage setextradata "win8" VBoxInternal/CPUM/CMPXCHG16B 1
Also needed to enable 3D on the graphics card:

And then sucessfully installed the update: