Please enter your login details.

Accessing SpeedFan Data From Python
(Tuesday 27th of May 2014 04:29:46 PM) (1116 views) (0 comments)
I was recently looking into creating a small fan controller script and needed to get reliable access to the current CPU temperature. After a bit of research I came up with the following code that takes advantage of data published (via shared memory) by the popular SpeedFan program..

from ctypes import * import mmap class SFMemory(Structure): _pack_ = 1 _fields_ = [ ('version', c_short), ('flags', c_short), ('MemSize', c_int), ('handle', c_int), ('NumTemps', c_short), ('NumFans', c_short), ('NumVolts', c_short), ('temps', c_int*32), ('fans', c_int*32), ('volts', c_int*32), ] # Open the shared memory area that contains the SpeedFan data.. size = sizeof(SFMemory) buf = mmap.mmap(0, size, "SFSharedMemory_ALM", mmap.ACCESS_READ) # Read the memory area and cast to our custom ctypes struct.. mem = sfm = cast(mem, POINTER(SFMemory)).contents # Check the header details.. print "Version: %u Flags: %u, MemSize: %u, Handle: 0x%08X" % (sfm.version, sfm.flags, sfm.MemSize, sfm.handle) assert(sfm.version == 1) assert(sfm.MemSize == size) # Process the data into a friendly form.. temps = map(lambda t: t / 100.0, sfm.temps[:sfm.NumTemps]) fans = map(lambda t: t,[:sfm.NumFans]) volts = map(lambda t: t / 100.0, sfm.volts[:sfm.NumVolts]) # Print out the values.. print "Temps: " + str(temps) print "Fans: " + str(fans) print "Volts: " + str(volts)

One obvious issue here is that SpeedFan doesn't tell us which values are associated with which bits of hardware so you'll likely have to customise anything you do with this to the current machine.

Anyway, feel free to use this for whatever you like.


Planetary Annihilation - Crash Debug
(Wednesday 1st of January 2014 12:40:01 PM) (5827 views) (0 comments)

I recently received a copy of PA as a Christmas present and was disappointed when it wouldn't last more than a few minutes into a game. This post is intended to provide additional info to the Steam forum thread

Steps to reproduce..

  1. Start a normal game against the AI.
  2. Selecting starting location.
  3. Cause an unexpected loss of network connection.

Originally the loss of network was being caused by my temperamental NetGear powerline adapter resetting itself. However, you can get the same crash by simply pulling the network cable out the back of the PC

So the solution to my problem was to fix my powerline adapter issue. However, loss of network is something that a game like this should be able to handle without crashing. Here's all the debug info I was able to gather..


Numby - For Android
(Saturday 19th of October 2013 03:32:30 PM) (926 views) (0 comments)

My very fist Android app has just gone live on Google Play. Numby is a simple little maths game that challenges you to create equations that hit target numbers. You do so by dragging you finger across a grid of numbers and operators.

As a first attempt at Android I'm hoping it's not too bad. So far during play-testing it's been a good distraction game for playing on the train or during a coffee break. Hopefully someone out there will like it. Of course, it should help that it's completely free


Wallpapering the void..
(Tuesday 20th of August 2013 02:13:47 PM) (1453 views) (0 comments)

Every now and again I get bored with whatever is currently peeking out from behind the clutter of applications and icons on my desktop. For a while I've been selecting stuff from the excellent collection of beautiful images by Ryan Geiss but now I'm bored. I've used up all the ones I like and now I should endeavour to make some of my own


Displaying a favicon in HTML
(Monday 15th of October 2012 09:50:17 AM) (4554 views) (0 comments)
Reliably displaying favicons in HTML (and a little javascript) is really easy! Most websites simply store the their icon at the root of the website. So for example looks like this "". However for IPlayer the BBC store the favicon in the page directory. So that's and looks like this "".

So for sites like IPlayer we need to fall-back to the site root icon but only after trying the page directory first. Unfortunately the HTML <img> tag doesn't have any way of doing this without a little help from javascript. Here's how..

<img src="" onerror='this.onerror = null; this.src=""'> </img>

Easy, right?!


Older. Newer.
Copyright © 2011 Christopher James Plant Page generated in 0.031 seconds using 15 database queries. Style & Emoticons: "Default" by Kaloth
Icons: "Small Icons" by WendellVerli