Enums are a way of encoding a set of ordinal values in a type system. That is, they formalise the notion that a value may be one of a small set of specific values. We’ve had them since at least the 1970s. They’re really useful. So why might they not always be the right tool?
When your application is based on Spring it makes a lot of sense to fire up
a Spring context within your integration tests and functional tests.
For a particular Scala-based project it was necessary to manage not only the
lifetime of the Spring context, but also the lifetime of an annotation-based REST library component called Jersey, which works together with Spring.
I did the Coursera Natural Language Processing course at the beginning of the year. Apart from the introduction to probability it gave me, the thing that sticks most in my mind comes from one of the exercises. In the exercise we had to define a probabilistic parser to parse (an extremely limited subset of) English. That’s not the fun bit though. The fun bit was using the information in the parser to generate “English” sentences. The idea of a grammar generating sentences is right in the standard way of defining languages, but for some reason it hadn’t occured to me to actually build such a thing.
The idea’s simple enough: complicated parsers (language generators) are made up of simpler parsers (language generators) until you hit trivial parsers (language generators).
Of course we don’t want just one sentence, so it makes sense to build streams (we’ll use my favourite stream implementation, Xtreams) so that we may – if desired – generate as many different sentences as we’d like.
I had hoped Nate Silver was going to announce explicitly that this was his final pre-election prediction, but less than three and a half hours to go before the first polls close, I think there’s not much time to make another one. I’ve updated the battleground chart with his predictions, and I’ll update it as polls are called until I fall asleep. Let me know if you find this useful – it’s certainly the only way I can tell what it means when they call a state!
I’m currently documenting an application that uses RabbitMQ extensively. I want to show the routing topology within the broker, but I want the bulk generated automatically because there are a lot of entities to deal with. Given that I can export the broker definitions into JSON, it seemed like it would be fairly straightforward to generate something using Graphviz.
You are currently browsing the LShift Ltd. blog archives for November, 2012.