• Category Archives Linux
  • Technology » Linux
  • Bash script using Lame to convert WAV files to MP3 recursively in sub directories.

    I wrote this as the lazy way out because I didn’t want to bring a lot of WAV files back to a local box. I know everything is in artist/album format with plenty of spaces in the file names so this type of thing works perfectly for me.
    Of course, you need lame installed.
    I hope this helps.

    LAMEOPTS="-b 192"
    for DIRECTORY in /music/*/*; do
    if [ -d "$DIRECTORY" ]; then
    echo "$DIRECTORY";
    for FILE in "$DIRECTORY"/*.wav ; do
    OUTNAME=`basename "$FILE" .wav`.mp3;
    echo "$FILE" "$DIRECTORY"/"$OUTNAME";
    rm "$FILE";

  • Using PuTTY with Jaws 18.

    Please be aware that I don’t recommend that you use PuTTY exclusively for SSH access. Especially in Windows 10. There are a number of better alternatives out there at this point for most day to day use. I’ll add links to one or two below. However, there are times when PuTTY or Putty as it’s pronounced is just the best tool for the job so it’s important that you can get some feedback from Jaws.

    Note as of 26th October 2017

    Please note that this post is now out of date. You should use these fantastic PuTTY scripts instead as they provide much more complete functionality.

    I had posted a script before that worked with previous versions of Jaws and in fact, it would probably work with Jaws 18 as well but the SayNonHighlightedText function in Jaws 18 has been updated so it’s only right that I tweak it slightly and publish it here to be used in a PuTTY.jss file.

    Here’s the code:

    Include “HjGlobal.jsh” ; default HJ global variables
    Include “hjconst.jsh” ; default HJ constants
    Include “HjHelp.jsh” ; Help Topic Constants
    Include “common.jsm” ; message file
    include “MSAAConst.jsh”
    include “UIA.jsh”

    NavigationByLineTickThreshold = 200
    int LastLineNavigationTick

    Void Function SayNonHighlightedText (handle hwnd, string buffer)
    ; NonHighlightedText Function for speaking all newly written nonhighlighted
    ; text.
    If GetScreenEcho () > ECHO_NONE
    && hWnd == GetFocus()
    If GetWindowClass(GetFocus()) == “PuTTY”
    && GetTickCount()-LastLineNavigationTick > NavigationByLineTickThreshold
    ;New text should be spoken only if it is not a result of navigation by line.
    ;This prevents double speaking when navigating through a command history,
    ;since the SayLineUnit will already have spoken the new text.
    ;Now clear LastLineNavigationTick, just in case more new text appears shortly after the navigation.
    LastLineNavigationTick = 0
    if (GetScreenEcho() > 1) then

    There are a number of great alternatives to PuTTY.
    Over on Git Hub, Microsoft have a rather nice SSH Powershell module that provides a method of accessing an OpenSSH server on Linux from within Powershell.
    The best way to use SSH on Windows in my opinion is to install Git. Be sure that you choose to make git features available from the command line so that you can use SSH without starting the Git Bash shell first.
    Lastly, another really good option if you are using Windows 10 is to install Bash or Linux for Windows. This is an add on that you can install from within Programs and Features\Windows Features.

    There are now more ways than ever to access your Linux servers over SSH from within Windows. Have fun!

  • VMware Fix for Call “HostDatastoreSystem.QueryVmfsDatastoreCreateOptions” for object “ha-datastoresystem” on ESXi failed

    While installing ESXI 6 update 2 on a Dell R410 I found that I could not create a datastore using the VSphere UI. assumed this was something to do with the Windows partition that was previously used on that disk so I decided I’d drop back into the CLI and delete the existing partition manually.

    Here’s how you do this:

    1. Open VSphere.
    2. Go to Configuration
    3. Click Security templates on the left
    4. Click Properties
    5. Select SSH
    6. Click Options
    7. Click start
    8. Connect to your host using PuTTY or any other SSH client
    9. Move to the /dev/disks directory

      cd /dev/disks/

    10. List the files here


    11. Match the identifier with the datastore that you cant create in VSphere.
      For example: naa.6d4ae5208f875700172a910c5402c983
    12. Run partedUtil to delete that partition.

      partedUtil mklabel /dev/disks/naa.6d4ae5208f875700172a910c5402c983 msdos

    13. Go back into VSphere and create the datastore.
    14. Now disable the SSH service to clean up and close the security vulnerability that you’ve opened.

    I hope that helps someone. It worked for me perfectly.

  • Turning on and off your Christmas tree lights from the Raspberry Pi.

    Thanks to a suggestion from my wife last week, I bought a Energenie socket controller for the Raspberry Pi. This little gadget allows wireless communication to a special socket that plugs into an electrical outlet. When working, this allows you to easily write code that will turn on or off that socket. The pack comes with one transmitter and two receiving sockets but actually, I bought two kits as each socket may be controlled by up to two transmitters and one transmitter may control up to four sockets.

    The reason that I bought this is quite simple. I have a new Raspberry Pi B+ in our living room with RaspBMC to allow us to use the XBMC media center software. we also put up our Christmas tree last weekend so we have the yearly problem of having to reach around quite a large christmas tree to reach the socket to turn off power to the lights every night. As they would say on twitter, it’s a perfect example of a first world problem! I hate that term but I’m getting off the point. Thanks to the RP and the Energenie I can turn on and off our Christmas tree lights remotely without going anywhere near that hard to reach socket.

    The problem of course was, on Wednesday after I spent a short amount of time getting this set up the night before, my wife posted a status to facebook saying, “It’s bad when I’m not technical enough to turn on the christmas tree lights”. Point taken. I set about creating a web interface to allow us to do this from our phones.

    I have never used the Flask Python web micro framework so this was a very new venture for me. the code you see before is my second version. The first one didn’t use views, a config file, templates or flash messages. It worked but it wasn’t as clean. I like to learn to do things properly so I scrapped it and read about how to do this properly. If you are interested in Flask, I really suggest you read this incredibly helplful tutorial by guel Grinberg.
    Here are all the steps. Hopefully I haven’t left anything out. To make this a little more conveenient for you, I’ve also included a package of all the code and graphics you will need to get this running on your own system.

    What you’ll need

    • A Raspberry Pi
    • An Energenie socket

    Getting your environment ready.

    I’m installing this on RaspBMC. This is the Raspberry Pi distribution for XBMC use primarily.
    Update the aptitude repository
    sudo apt-get update
    Install build dependencies.
    apt-get install gcc python-dev
    install the Python GPIO package to gain control of the pins on the Pi.
    cd /tmp
    wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.8.tar.gz

    Extract the contents of the archive.
    tar xzvf RPi.GPIO-0.5.8.tar.gz
    cd RPi.GPIO-0.5.8
    sudo python setup.py install

    Change to your home directory and get the Energenie install software from the following address.
    wget https://energenie4u.co.uk/res/software/ENER002-2PI.py

    Now install this.
    sudo python ENER002-2PI.py
    Make a directory that will hold your project

    cd {ProjectName}

    Get the really fantastic library created by Amy Mather’s. More information can be found here.
    wget https://github.com/MiniGirlGeek/energenie-demo/raw/master/energenie.py
    Get the Python setup tools package.
    sudo apt-get install python-setuptools
    get the Flask micro web framework.
    sudo easy_install flask
    Get the Jinja2 Python template engine.
    sudo easy_install Jinja2
    You now have all the components required to get coding.

    create your app file and directory structure

    The structure is as follows:

    The code

    The following section has the code for each file along with a description of what that file is used for.


    You will use this file to launch your application.

    from app import app
    app.run(host='', debug=True) # Set to be accessible over the network with debugging enabled.


    The config.py file does as you would expect. It is used to store config variables for the application.
    SECRET_KEY = 'YourSecretKey'
    The secret key is what ever you define. This is used by the flash messaging component.


    This is the main part of your application. all of the processing happens here.

    # Import statements.
    from flask import render_template, flash
    from app import app
    from energenie import switch_on, switch_off

    # Main page. accessible from http://yourIPAddress:5000/
    def index():
    return render_template('index.html', title='Christmas')

    # Code that is called with http://yourIPAddress:5000/on. This turns on the lights and adds a message to say the lights are on.
    def on():
    flash('Christmas tree lights on.')
    return render_template('index.html', title='Christmas - Lights On')

    # Code that is called with http://yourIPAddress:5000/off. This turns off the lights and adds a message to say the lights are off.
    def off():
    flash('Christmas tree lights off.')
    return render_template('index.html', title='Christmas - Lights Off')


    App initialization. Also includes the definition of the config file and tells flask that we are using views.py.

    from flask import Flask
    app = Flask(__name__)
    from app import views


    You need to put static files into the static directory. The following style sheet definition defines some basic page layout options.

    body {
    font-size: 30px;

    .red-button-link {
    text-decoration: none;
    padding: 15px 20px;
    background: red;
    color: #FFF;
    -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    border-radius: 6px;
    border: solid 2px #20538D;
    text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.4);
    -webkit-box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 2px 2px rgba(0, 0, 0, 0.2);
    -moz-box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 2px 2px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 2px 2px rgba(0, 0, 0, 0.2);
    -webkit-transition-duration: 0.2s;
    -moz-transition-duration: 0.2s;
    transition-duration: 0.2s;
    .red-button-link:hover {
    background: red;
    border: solid 2px #2A4E77;
    text-decoration: none;
    .red-button-link:active {
    text-decoration: none;
    -webkit-box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
    -moz-box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
    background: red;
    border: solid 2px #23E5F;

    .green-button-link {
    text-decoration: none;
    padding: 15px 20px;
    background: green;
    color: #FFF;
    -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    border-radius: 6px;
    border: solid 2px #20538D;
    text-shadow: 0 -2px 0 rgba(0, 0, 0, 0.4);
    -webkit-box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 2px 2px rgba(0, 0, 0, 0.2);
    -moz-box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 2px 2px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 2px 2px rgba(0, 0, 0, 0.2);
    -webkit-transition-duration: 0.2s;
    -moz-transition-duration: 0.2s;
    transition-duration: 0.2s;
    .green-button-link:hover {
    background: green;
    border: solid 2px #2A4E77;
    text-decoration: none;
    .green-button-link:active {
    text-decoration: none;
    -webkit-box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
    -moz-box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
    background: green;
    border: solid 2px #203E5F;

    PNG files

    Add the graphics from the attached zip file if you like but if you would rather use your own, add them to the static folder.


    This is the template file. The UI that you will see is defined in this file.

    {{ title }}

    Picture of the Christmas Tree.
    Turn the lights on      Turn the lights off

    {% with messages = get_flashed_messages() %}
    {% if messages %}
    {% for message in messages %}
    {{ message }} {% endfor %}
    {% endif %}
    {% endwith %}

    Download the files required in an archive

    You may download the archive here

    if you would rather not copy and paste the code.

  • Using date ranges in MongoDB and PHP.

    I have also written similar posts relating to date ranges in Python. You can find my Question here from when I was getting frustrated and The answer to my problems here.

    You seriously wouldn’t believe the trouble I’ve had in the past two weeks trying to make some progress on my Arduino, Raspberry pi, Python, PHP and MongoDB project.

    Work has been very busy so the only time I’ve had to work on this is on the bus on the way to and from Dublin and from time to time very late at night.

    Right, so here are a few of the problems I came up against:
    The first hing I wanted to do was limit the size of my table in MongoDB. I’m collecting quite a lot of sensor data from the Arduino but I don’t need to retain this data for any more than around 2 weeks.

    MongoDB allows you to create a TTL index which will delete data that was created more than a certain number of seconds ago. This is a really handy feature however, it didn’t really work for me. I think you need to store the date in BSON format and I had stored my date in ISO format because I think it will make it easier to retrieve and write the sensor entries.

    Regardless, here is the code I used:

    db.envirocheck.sensors.ensureIndex( { “Date”: 1 }, { expireAfterSeconds: 604800 } )

    You can learn more about TTL indexes using the Fantastic MongoDB documentation that covers TTL Indexes

    As I said, this didn’t work for me at all so a suggestion on Twitter that I received weeks before made me think of capped collections. These are similar to TTL indexes in that they delete old data but instead of the TTL index, this works by deleting entries that are old however it does so when the collection reaches a certain value. By writing data once a second, I find that with 500Bytes I can store just over two hours of data. I obviously need to figure out how many bytes I need for storing two weeks worth but that’s something to do when I’m feeling more awake.

    The code to create a capped collection is here:

    db.createCollection( “sensors”, { capped: true, size: 500000 } )

    Again, look here for the MongoDB documentation for capped collections.

    Next, I of course needed to set an index on my date field as I’m going to be using this to select specific temperature values for date and time ranges. That was quite straight forward.

    db.sensors.ensureIndex( { “Date”: 1 } )

    Next, I needed to find a way of selecting between two dates in MongoDB and PHP. You might think this is easy, but no! It’s far from it! I stupidly tried to get ahead of myself by making this really complicated. I looked at Doctrine but trust me on this, the documentation for this project is absolutely crap! Now, maybe it’s me. Maybe I’m not experienced enough to figure this out but for god sake, this documentation might seem great from a high level but unless you read it from start to finish like a book, it’s useless! there’s no context to any of their examples and huge chunks of code are missing without any pointers to the parts of the documentation that might reference them. I wasted a week reading that documentation. There’s also different variations and different versions so the whole thing is really frustrating. All I wanted to do was find data between a date or time range. I liked the simplicity of the query builder and I can really see the power of this library but the documentation really turned me off.

    Finally, I came to my senses last night at about 11:30PM when I really should have been a sleep. Come to think of it, I should really be a sleep now as well but I want to get all this out of my head and on paper so to speak before I forget it. I came across This post on the MongoDB blog which made things very very clear. I had of course tried something very similar to that before I started looking for alternatives but really, it was so simple! All I was missing was converting the date into strToTime before I tried to convert it into MongoDate format. I did a lot of searching on Google but although I could find shed lodes of documentation on converting from MongoDate into PHP, I couldn’t find anything on the other way around. I obviously wasn’t looking in the right place because as soon as I saw those few letters strToTime, it all clicked.

    Here’s the example from the MongoDB blog:

    $start = new MongoDate(strtotime(‘1971-01-01 00:00:00’));
    $end = new MongoDate(strtotime(‘1999-12-31 23:59:59’));
    $collection->find(array(“create_date” => array(‘$gt’ => $start, ‘$lte’ => $end)));

    This actually converts the date and time into a number like this:


    Armed with this information, I set about dynamically setting the date and time. This code will get the sensor values saved to MongoDB over the past day:

    $start = new MongoDate(strtotime(date(“Y-m-d H:i:s”,”-1 days”)));
    $end = new MongoDate(strtotime(date(“Y-m-d H:i:s”)));

    See how easy that is? Isn’t that frustrating! I’ve spent about ten hours reading about this. Such a waste in a lot of ways but I suppose I probably learned plenty on my travels to finding out more about Mongo and the way it handles dates. Funny, in the collection, the date is stored in ISO format. For example: 2014-27-02 23:46:05. It must do some very interesting conversion back into a standard format. When I tried to check using the format that the date is stored in within the collection using (Y-m-d H:m:s) it failed to pull back any records. Maybe because MongoDate is trying to parse that from the expected strToTime number. That’s weird though because that wasn’t even working when I wasn’t using MongoDate. It’s a question I must ask on the forums when I eventually get around to creating an account.

    As you can see, I’m still learning and in a lot of ways this is really frustrating. I could probably do with reading a few books on these subjects but where’s the fun in that? I rather learn as I go along.

  • Fixing my first problem with MongoDB.

    working with MongoDB seemed easy at first.

    It isn’t available in the APT repository and compiling it on the Raspberry pi is a little different so I followed this very helpful guide.

    That got me up and running so next I had to learn a little more about MongoDB. Fortunately, the MongoDB manual is fantastic so This section told me everything I needed to know to create my first database and collection. Note, collection is similar to a table in SQL world.

    Next, I wanted to dive right in and connect my Python application that is taking data over serial from my Arduino. The idea was to add this data to a collection in MongoDB so that historical graphs could be generated. With a quick Google search, I found This quick tutorial that shows the basics of Python and MongoDB. Armed with a little knowledge I successfully learned how to add data to my new collection in MongoDB. Everything was working perfectly.

    That was on Friday night. Saturday was a very busy day so I didn’t get near this stuff at all until late on Sunday. With a lot of frustration, I found that no data was shown in MongoDB any more and MongoDB was frequently hanging without providing me with a prompt. This seemed to be any time I tried to use the db operation. I was absolutely certain that data had been written to the database and collection so I set about trying to find out what was going wrong.

    First, I checked the logs in /var/log/mongod/mongodb.log. All they were showing me were the connection attempts.

    Then I looked at the ocasional time out error message that I was getting from within the MongoDB shell. Still nothing useful.

    I even tried searching forums etc for some hint of what might be going wrong.

    I found two useful pages that I’ll keep for future reference but unfortunately, they were of no help with this problem. This is a forum post that someone created when MongoDB seemed to be hung. and This one shows how to troubleshoot hanging issues.

    I decided to try running MongoDB as a user run process instead of a system daemon. Of course, then, i was using the default settings so I thought that it might show me if anything was going wrong with the settings in /etc/mongo.conf. No. All I got was a message about the dBPath not set. This was of no use to me because I quickly found out that in /etc/mongod.conf, the DBPath was set to /var/lib/mongodb/. However, this pointed me toward looking at the permissions on that folder. I had set them while installing MongoDB but I thought I’d check again to be sure that the permissions were set recursively for child files and folders. Again, this wasn’t the problem, however I noticed a file called mongod.lock. I thought maybe this was a place holder to show that the database was locked so I tried moving that file out of the /var/lib/mongodb directory. Sure enough, I made a little more progress. The show dbs command was still causing the MongoDB shell to hang. I deleted the databases that I created while working with Python earlier from the /var/lib/mongodb/ directory and this let the show dbs file runn a little longer but it was still causing MongoDB to freeze. I deleted the MyDB database that was created when I was learning MongodB first as well and the command completed successfully. Of course, I was very aware that I had deleted files from the file system and the databases were still there but were probably now corrupt within MongodB so with another quick search on Google, I found the short command to delete databases from within MongoDB. I also found the command to drop mongoDB collections as well but I don’t particularly need that at the moment. Handy to have for future reference of course.

    So, after deleting the files and deleting the databases within MongoDB, the system is working perfectly. However, I hear you say, “There’s nothing in the system, of course it’s running perfectly!” Your absolutely right, but for the moment, there’s no locking so I@m going to hope either one of the tutorials / forum posts were wrong or it was just something in one of the databases that became corrupt.

  • Progressing slowly with the arduino and the Raspberry Pi

    Work on the Arduino and the Raspberry Pi is ongoing. So far, I’ve made Led’s flash, used a light meter to determine when the LED’s are on and off, taken the temperature of the room and moved a camera using a Servo. On the Pi side, I’ve set up Email alerts when motion has been detected by the phone and I even found an application that supports push on the IOS platform so I may even be able to get the Pi to send alerts directly to my iPhone.

    I’ve encountered a few challenges of course. Almost all of the tutorials for the Arduino use a delay function to pause when the servo is running or when the motor is spinning but that’s no good when you need the loop to continue processing while all of this happens. So, I looked into a few alternatives. Using a counter to count the milliseconds since the device was turned on was fine but this would need to reset after 34 days which would cause a problem with the timing of the loop. I then tried a library called ElapsedMilis. This works fine but I had a lot of problems figuring out the logic. I got there in the end though but unfortunately my approach wasn’t completely sound.

    After asking a question on the Arduino forum I was pointed in the direction of another library called Delay Timer. I don’t think it’s released because when I included it first in one of my projects I had a bit of debugging to do to get it working. I must subscribe to Git Hub to suggest my changes. Unlike my previous approach, with this library, I can use as many timers as I want. The last time, I was using one hardware timer and a number of intervals to try to mark when functions should be executed. This should have worked fine in theory but the problem is that the loop is processed so quickly that it can run through the process too quickly and miss an important event. With this new approach, I can have different timers running concurrently and I can check each one. When it is time to execute that function, the timer resets again and its place in the loop is never lost.

    Of course, it’s not all programming. Some of this work is also about putting the components together and making it sit properly. One problem I was having is that the servo was generating too much vibration. This would cause the camera to constantly think it was detecting motion. I came up with the great idea of using a bit of Velcro to help mount the servo to the side of the Raspberry Pi and then Velcro the camera board to the moving part of the servo. Now, the vibration is absorbed by the servo. It’s funny the solutions that show themselves when you’re stuck.

  • A blind person can use the Arduino. Just about.

    Continuing on with my Raspberry Pi and Arduino experimentation, I’ve been trying to get a few minutes here and there over the past two days. Christmas is always a very relaxing but very busy time for me. I’m spending time with family and friends and I try to do very little with technology considering I spend so much time in front of a computer during the rest of the year. This year is very different. It’s still as busy as ever but when I get a free moment, I can’t wait to jump back into the RP. RP from here on in will mean Raspberry Pi in case you’re not sure.

    Firstly, I had a few questions sent by Email after the last post. All of these questions are asked on the Raspberry Vi website but I’ll briefly give you a few answers here.

    1. Is Speakup supported?
      Technically, Speakup is supported by Raspbian but issues with the sound card integrated with the GPU on the device have caused a lot of problems in relation to software synthesis from ESpeak and other synthesizers. It may be possible to connect something like an Apollo2 to the RP via serial to get that talking. If someone wants to send me over a cable that will connect to the pins on the RP I’d be happy to try this.
    2. Is there any accessibility in the graphical environment?
      Raspbian uses the LXDE Window Display Manager. Orca works with Gnome and the KDE screen reader has a long way to go. Theoretically if Orca is running in LXDE and you start an application written using GDK Orca will work quite happily. However, it is worth remembering that the RP is a low power device. Even with a really good memory card at 96MB read and 92MB write speed the performance will not be nice to work with. My card is 45 write 48 read. Or something close to that.
    3. Is there sound output?
      Yes. Through the line out port and through HDMI if your television supports this.

    I think it’s important to understand that the Raspberry Pi is not meant to be a high power device. It is primarily a tool that should promote learning by children. For someone like me, it’s a low cost device that is really useful for experimentation. If I break it, it’s not the end of the world. If I cause the system not to boot it won’t take long to fix.

    The great thing for me is I have kind of fallen away from using Linux all that actively at home. I use it on servers a lot but I rarely use it for playing with Python or trying out new packages or configs.

    I bought an Arduino a year ago with the best intentions of trying out a few things that I had heard about with the added aim of getting involved with the local maker space. Unfortunately to my annoyance, the Arduino IDE wasn’t accessible to me as a screen reader user. This meant that the kit that I bought has gone on unused for far too long. Thanks to a really brilliant little tool that I found while casually looking around last week, I now have access to compile and upload to my Arduino.

    This tool is called Ino. It is exceptionally easy to use. The basic commands are

    Ino init Creates a new project.
    Ino build Compiles and creates the make file for your project.
    Ino upload Uploads the compiled project.
    Ino serial Displays the serial output from the Arduino.

    You need the Arduino package installed first as well as Python easy_install. There are also a few dependencies listed in the requirements.txt file that will need to be installed before the tool will work.

    The great thing is that it allows complete control of the Arduino without ever using the IDE. So, it can all be done using the console via SSH.

    All I’ve done so far is use a few sensors and lights to read from the serial port just to get started. I’ve used a few loops, called functions, used include files and set up a few checks using if statements. Nothing too complicated but it’s giving me a starting point. Thanks of course to Emma who is helping me with the very visual side of the Arduino. It’s not possible for me to wire up the board so I need sighted assistance to add new components.

    Of course, you would probably get some nice debugging tools using the IDE and the output from ino build isn’t great when it encounters a problem but so far, I’ve been able to debug it manually.

    The only terrible thing about the RP and the Arduino is it’s quite addictive when you get stuck into a project. I need to remember that I’ve an 11 week old baby fighting for my attention as well.

  • First time with the Raspberry Pi

    Thanks to Emma and her mother, Santy was very good to me this year. When they asked what to get the man who now has everything he wants, my answer was simple. A Raspberry Pi and a few things that will let me mess around with it.

    So, this morning I unwrapped a Raspberry Pi B model, a power supply, an extra-long USB cable for when I want to power it off my laptop, a case for the Raspberry Pi, a camera board and a case for that board. Yes. You read that. A camera board. I want to play around with motion detection, colour detection and generally interfacing with the real world through Python.

    First thing that struck me was the amount of tiny boxes. There were boxes for:

    • The Raspberry Pi board
    • The USB cable
    • The power supply
    • The camera board
    • The camera board case
    • The Raspberry pi case
    • The SD card

    The second thing that struck me was the tiny size of the Raspberry Pi and the camera board. The Raspberry Pi is no bigger than a credit card. Going from the shortest side with the USB ports facing you, you find from left to right, the LAN port and two USB ports. Turning the device around to the right so that the long edge is facing you, there is one composite port and one audio out port. Continuing this time on the next short edge, you find the SD card reader on the bottom of the board and a micro USB port used for powering the device to the right of this on the top of the board. Continuing on around to the next long edge you find the HDMI port. If your television supports this, audio will also be piped through this port. All the ports are on the top of the card and the card reader is on the bottom.

    The camera board is connected by a ribbon cable that is attached at one end to the board. The other end attaches onto the Raspberry Pi just behind the LAN and USB ports. Getting this lined up took sighted assistance from my wife I must admit. I probably could have done it with time but I think I might be getting a bit lazy where this kind of thing is concerned. You will agree with me if you see the camera board. It’s really tiny! The case that you can buy for it is very small as well. The camera goes in to the back. There are two very small place holders at the top that hold it in place. Their hard to find though.

    Putting on the case is very straight forward and didn’t require any sighted assistance at all. The only thing I would say here is that getting the four screws in was actually quite difficult. I’d be a reasonably strong person I think but it took a lot of strength to get those screws in. The other thing is, I’m glad that I have a screw driver set for fixing ultra-portable laptops as the screw heads wouldn’t have been compatible with a standard head. The only reason that I mention this is, the Raspberry Pi is meant to be a device that is usable by kids. Getting these screws in would definitely require adult assistance. Either that or last night’s Guinness had more of an impact than I thought.

    Preparing to boot it for the first time, I first had to download the Raspbian image to install it to the SD card. I had done this ahead of time by going to the downloads page on the Raspberry Pi website. That’s one of the best download pages I’ve seen actually. So clean and uncluttered and the Win32 disk imager software that I needed to install the Raspbian image onto the SD card was available as a link to make the process really straight forward. I wish I could say the same for the Disk imager site. It’s hosted by source forge, a website that I don’t particularly like. It’s full of pointless regions and the download link is very badly labelled. If you’re looking for the download, you’ll find it by searching for “download the unnamed link”. That’s no reflection on the Raspberry Pi of
    course. It’s just worth noting if your preparing to follow the same process I did.

    The Win32 disk imager archive is 5.41MB and the Raspbian image I downloaded is 783MB.

    I had read previously that the interface for Win32 disk imager was not accessible as it is written in QT and this was certainly the case for me. However, I was able to muddle through. Basic instructions might be useful for other screen readers so if you’re interested, give me a shout and I’ll write them up for you.

    When the disk imager process finished, I had a quick look at the SD card. In there, I found a config.txt file. Curiosity of course got the better of me so I went in and had a look. I found an overclocking option so I uncommented it. I had read in a few of the forums that it was safe to do this so I thought it was worth a shot. There was a link to the Raspberry Pi site at the end of the file but after skimming through the page for a moment I decided that I had enough to get started with. I’ll probably tweak this config file a little more when I’ve played around with the Raspberry Pi for a few days.

    Right. Now, Raspbian is installed onto the SD card, the case is together with the ribbon cable sticking out and attached to the camera, I have all the cables etc. that I’m going to need sitting to one side so all that’s left is to connect the tiny device to my television. I know the first set up screen isn’t accessible so I’ll need Emma’s help with it but after that, I’ll ensure SSH is enabled and get going.

    I’ve also bought a 7 port powered USB hub. The Raspberry Pi doesn’t have enough power to support many unpowered USB devices so when I’m connecting the Arduino to it I’ll need to give it a bit of a boost.

    Connecting the Raspberry Pi to the television and giving it power was absolutely no problem at all. Within a minute or two, the set up screen launched and with the assistance of Emma, my wife the system was configured in no time. A few things were a little unusual. For example, instead of selecting your keyboard layout, it wanted you to select the keyboard make and model. The localization screen was also a bit confusing. Over all, the configuration interface wasn’t as snappy or responsive as others that we have used but this is most likely as a result of the low processing power of this device.

    Of course, the first thing I changed was the user password. I also changed the hostname and checked for updates. Aside from that, oh, and increasing the partition size, there was nothing else I had to do.

    One thing I should have done right away was change the IP to a static address. I have DHCP on this network of course but when I plugged it in to one of the LAN ports in my office, the pi got a completely different IP for some reason. That’s really strange as usually my DHCP server recognises the Mac and continues to respect the lease. You wouldn’t believe how much time I wasted trying to figure out what note on my network the Raspberry Pi was. I have far too many things connected in this house so when it comes to trying to sift through DHCP logs it’s very cumbersome. I gave up and just set the address manually at the end of it.

    The first thing I did when I got connected via SSH was update the packages and the firmware. I’m surprised the start-up / configuration wizard didn’t do this automatically. It seemed logical that it would check for all available updates when the option to apply updates was available in the menu.

    After a few reboots and some testing, I’m now in a position where I can begin playing around with the pi. I’m really looking forward to this. I’ve read so much online and I’ve bought and read so many books on the subject in the past few weeks that I’m now really looking forward to getting my hands dirty.

    The first thing I’m going to do is get something working using the camera as a motion detection light bulb with This handy tutorial as a starting point.

    I didn’t use any of the information in this next site during my process of getting up and running with the Pi but I would like to commend their work. It’s people like them that continue to push accessibility forward and I would hope they are recognised for the work that they have done. Please look at the Raspberry Vi website for more details and to get involved. I learned of this project while searching on Google for any accessibility problems I may encounter.

    Finally, of course, I have to thank Emma and her mother. I’m into quite a few glasses of wine later but I’ve had a lot of fun playing around with this new toy today.

  • Hosting wordpress from behind a proxy.

    This is just a quick note that I hope will hopefully help someone who tries to do something similar to this.
    If you are running WordPress on a server behind a locked down firewall and you must go through a proxy, you will need to add the following lines to your wp-config.php file.

    define(‘WP_PROXY_HOST’, ‘’);
    define(‘WP_PROXY_PORT’, ‘8080’);
    define(‘WP_PROXY_BYPASS_HOSTS’, ‘localhost’);

    Of course, it goes without saying that you need to change the host IP address to match your proxy.