The Badger Cull is to be debated next week

After getting over 157,000 people signing an e-petition about the Badger Cull, it’s going to be debated in a weeks time, Thursday October 25th.

Earlier the speaker of the house announced next week’s order of business with the following entry: (emphasis is mine)

Thursday 25 October—Presentation of a report by the International Development Select Committee: DFID’s work in Afghanistan. This is expected to last 20 minutes. It will be followed by a debate on a motion relating to the badger cull. The subject for this debate has been nominated by the Backbench Business Committee.

© Parliamentary material is reproduced with the permission of the Controller of HMSO on behalf of Parliament. Licence No: P2011000006

/home/edivad

If in emacs you need a different file coding system (line terminator), for example you are on a windows system and need to type a unix like text file (or vice versa), you can easily convert the buffer coding system.

Dos to unix

M-x set-buffer-file-coding-system RET undecided-unix
save the file (C-x C-s)

or

C-x RET f undecided-unix
C-x C-f

Unix to dos

M-x set-buffer-file-coding-system RET undecided-dos
save the file (C-x C-s)

or

C-x RET f undecided-dos
C-x C-f

View original post

Formatting xml in emacs

I had this problem of debugging some xml but when reading the output of some log4j it was almost impossible to read so I needed some way of prettifying the xml quickly.

For this example I have the following xml:

<?xml version="1.0"?><xml><iq xmlns="jabber:component:accept" from="test1@temp.retep.org/client" id="iq_257" to="service.retep.org" type="get"><query xmlns="some:namespace"/></iq></xml>

So how do we pretify this in emacs?

Well the first thing to do is to write an extension function & place it into your ~/.emacs file. Placing it here means that when you open emacs the extension is available:

(defun xml-format ()
  (interactive)
  (save-excursion
    (shell-command-on-region (mark) (point) "xmllint --format -" (buffer-name) t)
  )
)

Now this works by passing the buffer to the xmllint utility and replaces it with the output – in this case nicely formatted xml.

Now we need to install xmllint:

pi@lindesfarne: ~$ sudo apt-get install libxml2-utils

Ok so now open emacs and open the xml. To format first select the xml you want to format then Press Escape then x followed by xml-format & press return. You should then get the xml nicely formatted:

<?xml version="1.0"?>
<xml>
  <iq xmlns="jabber:component:accept" from="test1@temp.retep.org/client" id="iq_257" to="service.retep.org" type="get">
    <query xmlns="some:namespace"/>
  </iq>
</xml>

Do MP’s really think we could do a future Moon Landing?

Moon
Moon (Photo credit: penguinbush)

I saw this when reading Hansard this morning. It’s a written answer from Friday where an MP (Mr Amess) asked:

Mr Amess: To ask the Secretary of State for Business, Innovation and Skills whether he plans to provide funding for space projects related to a future moon landing; what discussions the UK Space Agency has had with the US administration on this matter; and if he will make a statement. [119768]

Ok, so where the hell did a moon landing come from? Now the response was as expected:

Mr Willetts: No funds are allocated to develop missions for a future moon landing, and at present we have no firm plans to commit to a moon project. The UK Space Agency is a member of the International Space Exploration Co-ordination Group (ISECG) which includes NASA. ISECG is engaged in multi-lateral discussions on future space exploration of the Moon, Mars and asteroids, as described on its website:

http://www.globalspaceexploration.org/

The link being the International Space Exploration Coordination Group which the UKSA is a member but I’m just wondering, where would the money come from, especially in this current financial climate?

© Parliamentary material is reproduced with the permission of the Controller of HMSO on behalf of Parliament. Licence No: P2011000006

Installing a USB Weather Station on a Raspberry PI part 2

In the first article I covered how to install a weather station on a Raspberry PI. In the second part I’ll cover how to get it to upload data on an hourly basis to a website using FTP.

Getting the station to run hourly

First we need to get the station to run hourly. To do this I created a script called weatherupload which I placed under /usr/local/bin

pi@kell: ~$ sudo vi /usr/local/bin/weatherupload

Enter the following:

#!/bin/bash
cd /usr/local/weather
python Hourly.py -vvv data

Once saved make it executable and then edit the main crontab:

pi@kell: ~$ sudo chmod +x /usr/local/bin/weatherupload
pi@kell: ~$ sudo vi /etc/crontab

At the end of the file you need to add the following:

0 * * * * root /usr/local/bin/weatherupload

Save it and now every hour it will now run.

Note: I’ve placed it there and not under /etc/cron.hourly because

  1. cron.hourly runs once an hour, but not necessarily at the top of the hour. I a later article when I add twitter you want the tweet to be close to 0m rather than at a random time.
  2. I’ve found in the past that using crontab -e doesn’t always work, even for root but in the core crontab it just works

Uploading to a website

First to generate the graphs pywws uses gnuplot so we need to install it:

pi@kell: ~/sudo apt-get install gnuplot

Next we need to add some details to the stations weather.ini file. At the top theres a section called paths. Make sure those point to the relevant templates and graph_templates directories in your pywws install.
Next under the hourly section you should see a pair of lines:

plot = []
text = []

You need to add the plots and pages that need to be generated:

plot = ['7days.png.xml', '24hrs.png.xml', 'rose_24hrs.png.xml', 'rose_7days_nights.png.xml']
text = ['current.html', '24hrs.html', '6hrs.html', '7days.html', 'feed_hourly.xml', 'allmonths.html']

Finally theres the ftp section which needs configuring with the remote ftp server (your web host will give you these):

[ftp]
secure = False
site = ftp.example.com
local site = False
user = myaccount@example.com
directory = /weather/
password = mypassword

That’s about it. Now when you run the hourly script it will generate some simple pages & images to your website.

You can see an example of this over at maidstoneweather.com – although the uploaded templates only form part of that site.

How far back can you find a reference to yourself online?

As I sit at home with a cold thats slowly turning into Flu I’m sitting here idling the time away when I thought what is the earliest post I could find online that I made – as I can’t do much else & I’ve exhausted the news sites.

Now I’ve been online in one form or another for quite sometime – having had my first modem sometime around 1984 and the internet does have the habit of keeping things forever (almost), so how hard would it be?

Continue reading “How far back can you find a reference to yourself online?”

Why is French spoken first at the Olympics & not English?

During the Olympic opening ceremony a lot of people on Twitter were asking why everything was in French first & not English. Well the BBC have this answer about it:

Why is French the first language of the Olympics?

At the opening ceremony, all the main speeches were first given in French, followed by English.

But why? Is it because French is still considered to be the language of diplomacy? For centuries, political delegates from around the world learned to speak French.

French is the first language of the Olympic movement – which is based in the French-speaking city of Lausanne – in honour of Frenchman Baron de Coubertin, who developed the modern Games in the 1890s.

Many have argued that English should be the first language. One letter writer to the Daily Express newspaper noted that it was only after Baron de Coubertin saw the revived modern Olympic Games in Much Wenlock, Shropshire in the late 1800s, that he was inspired to bring the Games back to France.

Of course, some say the first language should be Greek.

So French being the first language of the Olympic movement is the reason although it’s good to finally see Much Wenlock mentiond as it’s sort of the forgotten 1st Olympics since the ancient Greeks!