Show Comments

A while ago, when Blogger made one of their unannounced set of changes, the link at the bottom of each post that takes you to the comments started to jump to the comment form rather than the first comment. This meant that usually you ended up looking at the form without being able to see any of the comments. To see the comments you would then have to scroll back up the page to the find the end of the post and hence the first comment. I know that this really annoys me when I'm reading other peoples blogs, and so I thought I should at least attempt to fix my own blogs.

Unfortunately the layout tags don't include a link to the beginning of the comments, only date:posts.addCommentUrl which generates the link to the comment form. That link works by going to the #comment-form anchor. As the comments always appear before the form, we can insert another anchor with the same name, before the comments and then hey presto, the link will take us to the first comment instead of the form.

To make this change you need to edit the HTML version of your template (with the widgets expanded) and find the following HTML snippet
<a id='comments'/>
and replace it with
<a id='comments'/>
<a id='comment-form'/>
You should find that it appears twice in your template; once for threaded comments and once for unthreaded comments. Change it in both places to make sure you get the right one.

This works because the IDs of HTML elements are meant to be unique, and when they aren't the first one takes precedence. We could have made more changes to the template (change the comments to comment-form rather than adding the extra anchor, and remove the original comment-form anchor) but I decided it was safer to leave as much of the template alone as possible. Anyway you should now find that clicking the comment link takes you to the comments rather than the form which, as far as I'm concerned, makes more sense.

Hardware As Well As Software

One of the things that attracted me to the Raspberry Pi (apart from the price and philosophy behind the development of the device) was the fact that it can be used for hardware projects, not just software development. It has a set of GPIO pins along one edge which, in theory, can be connected to external sensors that can influence code running on the Raspberry Pi as well as motors, lights etc. which can in turn be controlled by the code. There are, however, a couple of things stopping me from experimenting with this though. Firstly I'm sure it would be easy to brick the Raspberry Pi if I got something wrong in the hardware and I'm not willing to risk that. Secondly because the Raspberry Pi is so new there aren't, as yet, lots of examples I could learn from. The second point is important. Last time I tried controlling hardware (an undergraduate course) I managed to accidentally switch around two pins which caused the model lift I was controlling to try and drive itself through the floor! I'm sure that in time plenty of examples (both hardware and software) will appear and I'll make some use of the GPIO pins on the Raspberry Pi, but until that time....

Probably the most common platform (at the moment at least) for playing around with hardware/software ideas is the Ardunio. What you can see to the left is an Arduino Uno board, which is the current reference board. Essentially an Arduino is a small board containing an 8 bit microcontroller (in the case of the Arduino Uno it's an ATmega328) which can be connected to a computer via a USB cable and which has the GPIO pins broken out to easily accessible headers. You program the microcontroller using C/C++, but once programmed an Arduino doesn't have to be connected to a computer to be used, which makes them ideal for embedding in all sorts of hardware projects. There is also a large community surrounding Arduino with plenty of example programs (they are called sketches for some reason) as well as numerous hardware extensions, known as shields, which can easily add new functionality.

So I've bought an Arduino Uno (for slightly less than the price of a Raspberry Pi) partly to play with the hardware side of things, but also as a good excuse for improving my C/C++ skills (I've never really used either language in anger for anything larger than a single function DLL or command line application). I don't have any firm plans yet, but I'm sure that when I do there will be a blog post or two.