## An (Incomplete) Experiment with Sensors

January 29, 2013

When you have lm-sensors installed on Linux, you can invoke sensors to list all detected sensors and their states. While it is generally of mild interest except when you suspect that something’s wrong with your box—or, more precisely, when you want to make sure something doesn’t go wrong.

Amongst the sensors, there are temperature sensors that gives you information about the chipset and CPU. You can also find out about fan speeds. So I wondered if could use the sensors to see if there’s a significant difference between when the computer is idle and when I am using it. I thought I could, maybe, also see temperature differences between day and night.

## Piri-Piri Jelli

January 22, 2013

And now, for something entirely different: Piri-Piri Jelly.

## Damn you, Napier!

January 15, 2013

Briggs‘ logarithms (often mistakenly understood to be Napier‘s logarithms) is such an useful function that most of us don’t really think about it, until we have to. Everyone’s familiar with its properties:

$\displaystyle\log_b a = \frac{\log a}{\log b}$

$\log b^x = x \log b$

$\log a b = \log a + \log b$ (1)

$\displaystyle\log \frac{a}{b} = \log a - \log b$

but suddenly,

$\log (a+b) = ?$

What can we do with this last one?

## Python Memory Management (Part II)

January 8, 2013

Last week we had a look at how much memory basic Python objects use. This week, we will discuss how Python manages its memory internally, and why it goes wrong if you’re not careful.

To speed-up memory allocation (and reuse) Python uses a number of lists for small objects. Each list will contain objects of similar size: there will be a list for objects 1 to 8 bytes in size, one for 9 to 16, etc. When a small object needs to be created, either we reuse a free block in the list, or we allocate a new one.

## Python Memory Management (Part I)

January 1, 2013

[This is a piece I initially wrote while at the LISA at U de M, for the newbie coders in the lab.]

One of the major challenges in writing (somewhat) large-scale Python programs, is to keep memory usage at a minimum. However, managing memory in Python is easy—if you just don’t care. Python allocates memory transparently, manages objects using a reference count system, and frees memory when an object’s reference count falls to zero. In theory, it’s swell. In practice, you need to know a few things about Python memory management to get a memory-efficient program running. One of the things you should know, or at least get a good feel about, is the sizes of basic Python objects. Another thing is how Python manages its memory internally.

So let us begin with the size of basic objects. In Python, there’s not a lot of primitive data types: there are ints, longs (an unlimited precision version of int), floats (which are doubles), tuples, strings, lists, dictionaries, and classes.

## I’m back.

January 1, 2013

So fall has been somewhat busy for me. I moved, got a new job (as a professor at UQàR), but pretty much everything is fine now. I’ve got a nice house with a view that I rent; it’s smallish but comfy.

Well, anyway. I write to say that I will resume my blogging, posting every tuesday morning, as I used to. Starting today.