but the kitties don’t love me
Yes, Casper would rather be with the reindeer than inside in the warm with me. Possibly because we made Misty wear a Santa hat yesterday.
Yes, Casper would rather be with the reindeer than inside in the warm with me. Possibly because we made Misty wear a Santa hat yesterday.
As it gets closer to going home, there comes a point where I start making mental countdowns in my head and lock myself away in an attempt to speed time up. Unfortunately, I started that process last weekend, and I still have another five days until I go to the airport. And I’ve been packed since Tuesday (and I’m not kidding: I have to put my Advent Calendar in the case on Friday morning, but that’s about it). So, er, to everybody I’ve essentially disappeared from in the past fortnight: sorry.
(I have just discovered that X-COM: Enemy Unknown is now out for the iPad too, so that’s not going to help one bit, really. Though at least I know what I’m doing on the plane home to the UK now!)
Next update: hopefully from Oxfordshire. Are We Festive? has cleared 100k tweets, though I’m wondering if I should add some additional keywords to the tweet filter in the next few days to see how festive things can get…
This is mainly a warning to all those currently residing in the Colonies, but if you are travelling abroad, it could be a vital piece of information. Consider this photograph:
Yes, it looks like a bottle of HP Sauce. But there’s something odd about it. The layout is wrong, the label is the wrong shade of blue, and it is labelled ‘Steak Sauce’ in an attempt to gesture that it may be used as a substitute to a product on these shores known as A1.
You may ask yourself: well, it’s still HP Sauce, isn’t it? What could possibly go wrong?
Dear Reader, I once thought the same as you, standing in the middle of a supermarket, mourning the lack of dark chocolate digestive biscuits. And I thought, ‘it has just been relabelled, surely.’ It went into my basket, and then into the fridge, until later that weekend it was pressed into service for a bacon sandwich. A typical task that HP Sauce excels at (there will be no digression into Daddies’ sauce here).
The first bite.
Instead of the sour taste of classic HP, I was hit with a sense of sweetness that made my teeth itch. The rest of the sandwich was consumed with increasing resentment as the cloying sugar taste spread across the bread and the pointless sacrifice of crisp bacon. I attempted to seal the accursed bottle up, but as the cap is half the height of the proper version and about a quarter of the weight, it ended up flying across the kitchen, leaving a trail of sweet brown ooze as it skipped along the tile.
Incensed, I looked at the ingredients, contrasting it with the empty UK bottle I was about to throw out:
UK: Tomatoes, Malt vinegar, molasses, high fructose corn syrup, spirit vinegar, sugar, dates, modified cornflour, rye flour, salt, spices, flavourings, tamarind.
US/Canada: White vinegar, high fructose corn syrup, tomato puree, molasses, dates, orange juice concentrate, spices, onion, tamarind concentrate, apple juice concentrate, garlic, ground chili peppers, caramel color (sic), mustard flour
Well, that explains things, doesn’t it.
To sum up: DO NOT TRUST THE COLONIALS. ONLY PURCHASE VERIFIABLY AUTHENTIC BROWN SAUCE.
Thank goodness for returning home next week so I can stock up on supplies. Including digestives.
The idea came from me thinking how I was going to wind my sister up this year. I like amping up my FESTIVENESS every year, and I’ve only got worse since I left the UK. Now, I’ll be back in BIcester in a few weeks, and I have a few extra surprises to come, but I thought I would construct something that would show Bonnie that the world is quite festive and she should let go of her inner grinch. And a website would be just the thing!
Behind the scenes, it’s pretty simple. I’m hooking into the Twitter Streaming API, tracking every mention of ‘Christmas’ and sending a few bits of information from the tweet into a Kafka cluster. After that, I have a few scripts that run the tweets through a sentiment analyzer, classify them according to date, and produce daily and total sentiment averages. Everything then gets sent to Redis to be pulled out by a simple Sinatra server for the webpage.
Said webpage is a smattering of D3.js to create the two gauges displaying the averages, along with a simple polling function to update the page with the latest information. Plus snowflakes!
It didn’t take too long to put together, which is good, as I’ve found myself pretty busy these past few weeks. Everything got assembled as Docker images, which meant developing and uploading to AWS was a breeze (no fun surprises between development and production!). Sadly, I didn’t have enough time for all my original plans, so I had to drop my idea of having a world map and populating it with regional data, allowing us to see the most festive country as Advent unfolds. But that, along with a re-write of the processing logic in either Storm or Samza, could be a project for next year!
Meanwhile, Bonnie’s response after being sent to the website:
You need help.
She might be right.
No blog last week, but I can highly recommend John Wick when it finally reaches your local cinema. The age-old story of ex-hitman loses wife and puppy and then goes on a mad killing spree, interspersed with members of The Wire and Lovejoy. Because who doesn’t like Lovejoy? We laughed out loud at the sheer ridiculousness many times. You’re probably going to have more fun with this rather than Interstellar, that’s all I’m saying.
As for this week, it was Thanksgiving! Which means I have to repost this, especially since Krugman was lax this year and just kept on talking about economics:
Having got that out of the way, I had a great time; this year I headed down to South Carolina to spend the holiday with Tammy, Robert, and all their family (well, children and parents anyhow!). I helped cook my first turkey, used a proper blowtorch to make s’mores (hurrah for the Searzall!), and even though I left half of my equipment (and ice-cream!) sitting on the counter in Durham, I think we had a good time. I also made a dessert with carrageenan that didn’t cause revulsion and terror! (actually, the deconstructed pumpkin pie turned out pretty well, despite leaving the Vita-Mix at home - the maple flaky crust was pretty tasty, and the pumpkin domes held up well…)
Oh, and I saw Turbo. Strangely, it probably had stronger characterization than John Wick, though was less fun overall due to fewer bouts of random violence. And no Ian McShane. Maybe Turbo 2: Turbo Harder, Faster, Stronger! will have a spot for a larger, swearing, British snail. Maybe.
It was good not spending the holiday alone, and great to be with friends, but being around a close family did make me miss mine a little. Happily, it’s less than three weeks until I fly home to the UK! There, I will buy ALL THE MALTEASERS SPREAD that exists. Oh yes.
Tomorrow, you might even get another blog entry. You’re spoiled! Yes you are!
Look at these people. Enjoying themselves, throwing away all that tea.
All I can hope is that it was Lipton. AND ONE DAY WE WILL COME FOR OUR BACK TAXES, COLONIALS.
Anyway, this might be my last week coming up to Boston, and it’s certainly my last visit of 2014, so I thought I would stay an extra day and get to wander around the city during the day-time (which I last did in February). 15 miles of walking later, my feet are regretting that decision. Still, I wandered around the tourist haunts that I last saw over a decade ago - Quincy Market, the Freedom Trail, various bits of MIT and Harvard, lots of different parts of the T (this time, I think I got a full set of colours!), along with a bizarre visit to Pret A Manger in downtown.
(it’s a bit pared-down from a UK Pret, and the Christmas Sandwich has suffered the twin heresy of being renamed the Holiday Lunch and having all the Proper British Stuffing replaced with American cornbread stuffing and turkey ‘gravy’. On the other hand, they do sell bacon mac ’n’ cheese)
Somewhere around mile 8 or 9, after wandering around an interesting five-level vintage market where the building shook constantly from the building outside (smashing several glass shelves as I was walking along!), my feet decided that they were not entirely happy with the day’s planned activities, especially seeing that I was still several miles away from where I was staying. Eventually, I made it back to the T, and had a quiet evening around Harvard Square and an Indian restaurant in Somerville.
Today, I’m back in Waltham, and for some reason, I’ve been given a suite! Not one, but two TVs! Couches, glass bricks dividing it into two rooms, and all sorts of fancy things. It’s a bit wasted on me this week, but hey, if anybody wants a party in Waltham, I appear to have a venue!
A new experience on being a home owner; coming back to the house and finding this noticed stapled (yes, stapled) to the house:
This…was new. My favourite part of the notice is that it points to the part of city byelaws that you’re violating…but not exactly what you’ve done wrong. Plus, you have ten days to fix it after the sign is posted, but the letter that gets sent out that actually explains what’s wrong didn’t turn up for a week.
Thankfully, I was embarrassed enough that I phoned the City as soon as I found the notice, but couldn’t get through to the correct person until the next morning. Apparently, the bushes at the end of my garden were getting in the way of the recently-moved bus stop and were blocking the path. Now, I had idly planned to take a saw to various trees over Winter after the leaves were gone. But I had not ventured down to the back of the garden in a little while (I’ve been away, and hey, it’s not as if there’s anything useful down there); one brief look last Thursday made it clear that the City wasn’t really kidding; my bushes had grown wildly over the summer.
This is all a buried lede to: Ian does gardening for almost the first time ever. This involved going to Lowe’s and texting pictures of various items to people to make sure I was buying the correct thing (I almost bought a few oddities, so it was wise to check with people who had more of a clue than I did), and then getting up at the ungodly hour of 8am on a Saturday morning. It’s been a while since I did that on purpose.
I had some help, so it wasn’t just me lopping over big bits of tree. By the early afternoon, not only could I see the bus stop from the house’s windows, but I could also see into the next-door neighbour’s garden, which I don’t think was possible even when I bought the house last year. Success! Except for the piles of branches all over the garden. Anybody fancy a bonfire?
A bit of an embarrassing episode, but the pavement is now mostly clear, and no over-hanging bushes causing problems for people waiting for the bus, which is a good thing! I do really need to come up for a plan for what to do in the back garden; this year it has suffered from quite a bit of neglect, and I’d like to clear out all the spreading vines and pallets that I’ve inherited. It’ll give Bonnie room for her intended Huf Haus, obviously.
I have now seen Catching Fire, despite not having seen or read the first book / film of The Hunger Games. All I can really take away from it is that I enjoyed macarons being used as a signifier of depravity, indifferent evil, and excess. That’s the moral the writers were trying to convey, I’m certain. There might have been some other bits with revolution and mockingjays, but trust me, it’s all about the macarons.
Today has not been a great day. Hopefully, November will get better.
Monkey-patching. It strikes fear into newcomers to Ruby, excitement and abandon in moderate Ruby developers, and sad, disgruntled sighs from the experienced developers who end up having to wade through a huge Rails codebase to find out where somebody decided to monkey-patch the
mysql2 gem in a way that makes it incompatible with a Rails 4 upgrade (bonus points for hiding the patch in something like
(bitter tears of experience here)
But hark! Ruby 2.1 is here, and may contain some salvation in the form of refinements. First, though, a refresher.
Monkey-patching in Ruby involves modifying code at run-time, either by extending and providing additional functionality or redefining existing code. And Ruby makes it so easy! Consider this little gem:
class String def all_is_love ‘❤’ * self.length end end
This extends String with the method
pry(main)> 'hello'.all_is_love => "❤❤❤❤❤”
This is how large chunks of the Rails helper methods (e.g.
:camelize) are implemented. And this is fine…except due to the Magic of Ruby, you can do this pretty much anywhere in your code. And you can do this as well:
class String def length 2 end end pry(main)> 'hello’.length => 2
Just to give you an idea of the systemic breakdown this can create, let’s go back to our earlier method:
Again, there are sometimes reasons why you have to monkey-patch and replace methods at runtime. Perhaps your database connection has some legacy weirdness that needs to be worked around and it isn’t covered by a standard gem (this is a code smell, obviously, but sometimes it has to be done). Being able to do this at-will in a large code-base, however, can easily lead to problems. Maybe you do your patch in an obscure area of the code, and a new developer writes a method that uses the _expected_ behaviour, and then spends a day or so trying to work out why her code isn’t working correctly. Or even worse, somebody decides to write another monkey-patch on the same method, meaning that the behaviour in production becomes a Fun Race Condition That Wakes You Up At 3am depending on which one is executed by Ruby first. The real answer is Don’t Monkey-Patch, and enforce it with hammers. But sometimes it’s not possible to avoid that monkey. Thankfully, Ruby 2 delivers a way of at least limiting the scope of patches with _Refinements_.
pry(main)> 'hello'.all_is_love =>"❤❤”
module WithAMonocle refine String do def all_is_love '❤' * self.length end end end
Module#refine takes a class and a block, and in that block, you can extend or redefine to your heart’s content. But:
pry(main)> 'hello’.all_is_love NoMethodError: undefined method `all_is_love’ for "hello":String
Refinements need to be specifically activated with the
using WithAMonocle puts ‘hello’.all_is_love => "❤❤❤❤❤”
Okay, so far, much the same as normal monkey-patching. But the magic is that the patch only exists in that scope. So if we embed them in a Class, the refinement only exists within that class. For example:
class SplendidMonkey using WithAMonocle puts 'fff’.all_is_love end ❤❤❤ => nil class UncouthMonkey puts 'fff’.all_is_love end => NoMethodError: undefined method `all_is_love’ for "fff":String
The monkey-patch is restricted to the class where it is activated. As you can imagine, this is all sorts of useful - not only do you not pollute the global scope with your redefinitions or extensions, but you also make it explicit that you’re using that particular patch (and also providing a giant big clue where the patch is defined).
So, still, don’t go crazy with your monkey-patching, but, if you have to use them (and you’re running on a current Ruby 2.1.x version), consider using refinements as a way to limit their problematic features…
(however, do be aware that there are a few odd things that may bite you if you’re not paying attention. In particular:
module WithAShortMonocle refine String do HEART_LENGTH = 1 def all_is_love '❤' * HEART_LENGTH end end end
Constants and class variables within a refinement belong to the module, not the class being refined:
pry(main)> String::HEART_LENGTH NameError: uninitialized constant String::HEART_LENGTH pry(main)> WithAShortMonocle::HEART_LENGTH => 1
So be aware of that when adding your refinements)
This week I seem to have spent a lot of time ill, and a lot of time in Raleigh. Good to see the Reverbnation team again during All Things Open, though it would have been better if I hadn’t been feeling quite so ill.
In other discoveries this week: pickling red onions in orange and lime juice is actually quite tasty…