Code Kata One as Code – Supermarket Pricing

The code kata on supermarket pricing is one we wanted to do because we have some interest in pricing rules. However, it's written as a design exercise (which is a good thing), whereas we still wanted to do some coding.
So :

The Checkout Pricing Kata

Some things in supermarkets have simple prices: this can of beans costs £0.20. Other things have more complex prices. For example:
• three for a £ (so what’s the price if I buy 4, or 5?)
• £1.99/pound (so what does 4 ounces cost?)
• buy two, get one free (so does the third item have a price?)
Here's an example stock list with pricing and rules

Stock Pricing
Baked Beans: 20p per can, with a three-for-two offer.
Bananas: £1 per Kg
Bagged Bananas: £1.20 per bag
Beer: £1.50 per bottle, with a three-for-£4 offer
Bagels: £3 per dozen or £2.00 per half-dozen or 50p each
Kitchen Roll: 50p each
Beer 'n' Beans Cleanup Offer: Buy 3 cans of beans, 3 bottles of beer and get one free kitchen roll (not combinable with any other offer).
Beans 'n' Bagel Breakfast Offer: Get 6 cans of beans and a dozen bagels for £3.50 (not combinable with any other offer).

Checkout Pricing

Write something which, given a list of items purchased, will print out a priced and itemised receipt, with weights shown where relevant and all discount rules correctly applied. The customer should not be able to get a better price by re-organising or splitting up the shopping basket. The receipt should help the uncertain customer to see this.
In TDD style, do it by writing code to pass tests for a list of increasingly complex requirements.

Example shopping baskets

• 1 can of beans, and 1 bottle of beer
• 6 can of beans, and 3 bottles of beer
• 5 cans of beans and 1.4 kg of loose bananas
• 3kg of bananas and 7 bagels
• 4 cans of beans, 3 bottles of beer and a kitchen roll
• 10 cans of beans, 15 bagels, 4 bottles of beer, 2 kitchen rolls, 3.5 kg loose plus 1 bag of bananas.

I leave to the retail stategists amongst you the question, "Should it always be impossible for the customer to get a cheaper price by adding something to their basket?"

iPad printing problems

iPad printing is unreasonably difficult. It all works fine no doubt if you go out and buy a shiny new AirPrint enabled printer. Otherwise the simplest/cheapest thing I've found is:

I've had network problems too, similar to the problems with iTunes. Replacing my router was the best solution I had for that. If your router is old, or a very cheap broadband freebie, you may need to replace it.

Losing Internet Connection When You Plug In An Ethernet Cable?

How to keep your wireless internet connection working when you also have a wired connection

You know the scenario. There you are with a wireless internet connection, you want to configure a router, you plug it into your ethernet port because you still want to keep your internet connection alive and ping! your internet connection has gone.

Solution

Open your network control panel to the settings for your wired ethernet connection. Change the IP configuration from DHCP to Manual. Remove any router or gateway settings. Apply.
You should now find that your computer routes to the internet successfully over your wireless connection instead of failing by trying to reach the internet over your wired connection.

Can’t Find Groups Management On Windows 7 Home and Vista Home Editions

How to Manage Local Groups on Windows Home

Ever helpful, Microsoft provides a GUI interface for managing users and groups on Windows. Unless you have a Vista home edition or a Windows 7 home edition, in which case you can't find the interface to manage groups because it isn't there. You can however manage groups very easily from the command line.

Manage Windows Groups from the Command Line

Simples. Find Command Line in your Start Menu Programs so that you can right-click on it and choose 'Run As Administrator'
Type:

net localgroup /?
net localgroup MyNewGroupName /Add
net localgroup MyNewGroupName MyFirstUserName /Add
net localgroup MyNewGroupName MySecondUserName /Add
... and so on

And voila. You can now set security on folders in explorer, and use your new group to grant access.
If your Windows permissions are not working after you've granted new permissions, the usual trick is to lock and unlock your session (Start Menu -- The Power/LogOff/Hibernate/Lock/Sleep button). Failing that, log out and back in again.

Net Localgroup Reference

Is here: http://technet.microsoft.com/en-us/library/cc725622(WS.10).aspx