General

Coming Soon On Noelinho.org...

There has, you may have noticed, been a distinct lack of activity on Noelinho.org over the past couple of months. Thus, I feel I should give a little taster of some of the things you can expect to find on Noelinho.org over the coming couple of months over the Christmas and New Year period:

  • An update on Sassenach CMS, complete with a preview of version 1.0;
  • The long-awaited look at the history of African-American civil rights;
  • A few book reviews of books I have been working through;
  • An update to the Countdown Puzzle Page;
  • A few other Christmas treats may be in store.

Remember...good things come to those who wait.

Politics

The Fallout From Glasgow East

I have, of late, been fairly on-the-mark with my political predictions. When many people predicted, at the start of the Crewe and Nantwich by-election, that Labour could hold the seat, I scoffed at the thought. As the campaign continued, and Labour members realised that winning was not the most likely of possibilities, I predicted a 6,000 majority for the Conservatives. People scoffed. "You're just being pessimistic. It can't be that bad." It wasn't - it was worse.

When David Davies resigned his seat in Haltemprice and Howden, people jumped up to attack Davies as opportunistic, trying to undermine David Cameron, trying to grab attention. They didn't take him seriously. They thought David Davies could be cast as a loony. I saw a man who was standing by his convictions, and those alone. A man who wasn't going to get rolled over. I saw Labour's refusal to stand as a big mistake. I still think it was a big mistake, albeit one that hasn't hurt them as much as it could have - but it will continue to hover in the background.

I knew, in all probability, that Boris Johnson would win the London mayoral elections, although I tried my best to ignore it and convince myself that Ken Livingstone could, like he had many times before, defied the Labour Party - and its electoral fortunes - and snatch victory. But even for Red Ken, that was always going to be one step too far.

In Henley, everyone knew it would be bad. Hardly a "natural" Labour area - but something I'll come back to. The point here, is that these things were all bad for the Labour Party.

A Labour by-election leaflet from Glasgow East

But Glasgow East was different. No-one predicted Glasgow East would go. No Labour people predicted it. No SNP people really seemed to truly believe it would happen, but were certainly confident they would get close. Me? I thought they'd get within, depending upon turnout, of course, 2,000 - 3,000 votes of winning. So, on the election night, I went to bed. There was, after all, nothing interesting to watch or listen to.

Quite some misjugement. The SNP may not have won with a large majority, but they didn't need to. Winning by one vote was enough. It was more than enough. Winning this seat is quite some achievement. The last time the Labour Party didn't win this seat was in the 1945 General Election. Except that doesn't really count. Why? Well, it was won by the Independent Labour Party, which broke away from the Labour Party in 1932. The winner of that seat was someone who originally stood for the Labour Party, broke away with the ILP and then rejoined at the end of the 1940s. Basically, the Labour Party, in their history, with the exception of this rather misleasding exception, have never lost this seat. The SNP have never recorded more than 20% of the vote in the area of Glasgow East.

On Thursday, that was thrown out of the window. Gordon Brown can grit his teeth and say that it was down to Scottish issues, like the lack of a Labour leader in Scotland, but everyone knows that is rubbish. The voters of Glasgow East don't care about that. It's not even as if the candidate wasn't known in the area. The Labour Party needs to stop blaming every loss on exceptional circumstances.

This does not, of course, mean to say that the SNP will hold this seat at the next election. Given the size of their majority, that is highly unlikely. However, as they have shown in Hamilton and Govan before, once they win a seat, they don't give it up easily. They are an electoral force with exceptional sticking power.

The Labour Party cannot claim to be the party of the poor. The Labour Party is not the party of the poor. It should not be the party of the poor. It may make me sound like a one-nation Tory, but I don't really care. Labour go on about the many not the few, but at the same time, talk about "natural" Labour areas. This is not how it should be, and especially now. The problem with relying on your "natural" vote is that when that vote shifts somewhere else, you're in big trouble.

The best thing the Labour Party can do right now is listen to the unions. They need the money the unions are offering, but in order to do so, they need to agree to a number of the unions' demands. And quite frankly, when one of them is universal free school meals, they may find that they find some much-needed support.

People aren't just going against Labour because of difficult economic circumstances. It's not just Scottish issues. It's not just a resurgent Conservative Party. It's not just because Labour have been in power for so long. It's not just because they don't like Gordon Brown. It's because they just don't see Gordon Brown, or the Labour Party, taking the country forward.

If, however, they see real ideas, like free school meals, or the People's Rail, then maybe, just maybe, they might change. People don't vote out parties simply because they get old and boring. They vote them out because they think they're old and boring because they run out of real ideas and start spewing out rubbish, like hospital stab visits.

The Labour Party should be thankful to Barack Obama. He has completely overshadowed the loss in Glasgow East. The Labour Party, outside of Scotland at least, will get away with this. Just like they did in Haltemprice and Howden, which didn't do enough to set the political world on fire (sadly). Just like in Henley, where they could say they never do well anyway. But there comes a time when people think they're not being taken seriously any more. I fear that Glasgow East is the sign of an electorate who think they're not being taken seriously - that their votes are "in the bag". Let this be a lesson - they're not.

Faith

Step Out 2007, Week 1

Many of you will be aware that I do some work for the Baptist Union of Scotland with regards to their youth website, and occasionally their main website too. However, I am working on their Step Out mission teams over the summer.

Step Out+ team 2007 About 50 people take part in Step Out mission teams over the summer, but there are 5 of us who are on the team for the whole summer. On the far left at the front of picture is Laura Hart, with Cindy Nelson in the middle and Rachel Findlay on the far right. There is, for the observant, myself at the back on the right, and on the left at the back, Jillian Annan, and both of us were on the summer team last year.

However, unlike last year, where the summer team were together all summer, we are split up this year. In fact, I am not on the same team as Jillian at all this year! This week, Jillian and Laura were working with children in Alva, whilst the other three of us were in Thurso, where Rachel is from, working with both children and youth. The week has gone very well, with 15 children choosing to become Christians during the week in Thurso. I even got a wonderful photograph of the sun setting over Thurso and Scrabster on Tuesday, for your enjoyment.

Thurso sunset That is, quite frankly, a wonderful picture. Oh, and don't you just think that the first photograph looks like a Christmas card picture?

Technology

CPU Frequency Scaling In Ubuntu 8.04

I hope you have a nice cup of tea at hand. This is one long post, but oh, is it good! If you're not interested in CPU frequency scaling, then firstly, why not, and secondly, this probably isn't for you...

Please note: this is a first draft and is liable to change after feedback, but it works! Please report any mistakes! This guide is also available as a downloadable pdf.

I am writing this guide to scaling CPU speeds not because there isn't any documentation out there already – there is, although it can be hard to find – and not because I am a technical genius – I know a fair bit, I guess, but I'm no Einstein. No, I'm writing this because it's something that I wanted to do but had to look in a number of places in order to find out how to do it. Furthermore, some of the documentation that I found was a little muddled and probably not easy enough for some people to follow. Thus, I am going to try and explain how to scale CPU speeds in Ubuntu's latest release, 8.04 (Hardy Heron). If you're not using Ubuntu 8.04, you may need to change a few things, but this guide should still be helpful as long as you are using a 2.6 kernel.

Before we start, a little disclaimer. Some of this guide will have you executing powerful commands and you could accidentally wreck your system. If you do this, it's not my fault. I'm not forcing you to do this, nor am I there to make sure you do it correctly. If you wreck your system, you've likely done something wrong. If so, you're best off going somewhere like the Ubuntu Forums for help, not here. If, however, you follow this guide and it just doesn't work, feel free to leave a comment or contact me and I can see if I can help this work for you, and perhaps update the guide. Like I said, I'm no expert, but I have, after some study, made CPU scaling work very nicely on both my laptop and my desktop, which are very different machines.

So, before we actually start doing anything, what exactly is CPU speed scaling, or as it is more technically known, CPU frequency scaling? It's quite simple really. A CPU is a central processing unit – it processes everything as computer does. The faster the processor, the quicker it can executer commands – although it can, of course, be constrained by other elements of your hardware, like insufficient RAM. CPUs have a speed rating – my laptop has a Core2Duo T7300 rated at 2.00Ghz, so basically, it has 2 CPU cores, and they run at 2.00Ghz. My rather ageing desktop has a Pentium 4 HT processor running rated at 2.8Ghz, meaning it has 1 core, running at 2.8Ghz. However, whilst this is what these processors are rated at, this does not mean to say that the processors must run at this speed. Far from it. My laptop CPU can also run at 1.6Ghz,  1.2Ghz and 800Mhz. My desktop CPU can run at all sorts of speeds down to 350Mhz. This is known as speed stepping. Please note, this is not the same as overclocking (or underclocking)!  I will explain later about how overclocking fits in with speed stepping. One final note before moving on to the "why" - CPUs do not have to run at a set speed – they can dynamically change speeds. This can be very useful, as will be explained next...

So why might you actually want to speed step your CPU? You might want to save power. This would be a good way to do that. You may not need all the processing power your CPU has, and thus not want to use it unnecessarily. Neither of these are particularly likely reasons, but there are two more likely reasons for speed stepping. Firstly, if you have a problem with overheating, turning the processor's speed down will reduce the effect of overheating. Secondly, you may be using a laptop and trying to save power to extend battery life. Speed stepping can, when used correctly, save power and extend battery life. Considering laptops can often overheat because of their compact nature and people's lack of care for them, the reduced heat could potentially prolong the life of the laptop too, whilst still leaving you with processing power when required. So, enough of the background, let's get on with actually implementing speed stepping on our Ubuntu system!

The first thing we need to do is make sure that we have a couple of packages installed. One of these is "powernowd", and the other is "cpufrequtils". To see if these two packages are installed, go to System → Administration → Synaptic Package Manager and type in the package names.

Once you have made sure that these two packages are installed, go to Applications → Accessories → Terminal. In the terminal, type "/sys/devices/system/cpu/". Then press the "tab" button twice. If you have two processors, or a multi-core processor, you should see "cpu0" and "cpu1". If you have more than two cores or processors, you will see more (one for each that you have); if you have just the one processor with one core, you should just see "cpu0". If you still have the command on the line, type "cpu0/cpufreq". Hopefully, it should find a cpufreq/directory. If it does, press the "tab" button twice again. A whole list of new options should be available, such as "scaling_driver", "scaling_governor", "scaling_max_freq", "cpu_max_freq", etc... I have 13 options on my system. We will use these later to probe the processor and to change our speed step settings.

Now, you need to copy and paste the following command into the terminal and press "enter":

ls /lib/modules/$(uname -r)/kernel/drivers/cpufreq/ \
/lib/modules/$(uname -r)/kernel\
/arch/x86/kernel/cpu/cpufreq/

Please note: if you are using an earlier version of Ubuntu, you may need to replace the "x86" in the last line with "i386". If you get an error message in the output from the above text, try replacing the text. Unfortunately, I don't know when that changed in the kernel – I just know it did. Anyway, what we're interested in is the output. The first output lists the available speed step drivers we can use to speed step the CPU. The second output lists the governors, which I will talk about later. The first list will consist of drivers such as "acpi-cpufreq.ko", "speedstep-centrino.ko", "p4-clockmod.ko" and "powernow-k8.ko". Hopefully, one of these drivers is the one we need – we just need to find out which one. With some logical thinking, and by paying attention to the terminal's output, we can actually do this quite easily. The format we need to use is the following:

sudo modprobe driver

Please note, although the drivers in the previous output had the extension ".ko", we do not add that extension in the modprobe! So, if we are trying to add the p4-clockmod driver, we enter the following:

sudo modprobe p4-clockmod

If I accidentally add the ".ko" extension, I will get the following error:

FATAL: Module p4_clockmod.ko not found.

So the next question is, how do we know if we have loaded the correct driver? If we load the correct driver, there will be no output from the terminal. If we load the incorrect driver, however, we will see a message that says something along the lines of "Device not found". And so, having evaded simple errors, we come to the million-dollar question: which driver is the right driver?

Good question! The simply answer is, "I don't know"! However, with some logical thinking, we can get somewhere. The best driver to try first is "acpi-cpufreq" as it is the most likely to work. This is the driver I use for my Core2Duo. If you have an nforce2 chipset, try "cpufreq-nforce2". If you have a Centrino processor, try "speedstep-centrino". If you have p4, like my desktop, try "p4-clockmod". If you have an AMD processor, try one of the "powernow-6/7/8" drivers (use the number that's most appropriate, if you know which one that is).

But what if you don't know what kind of processor you have? That's not a position I'm familiar with, but I can still help you. For more information about your processor, type in the following command in the terminal:

cat /proc/cpuinfo

This will tell you lots of information you don't need, and a little that's helpful. Take a look at "vendor_id" and "model name" - these two labels will tell you what you need to know about your processor. Also look at "cpu Mhz" - this tells you the speed your processor is currently running at. Please note: it does not display the speed it is supposed to run at, or can run at, but the speed that it is currently running at.

Anyway, once you have successfully loaded a driver, you need set the speed or set a governor to automatically govern the speed. These are two very different things. Setting the speed is, in effect, manually throttling the CPU – especially effective if you're trying to stop the CPU from overheating. Setting a governor is a dynamic way of changing the speed of the CPU in accordance with the amount of power it needs at a given time – more effective for saving power on laptops. Decide which of these methods you want to take – for now – as they take different approaches (although we will be able to alter both later).

First, I'm going to go through how to manually set the speed of the CPU to a set level. Before we can set the level, however, we need to know what speeds the CPU is capable of running at. We do this by executing the following command:
$cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
This command will output a series of numbers, separated by spaces. These are the speeds (in hertz, Hz), that the CPU is capable of running at. On my laptop, the CPU can run at 2Ghz, 1.6Ghz, 1.2Ghz and 0.8Ghz. Make sure you count the number of 0's! Decide which of the available frequencies you want to run the CPU at, and then execute it with the following command:

sudo cpufreq-selector -f value

Remember, 1Ghz == 1000000! The "-f" argument simply tells the program to set the frequency. You can select a particular CPU by using "-c" followed by the CPU number. That's it, if you were just wanting to set a new, constant CPU frequency! And, just to check the new frequency has been applied, we can issue the following command:

cpufreq-info

This will output a fair amount of information, one piece of which will be "current CPU frequency Is..." If, however, you want *just* the current CPU frequency, you can issue a more long-winded command that will just output the frequency in hertz (Hz):

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

If, however, you are wanting to set a governor, it's a little more long-winded, but not complicated. First, we want to go to the cpufreq/ driectory:

cd /sys/devices/system/cpu/cpu0/cpufreq/

Now that we're here, we want to see which governor is currently set:

cat scaling_governor

The output will almost certainly be "userspace", which basically means that the CPU has been set to a particular, constant speed. If you're reading this, I'm assuming that speed is full speed! Anyway, what we want to do next is to find out the scaling_governors we are able to set, which we query using the following command:

cat scaling_available_governors

The output will hopefully be "ondemand", "userspace", "conservative", "powersave" and "performance". "Userspace" allows the user to set the CPU frequency manually, "powersave" runs the CPU at the lowest frequency, "performance" sets it to the maximum frequency. "Ondemand" and "conservative" are very similar – they both set the CPU frequency quite low where possible, and then raise the frequency as necessary to run commands. The difference, however, is that the "conservative" governor gradually steps up the speed, whereas the "ondemand" governor is capable of jumping straight to the fastest frequency step. Depending upon what you are doing, either of the two methods could save more or less power than the other, and it is probably in part down to personal taste. So, now you're an expert in the options, pick one and execute it in the terminal! I'm going to execute the "ondemand" governor.

sudo sh -c "echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"

The "sh -c" bit is telling bash to run the command in a shell. This is needed because the command is run as a superuser. You can run the command as root, but I really wouldn't advise it when you can do it like this. Because the command has to be run through a shell, the actual command has to be run within quotation marks. Anyway, once this has been successfully run, your system will be running the "ondemand" governor! But you can't see that yet, and you want to be able to see that this is working, right? Yes, you do. Read on. We're almost there!

Apologies to all non-GNOME users out there, but the following section is applicable to GNOME (but there's more after this section to interest you!). I don't use KDE or any other desktop, so I can't help you when it comes to a graphical utility for CPU frequency and governors outside of GNOME. However, if you do use the GNOME desktop, there is an applet for the GNOME panel that can help us. However, first of all, we need to reconfigure the "gnome-applets" package so as to give it superuser privileges. We do this using the following command:

sudo dpkg-reconfigure gnome-applets

You will be asked a question, to which you need to answer "yes". Then, right-click on the GNOME panel, click "add to panel" and select "CPU Frequency Scaling Monitor". Once you have placed it in the panel, you can left-click on the applet and select either a frequency, or a scaling governor. We're done!

However, for your piece of mind, I have added a few notes on the bottom here to explain a few other things. Take a quick look here if you experience any difficulties.
The command "cat cpuinfo_cur_freq" and "cat scaling_cur_freq" output the same information, but the former requires superuser privileges whereas the latter doesn't. The commands "cat cpuinfo_max_freq" and "cat scaling_max_freq", and "cat_cpuinfo_min_freq" and "cat scaling_min_freq" give the same relative output, but in this case, none of the commands require superuser privileges. No, I don't know why either!

If you want to find out which driver you are currently using, use the command "cat scaling_driver". To check the current governor, use the command "cat scaling_governor". To check how long your computer has been in each CPU frequency state, execute the command "cat stats/time_in_state".

You can artificially set a minimum and maximum CPU frequency state using these commands too. To check the current maximum state, execute the command "cat scaling_max_freq", and for the minimum, execute "cat scaling_min_freq". If you wanted to set the minimum frequency to 1.2Ghz, you would execute the following command:

sudo sh -c "echo 1200000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"

And to set the maximum frequency at, say, 1.6Ghz, you would execute the following command:

sudo sh -c "echo 1600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"

Easy! I don't know what happens if you accidentally set the maximum frequency to a lower value than the minimum – you'll probably get an error message though.
As far as I am aware, that is everything and this tour through CPU frequency scaling is complete! If you use this and it works, please leave a comment to let me know. If you tried and it didn't, leave a comment and let me know. If you don't understand, or you find a mistake, leave a comment and let me know! If you're still reading, you're a committed reader. Leave a comment and let me know. Maybe I'll buy you a drink sometime!

Leisure

Out In The Peak District

I am very blessed in living in Sheffield. Although there are other places I would rather live if I were choosing where to live, Sheffield is still a lovely, beautiful place. It is also next to the site of Britain's first national park, the Peak District. It is a wonderful place, stretching most of the way between Sheffield in South Yorkshire and Manchester in Lancashire, taking in parts of Derbyshire and incorporating the Derbyshire Dales too. If you go a little further north, there's the Yorkshire Moors, the Lake District to the west and the North Yorkshire Moors to the east. It is a beautiful place and one that I really should take more time to explore.

Longshaw Estate, near Grindleford, Derbyshire

Yesterday I went with a few other people from my University for an evening barbeque on the Longshaw Estate, near Grindleford in Derbyshire. It was rather cold when the sun wasn't out, but thankfully the sun was out most of the time we were there. It's wonderful to be able to go out and to just enjoy places without having to worry about writing 20,000 words of research, of the five exams you have to take the next week, or the essay that you understand absolutely nothing about, or the group presentation that your group are showing no interest in. No, I can just relax - for now.

Sport

Sunday Morning Football Trivia

In yesterday's F.A. Premier League football games, something rather unusual happened. none of the top four teams - Chelsea, Liverpool, Manchester United and Arsenal - all failed to win. Not only that, but they also all failed to score a goal. You could, in fact, include Aston Villa, who started the day in fifth place and finished the day in fourth place, in that statistic, since they drew 0-0 with Manchester United.

So, the highest-placed team in the Premier League to score a goal yesterday was Hull - in 6th place. Even they didn't win, drawing 2-2 with Portsmouth. The highest-placed team to win yesterday was Manchester City, who now sit in 11th place in the Premier League table - the bottom half. So, here are some trivia questions, which I don't know the answer to, but would love to know:

  1. When was the last time that none of the "big four" - Arsenal, Liverpool, Manchester United and Chelsea - won their games in a round of games where all four were playing?
  2. When was the last time none of them scored a goal in a round of games where all four were playing?
  3. When was the last time that no team in the top half of the table won a game in a round of games? (I realise that, at the time of writing, Everton have yet to play and could well win, thus meaning this may not happen this week...)

I expect these statistics will take some digging, but any pointers would be welcome.

Update: Wigan beat Everton 1-0 in the Monday match, and so no team in the top half of the Premier League table has won over the weekend! Has it ever happened before in the history of the Premier League? I shall do my best to find out...