Posts Tagged ‘mysql’

A daily CurrentCost “bill”

Wednesday, May 28th, 2008

As I’ve finally got my home server capturing the electric meter readings from the CurrentCost, I thought it’d be good to try doing something with it.

I want to start with something a bit different to graphs, because there’s already been a lot of cool work done in different graphing approaches.

As I wrote yesterday, I’ve got a MySQL database that is storing the watt reading from the electric meter captured once every six seconds.

I wondered whether it makes sense to try and turn these figures into a financial cost. It might be interesting (and useful as a behaviour-altering thing) if we could get a “bill” from the CurrentCost meter each day that told us how much we spent on electricity the last day.

+=============================================+
  Your CurrentCost bill for 2008-5-27

     Electricity usage   4.9802 units
      Cost ==           £0.4874

     Standing charge    £0.1582
   ---------------------------------------
     TOTAL COST FOR 2008-5-27 : £  0.65
+=============================================+

I’m not entirely sure of my maths here, but I thought it could be interesting to give it a try.

(more…)

Accessing MySQL from Perl on SlugOS

Tuesday, May 27th, 2008

I’ve written about my CurrentCost meter that I’m using to monitor my home electricity usage, and the small home server that I’ve set up to collect the data.

Yesterday, I decided to make a start on collecting the data. My plan was to copy what Nick had done and create a MySQL database to store the info, with a table to store a timestamp and the watt reading from the CurrentCost meter.

CREATE TABLE currentcostdl (  
    time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,  
    power FLOAT NOT NULL,  
    primary key(time));

I started with Nick’s Python scripts, but didn’t get very far.

The server, a NSLU-2 (or “slug”) is running SlugOS.

The problem was that there is no python-mysqldb package in the SlugOS repositories. I did try downloading the source for it from sourceforge to build it myself, but struggled to get the dependencies I needed to make it – urllib in particular was a big pain.

I also tried the debian package but again dependencies on SlugOS got in the way.

So I gave up on that and decided to do it myself using Perl – Perl and MySQL had to be easier, right?

Erm… not so much 🙂

(more…)

HackDay – writing a Twitter dictionary

Sunday, April 27th, 2008

As I said on Friday, Friday was IBM Hackday 5. I didn’t really explain what HackDay is, but if you’re not familiar with it, Kelly has posted a good description.

I made all my excuses in my last post, so with them out of the way, here is my hack.

The idea is an old one – but I’ll summarise it again here.

The hack was to extend the twitter.com website to provide additional context for people’s tweets.

Every twitter user can maintain their own personal dictionary of terms, that describe their personal significance when they use them in tweets. When one of these terms is used in a tweet, it is highlighted in some way, and if the user hovers their mouse over them, the full description is shown in a pop-up.

For example, my twitter dictionary might include entries like:

  • Grace – my three-year old daughter
  • Faith – my baby girl
  • Hursley – IBM Hursley Park, the site where I work
  • SYA – a youth charity that I started and am now on the board of trustees for

an example - screenshot of my hack in action

The idea isn’t to say what something means (why try and replace people’s ability to use Google?) but to say what it means to the tweeter.

Other uses could include to provide ‘disclosure’. For example, when I see posts by James Governor, I often see a few lines at the end such as:

…IBM is a client. RedMonk runs Google Docs. Google and Salesforce are not clients. We don’t currently use Salesforce apps…

But in the twitter world where thoughts fit into 140 characters, there isn’t the space to include this sort of context with every tweet. So James’ twitter glossary might include entries like:

  • IBM – IBM is a client

(more…)

I.T. infrastructure for a growing charity… revisited

Monday, November 5th, 2007

I blogged back in the summer when I was starting to think about overhauling the I.T. infrastructure for my youth charity, Solent Youth Action. But I never actually came back to this to say what I went with in the end.

You can see the original post to see what we started with, but in short, it was fairly primitive.

I don’t think that we’re really finished yet, but here is where I’ve got to so far…

(more…)