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="email@example.com/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 ()
(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:
<iq xmlns="jabber:component:accept" from="firstname.lastname@example.org/client" id="iq_257" to="service.retep.org" type="get">
As the Raspberry PI uses an SD Card for it’s boot device there are times when you need either more space than is available on that device or a device that’s faster – writing to flash is slow and flash cards do have a limited number of writes that can be made to them.
Now there’s several ways to accomplish this:
- Use an external USB drive (the common route)
- Use a network shared drive
Using a USB drive is simple and is the faster option but it means it’s dedicated to the PI whilst it’s in use, hence this article on using a network drive – in this instance a directory on another Linux box in the network.
Also having it shared on the network means that multiple machines could use it at the same time. Imagine if you are a teacher with a collection of PI’s being used by your students. You could setup a central read-only directory with your class work which they can all access as if it’s installed locally.
Continue reading “Using NFS to provide extra disk to a Raspberry PI”
New in Ubuntu 12.04 is whoopsie – which sends a crash log to ubuntu. Nice feature? Well no as they don’t tell you about it nor to they ask you, they just do it.
Nice privacy issue guys.
To tell if you have it check the file /etc/default/whoopsie
If you see that then it’s enabled. You’ll also see a process running called whoopsie as well.
To turn it off just change it from true to false & kill the whoopsie process (or reboot).
Note this affects any distribution based on Ubuntu 12.04 including Mint 13 so check you are not infected by whoopsie.