Has today been a good day?

April 16th, 2012

Last week, I came up with a quick hack, explained quite neatly by @crouchingbadger:

It was a bit of fun, even if it did seem to convince a group of commenters on engadget that I was a rage-fuelled XBox gamer. 🙂

There’s one big limitation with the hack, though: I don’t spend that much of my day in front of the TV.

It’s interesting to use it to measure my reactions to specific TV programmes or games. But thinking bigger, it’d be cool to try a hack that monitors me throughout the day to measure what kind of day I’m having.

I don’t spend much time in front of the TV, but I do spend a *lot* of time in front of my Macbook. And it has a camera, too!

What if my MacBook could look out for my face, and whenever it can see it, monitor what facial expression I have and whether I’m smiling? And while I’m at it, as I’ve been playing with sentiment analysis recently, add in whether the tweets I post sound positive or neutral.

Add that together, and could I make a reasonable automated estimate as to whether I’m having a good day?

Read the rest of this entry »

fitbit – a source of personal data

April 12th, 2012

A month ago I got a Fitbit Ultra. It’s a small gadget that you carry around with you all the time to monitor your activity. How many steps you take, how many flights of stairs you go up, how far you walk, how much sleep you get and how restful it is, and much more. It also comes with apps and tools for monitoring stuff like diet and weight. And it makes all of this information available to you, both through a website and through an API.

This isn’t really a review – there are plenty of those about already if you’re interested (Of all the reviews I’ve read, The Verge’s review is the closest to what I would write if I was gonna write one). Instead, I want to talk about the fitbit from the perspective of a data-geek.

Before I start, it’s worth putting this in context. I am loving the fitbit, but I don’t pretend that it’s necessarily something you have to get. Put it this way – I used CurrentCosts to monitor my home energy usage on the web and on my mobile, I wrote code to find out which keyboard keys I press most often, I made a whole website to visualise patterns in what I watch on TV, I wrote code to make map visualisations of where I go with my mobile, I wrote code to use a webcam and face recognition software to measure how my mood changes as I watch different TV programmes or play different console games… I could go on (no, really), but you probably get the point.

I find this sort of personal data stuff fascinating. I’m not the only geek in the world like this – Stephen Wolfram wrote a great blog post last month about some of the stuff that he collects that really puts me to shame.

But when I say that I think the fitbit is awesome, just bear in mind where I’m coming from, okay? 🙂

In this post, I want to give examples of the data that it makes available, and what sort of things you can do with it.

Read the rest of this entry »

Something good today

April 10th, 2012

screenshot of my logOne of my New Year’s resolutions this year was to keep a sort of daily log.

I said that once a day I would make a note of something good that happened that day.

Nothing detailed or lengthy. Just a one-line note.

It could be something good that I did at work. Not the usual day job stuff, but something that I did that was different, impressive or notable.

It could be something that I did at home – something with my family that I was pleased with, or that I enjoyed.

I wasn’t sure how I’d approach it when I started.

“Today wasn’t a waste because I…”? Or… “Today was a good day because I…”? Or… “Today was different because I…”? Or… “Today I made a difference by…”?

But I thought I’d start, and see what happened.

A few months later, and not only am I still doing it, but I’m finding it surprisingly rewarding.

Read the rest of this entry »

Smile!

April 3rd, 2012

The visualisations on this page need Flash and Javascript. Apologies if that means most of this page doesn’t work for you!

This is my mood (as identified from my facial expressions) over time while watching Never Mind the Buzzcocks.

The green areas are times where I looked happy.

This shows my mood while playing XBox Live. Badly.

The red areas are times where I looked cross.

I smile more while watching comedies than when getting shot in the head. Shocker, eh?

Read the rest of this entry »

Avoiding my Lucene TooManyClauses exceptions

March 20th, 2012

Before I start, I should point out that I’m not a Lucene expert. This post isn’t a definitive “you should do things this way” commandment from a Lucene mage. Think of it more as “I had this problem, and this seemed to work for me. I’m sharing it in case it helps you, too”.

I’m using Lucene to implement searches. Recently, as my Lucene index has grown (a lot), I was getting a lot of these errors when I tried to do a search:

org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024
    at org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:163)
    at org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:154)
    at org.apache.lucene.search.MultiTermQuery.rewrite(MultiTermQuery.java:63)
    at org.apache.lucene.search.WildcardQuery.rewrite(WildcardQuery.java:54)
    at org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:383)
    at org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:383)
    at org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:162)
    at org.apache.lucene.search.Query.weight(Query.java:94)
    at org.apache.lucene.search.Searcher.createWeight(Searcher.java:185)
    at org.apache.lucene.search.Searcher.search(Searcher.java:86)

I’m guessing that TooManyClauses is a common problem for people getting going with Lucene.

It’s mentioned in the FAQ, and there are a few StackOverflow threads around about it.

But I couldn’t find a straightforward “you need to follow these steps to fix it” post anywhere, so I’ll add my experience here.

Read the rest of this entry »

Face Movies

March 18th, 2012

I’ve been using Picasa to manage my photos of the kids for years.

I noticed in the changelog for the latest version that it now can create chronological “Face Movies”. These are videos of all the photos of a certain person, arranged in order that they were taken, and zoomed, rotated and cropped to line up the face as best as possible between the pictures.

After a little prodding from Tim, I gave it a try.

Here is (nearly) every photo I’ve ever taken of Grace, run through Picasa’s Face Movie.

It takes two-and-a-half minutes, but I think it’s pretty cool. I love how you can watch her face change, and her hair grow over time.

There are settings you can tweak. For example, you can change the frame rate, or get it to filter out photos taken within a specified amount of time of each other. It means you can make shorter versions – I made a video of just some of Grace’s pics that lasts under a minute.

Read the rest of this entry »

A nice memory

March 16th, 2012

I was reminded of this by my Timehop email this morning. (Incidentally, I’m loving Timehop – thanks to Roo for sharing it).

A year ago today, I had a lousy afternoon. I even tweeted about it.

I didn’t share what happened after, although I possibly should have.

Read the rest of this entry »

Migrating from ActiveMQ to WebSphere MQ

March 13th, 2012

Overview

A side-project I’ve been playing with in the evening: Writing a JMX layer to allow apps written for ActiveMQ to migrate to WebSphere MQ with minimal modifications

Background

This came out of working on something that uses a JMS messaging provider. It uses it internally to allow components to communicate with each other, even when spread across multiple machines.

It uses Apache ActiveMQ – an open-sourced implementation of JMS. I wanted to try and get it working using WebSphere MQ – IBM’s implementation of JMS that I used to work on until five years ago.

As a messaging standard, the fact that both ActiveMQ and WebSphere MQ (WMQ) are JMS providers means that the way it puts and gets messages should just work.

But the JMS standard doesn’t cover administration (how queue managers are created and configured, how they’re started, how queues and topics are created, etc.) or monitoring (getting statistics about how many messages have been put or got, how many messages are on a queue, etc.)

All of this was done in an ActiveMQ-specific ways. This was what needed to be ported if I was going to get this to work with WebSphere MQ.

The project I’m porting is actually a bit of a black box. Rather than make a significant rewrite to get it to go from being ActiveMQ-specific to WMQ-specific, I wanted to see what I could add so that as much of the existing code could just work transparently.

I wanted to write a layer to sit between the ActiveMQ-app and WebSphere MQ, so that the app needn’t realise it’s not talking to the ActiveMQ broker it was written for.

Read the rest of this entry »