mindfieldz

Inside the mind of a geeky learning technologist

April 10, 2014
by Ben
0 comments

Kickstarts, Greenlights, and Pre-Orders

I’ve been on a bit of a crowdfunding bender in 2013, having backed 14 projects on Kickstarter alone. I’m going to put some time aside to blog about each of these, but for now I thought I’d list them to give you an idea of upcoming posts.

Kickstarter:

Greenlight, Early Access:

Pre-order:

Finally, there some other projects that I’ve either missed on Kickstarter, or are yet to be released by one of the above channels.

April 4, 2014
by Ben
0 comments

1601 Gregorian Epoch, unixtime, and MS SQL

A small part of my day job involves writing and maintaining integrations between third-party e-learning tools and our bespoke student record system. Often, this involves digging through documentation and discussion forums, working out which bits of the API and database we need, and writing something which mashes things together in a semi-successful manner.

Recently, I’ve been working with a software package which consists of a central server and a number of remote machines. The web UI for this software shows us when a remote machine was last active, and we can use this to determine whether there are any problems, but frustratingly the SOAP API doesn’t expose this information. After digging around in the database I discovered a potential candidate, a table called RemoteRecorder with a column entitled LastCheckin. At this point I would normally think ‘Mission Accomplished’ and be done with it. But annoyingly the LastCheckin column stored its information as a float value instead of a datetime (eg. 13034058916.8232, not 2013/12/24 09:00).

Seeing a date in this manner is usually indicative that it is stored in unixtime format, which is the number of seconds elapsed since 1st January 1970, and is fairly trivial to convert into a readable datetime. However, in this instance, the conversion SQL failed with a cast error and an overflow error. Plugging the date into an online unixtime converter yielded a date which was very close to what we expected, but approximately 370 years into the future (January 13th 2383, 03:55:16). More interestingly, it ignored the decimal part of the timestamp (0.8263).

So, what’s so important about the 369 year difference between 2083 (from the problematic unixtime, above), and 2014? Well, the timestamp above looks very similar to a unixtime value, only it’s 369 years into the future and has a decimal component. Subtracting 369 from the 1970 unixtime epoch yields 1601; the start of the Gregorian calendar, and according to Wikipedia, the epoch date for Microsoft Windows. Helpfully, Wikipedia also tells us that the decimal component is merely the number of milliseconds in the timestamp; which can safely be ignored (which is fortunate, since the MSSQL DATEADD method can only cope with integer values).

So, going back to the original problem, how do you convert a float value into a usable datetime? In MSSQL, you can use the following:

SELECT LastCheckin, DATEADD(second, (CAST(LastCheckin as BIGINT) - 11644473600),{d '1970-01-01'})
FROM RemoteRecorder

Breaking this down into its component parts:

  • CAST(LastCheckin as BIGINT) – strips off the decimal component, so 13034058916.8232 becomes 13034058916, and suitable for the DATEADD operation.
  • - 11644473600 - strips 369 years’ worth of seconds from our above datestamp, increasing it from 1701 to 1970, at this point our datestamp is effectively a unixtime stamp
  • DATEADD(second, …, {d, ’1970-01-01′}) converts our now unixtime stamp to a date and time that we humans understand

That’s it.

December 30, 2013
by Ben
0 comments

Four for 2014

I suck at sticking to new year’s resolutions. I always get to mid February or March, hit a bump in the road, and then write off the resolution for the rest of the year. It’s probably a mix of laziness and a lack of will power; alongside more interesting things to do instead, such as drinking and playing computer games.

This year I am going to try a different approach. Rather than one or two big resolutions, I’m going to have four areas for improvement. It won’t matter if I miss a day here or there, but I want to be able to look back on the majority of 2014 and say that I made progress.

The four areas are:

  1. Be healthier:
    • Eat less sugary and fatty things;
    • Drink less alcohol and sodas;
    • Start running again;
    • Start general strength training (weights, sit-ups, press-ups, etc.);
    • Secret;
  2. Be sensible with money:
    • Spend less money on computer games;
    • Spend less money on other frivolities (eg. drinking);
    • Pay off credit card and other debts;
  3. Work smarter and harder (both at work and home):
    • Take more photos and make more blog posts);
    • Revisit and complete some of the long-overdue projects;
  4. Put a bit more effort in at home:
    • Take out bins more often;
    • Fill dish washer more often;
    • Secret;
    • Secret;

Coincidentally, the list in whole is 14 items. Anyway, roll on 2014.

December 16, 2013
by Ben
0 comments

Lack of updates…

I admit, this was meant to be a fresh start for my blog. I honestly started out with good intentions, but looking back at my posts over the past 12 months it looks as full as Rolf Harris’ agenda for 2014.

Anyway, I’ve been thinking about a few ideas for posts, and I’ll endeavour to get these written and published over the next few months. I’m not promising anything, but it’ll at least make the site look a little less bare.

May 3, 2012
by Ben
0 comments

This week, I have been mostly watching Geek and Sundry.

There is something very odd about seeing a grown-up Will Wheaton playing TableTop games; in my head, he’s still about 15 and on the Enterprise bridge (TNG). The Flog is also worth a watch to see all the gaming and meme references.

March 4, 2012
by Ben
0 comments

I’ve taken the opportunity to move this site over to my other domain, hopefully links and things will still work.

February 14, 2012
by Ben
1 Comment

Downloadable Content (DLC)

This post is a rant, I warn you now, it’s not going to be pretty. It’s part-based in a dilemma I face this month, as I do a few times every year: Should I pre-order game X? I know what you’re thinking, if I pre-order, I’ll get my game of choice on release day (or soon after, thank you Royal Mail), and I can eagerly play to my heart’s content. However, this isn’t so much of an issue for me, because:

  1. I mostly download games through the likes of Steam, no need to wait for postie;
  2. I have a 50Mb internet connection (soon to be 100Mbit, thank you Virgin Media)

So, my dilemma isn’t: Should I pre-order this so that I can get it on release day? No, my dilemma is: Should I pre-order this so that I can get the pre-order DownLoadable Content (DLC)?

Continue Reading →

January 13, 2012
by Ben
0 comments

Fixing your Moodle statistics

Moodle statistics are great. Personally, every October, I scream like a schoolgirl and wave the most recent statistics graph at my colleagues whilst shouting at how all the numbers are bigger. However, it seems that on busier servers, especially one like ours with 700,000 actions in one month, Moodle can easily fall behind.

For the past three months, since October 2011, our Moodle serve hasn’t been compiling statistics.

I can’t fully demonstrate the symptoms here, as I only decided to write this blog post after I had fixed things. But if you look at the graph below, you’ll see an earlier month where statistics also failed. 1st April 2011 has no actions logged.

Moodle statistics

Example Moodle statistics

This fix works on Moodle 1.9.3+, it should also work on Moodle 2.0 but some of the lines might be slightly different. YMMV

So… how to fix it… well… Continue Reading →

January 12, 2012
by Ben
0 comments

Fresh start

My existing blog was getting a bit irregular and out of date, both in terms of content and plugins/designs.

I’ve decided on a bit of a fresh start, partly driven by the new blogs of my colleagues (see links), but also driven by the new year.

Hopefully, this attempt will be a bit more regular.