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">
The reason I had to do this was because I needed video4linux to get a webcam working for a forcoming series of posts connecting a telescope to the pi. Although the connection to the telescope wasn’t a problem, the customized webcam I have needed it.
Here I compile the kernel on a more powerful linux box to save time then transfer the kernel over to the PI.
Also this article is mainly my personal notes on compiling a new kernel rather than a tutorial on how to do it. Writing it here makes sense to keep things together & maybe it’s useful for anyone else.
These instructions are based on the RPI Kernel Compilation available at elinux.org.
Continue reading “Compiling a Kernel on the Raspberry PI”
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”