I recently needed to write a Combinatorial Iterator for a project I'm working on. That is a class which when given a size and a collection of items (normally a set), returns all the possible unique combinations of elements from the collection of the given size. For instance the combinations of size 3 of the set [1,2,3,4] are [1,2,3], [1,2,4], [1,3,4] and [2,3,4]. There is a nice discussion of this problem on StackOverflow. The number of possible combinations can explode in size quickly, there are 2,598,960 combinations of five cards from a standard pack of 52 cards. Thus I wanted to handle each combination in turn as required, rather than calculate all combinations upfront. Having recently started learning Scala and Ruby, I decided to implement my solution in those languages, plus Java (which I use every day at work).
April 2009 Archives
Deux because they're fancy!
Starting with the best, Pied a Terre is a small, intimate restaurant in Fitzrovia. At least I think it is small. It appears to be a converted house, so there are many small rooms. We were in the front room with four tables, most of which were empty during our meal, and none were in our eyeline. The large front window was frosted to just above head height. The room felt light, but no one on the street could see in, nor could we be distracted. Combined with the staff materialising as if from nowhere whenever required, the impression was a private dining experience. It is the effect Hakkasan was attempting and failing to achieve (there I felt as if I was on a stage with down lighting trying to isolate our table in a large room). We ordered the tasting menu with the discovery wines option. Were I to describe each dish it would become a bore of hyperbole. It is safe to say the food was incredible, sometime surprisingly so. I'm not normally a fan of raw tuna, but here the flavour was exquisite. The wine was of a high standard with two outstanding exceptions and another disappointing exception (which turned out to be from my home town). Although with 8 glasses over 10 courses it was too much and we had to leave nearly half. The staff were friendly but to the point and never instrusive. Overall, the meal was verging on perfection. The main negative point was the expense - oh my lord the expense. It is by far the most expensive meal I've ever had by a long way. About 50% more expensive than Hakkasan, which I thought was expensive. For the cost of this meal for two, you could feed eleven at The Sportsman. Having said that, I'm glad to have been once, just not sure I could justify another visit before I win the Lotto jackpot. If this is what two Michelin stars is like, how much better can three be?
Babur is an Indian restuaurant in Forest Hill (about 15 minutes walk from where I live) which recently won an award. I thought it was the "Best Cheap Eat in South London", but I'm told that's not right, and if it is correct then it must only just qualify on the price criteria (to my mind it's at the high end of cheap - £60 for two, with beer but no wine or dessert). Their takeaway menu is very good so we went for a sitdown meal. The food was excellent. I had the ostrich starter with tandoori jumbo prawns (the largest prawns I have seen in Britain), it was mouthwatering and satisfying in the way good curry can be. Based on the food alone, this would be one of my favourites. However, I found the service a little lacking. Our naan was forgotten, but when pointed out it was removed from the bill with no hassle. Also they tried to sell us a loyalty card a little too strongly. At first I was interested, but after a quick calculation realised it wouldn't be much use to us. We politely refused. So far no problem. However, they then proceeded to try selling it to us a further two times, each time explaining to us the "benefits" in full as if we hadn't grasped the system the first time. I wasn't impressed. Overall, despite the hassle it's worth a visit.
I wanted a project to allow attachments to be added to tasks. My requirements were that: users should be able to add multiple attachments to a task up to some maximum limit; there should be validation on the size of the attachments (combined with the number limit this should ensure I don't run out of disk space too fast); and, that there should be some security on downloading a task's attachments. Paperclip seems to be the popular Rails attachment at the moment and is still under active development, so I hoped to use that. However, it does not handle multiple attachments for a model. There is a plugin PaperclipPolymorph which adds multiple attachments to Paperclip, but I just couldn't get it to meet my validation and security requirements. In the end I wrote my own solution and this article details it.
Earlier I wrote a post on Companies of which I am not a customer. I thought it would be a good idea to give the much shorter list of companies of which I'm very appreciative. These are companies that have done the right thing by me even when there was no need for them to do so.
I recently had a problem with a service for which I paid a monthly fee. My faith in the providing firm's ability to provide the service was destroyed. I cancelled the service and thought about adding the firm to my list. "What list?" I hear you ask. The list of companies of which I have been a paying customer, but will never be a customer again. In the end I decided not to add them, they were helpful is sorting things out and cancelling the service. Plus, they have other services I would still consider.
In any case I thought it would be good to display my list. I won't add links or describe the circumstances of them being added. I don't want to provide free advertising, nor fall foul of British libel laws.
Companies of which I have been a paying customer, but will never be a customer again
- Hurford Salvi Carr Real Estate
- Kempton Azzopardi Real Estate
- Rossen Real Estate
- 3 sixty Contractor Solutions
- British Gas
- Holmes Place Gyms (now Virgin Gyms)
Just to show I'm not always gloomy, I'll write another post with the companies I am very happy to be a customer.