Handling camera raw images on old versions of OS X

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I use Adobe Lightroom for most of my digital photography workflow but as our family takes more and more pictures on a variety of cameras, other family members need to process images – and I’m not letting them near my Lightroom catalogue!

As we tend to use iPhoto every year to product yearbooks, calendars, etc., the solution we decided on was for me to copy unprocessed images over onto an old Mac Mini, which is running OS X 10.6 (Snow Leopard) with iPhoto (still version 6, part of the iLife suite shipped with OS X 10.4, which was what originally installed on the Mini).

Old software doesn’t support raw formats

All seemed good until I we tried to import the the first batch of photos that I’d sent over. iPhoto was happy with JPGs but didn’t like the raw images (.NEF from my Nikon D700 and .NRW from my Nikon P7100). Apple’s advice on supported digital camera RAW formats for OS X 10.6 suggested that the D700 should be OK (presumably not with old versions of iPhoto – one forum post suggested I’d need at least iPhoto ’08) but that I needed to install the Digital Camera RAW Compatibility Update 3.9 for the P7100, which would also need me to upgrade to iPhoto 11 (v9.3.2). The iPhoto upgrade was no big deal (£10.49 in the Mac App Store)  but it will only run on OS X 10.7.4 or later.  Lion is no longer in the Mac App Store but OS X 10.8 (Mountain Lion) is (and it’s only £13.49). Unfortunately, Lion and Mountain Lion will not run on Core Solo or Core Duo Macs (like my Mini).

I refuse to buy a new Mac for this – the whole point of the exercise was to provide a fit-for-purpose solution using the kit we already have – and a new machine doesn’t come into that (heck, I might as well just put Photoshop Elements on my wife’s Windows laptop), so it was back to the drawing board.

If my combination of OS X and iPhoto won’t read my raw files, I’ll just need to batch convert them to something else first…

Compiling and installing dcraw on OS X

Dave Coffin’s dcraw is a Linux utility for raw file conversion and I decided to use that on the Mac Mini but it needs a bit of work to get it installed. I found a blog post that describes the process to get the latest version of dcraw working on OS X 10.7 (Lion) but the process is slightly different for earlier versions of OS X.

First up, I installed Apple’s developer tools – XCode.  These are found on the operating system DVD for OS X 10.6 (in the Optional Installs folder) but are a free load from the Mac App Store for 10.7 and later. I did register for a developer account and started downloading version 3.2.6 but then realised that it was a 4.1GB download and retrieving the DVD from the loft was easier. After installing XCode from the DVD, I updated to 3.2.6 using the OS X Software Update utility although other versions of OS X might have a slightly different XCode upgrade process.

The Unix Command Line tools are an install option on XCode 3.2.6 (they can be downloaded from inside XCode from version 4 onwards) but, once these were installed, the next step was to download and install MacPorts.  Again, there are different versions according to the release of OS X in use but I downloaded the .DMG for OS X 10.6 and then kicked off a Terminal session.

Once in Terminal, I entered the following commands:

su admin
sudo port install dcraw

following which MacPorts did all of the work to download and install dcraw and all of its dependencies.

Batch converting raw images on the Mac

With dcraw installed, there are many options for processing images but the basic syntax may be found by opening Terminal and typing:

\opt\local\bin\dcraw

Camera Hacker has some examples of dcraw use but I used the following commands to bulk convert batches of .NEF and .NRW files to .TIFF format:

dcraw -a -w -v -T *.NEF
dcraw -a -w -v -T *.NRW

One final tweak before import the files to iPhoto was to set the file dates to match the camera timestamp (without this, iPhoto seemed to think that the images were taken on the day they were imported):

dcraw -z *.tiff

The resulting files were ready to import to iPhoto for family use, with no risk to the master copies that are stored on my MacBook.

A beginner’s guide to getting started with Raspberry Pi (#RasPi)

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I’ve written before on this blog about my experiences getting started with Raspberry Pi (attempt 1 and attempt 2) but, in my post about the inaugural Milton Keynes Raspberry Jam this morning, I highlighted something that became very apparent within the assembled group of Raspberry Pi enthusiasts at Bletchley Park:

“It’s all to easy to forget that, although the current version of the Pi was intended for developers in preparation for a broader educational release, it’s been massively popular with 350,000 boards shipped (and on target for a million by the end of the year!). Add to that, the Raspberry Pi foundation is 20 guys and girls who don’t get paid and who have day jobs – that’s a very limited resource pool to support an awful lot of people! Even so, the Raspberry Pi is not necessarily the most user-friendly experience for those who are not used to hacking around in a command line interface […]”

With that in mind, this blog post is intended as a basic guide for those who don’t have 20 years of experience working in IT, or are not bedroom coders, but do fancy getting stuck in to creating new and exciting things with a small and inexpensive computer. Regular readers may find that I explain things in more detail than usual but I’m assuming the audience are complete beginners when it comes to using a Raspberry Pi and that they do not spend their time geeking out with bits of hardware or bytes of software. If I’ve missed anything – or made some invalid assumptions – please leave a comment on this blog post, or tweet me (@markwilsonit) but please bear in mind that I have a day job too (so my response might not be immediate) and I can’t answer every single question about getting started with a Raspberry Pi!

What’s in the box – and what else do I need?

At its most basic level, the Raspberry Pi is a single board computer. Some distributors may sell bundles with mice, keyboards, etc. but many people will just get a board like the one shown here:

That means there are some essentials to buy:

  • A 5V power adapter with a micro-USB type B connection (I use the one that came with my mobile phone but not all phones have these):
  • A USB keyboard – i.e. a keyboard with a USB type A connection like the one below:
  • A USB mouse (if you want to run a graphical user environment – i.e. one that is not just text-based)
  • An SD card with an operating system. I recommend that beginners start out with one that comes pre loaded, for example with Raspbian Linux.  If you are going to “roll-your own” then that can be more complex and my earlier post based on Debian “Squeeze” might help but that’s a lot more technical and certainly outside the scope of this basic guide.
  • A television or digital computer monitor with either an RCA component, DVI, or HDMI input. VGA will not work. See below for details of what these connections look like.
  • A cable to connect to the Raspberry Pi to the television or computer monitor. The type of cable will depend on the type of connection.
    • RCA cables look like this (normally red and white are used for audio and yellow is used for video, but it doesn’t really matter – the cables are identical):
    • DVI cables look like this (the picture shows the “male” format, with the pins sticking out – the “female” version has holes and is normally found on the back of a computer):
    • HDMI cables look like this:

      You can also get a cable to connect from HDMI to DVI (and a connector to connect two “male” DVI cables) – these are not expensive and are what I use with my Raspberry Pi.
    • VGA connectors look like this (these are very common on both old and new monitors but the Raspberry Pi does not have a VGA output):
  • An Ethernet cable with an RJ45 connection to connect to your home broadband router/modem (Wi-Fi on the Raspberry Pi can be tricky – a cabled connection is often easiest to start with) – often these are supplied by your ISP with the router/modem:
  • Some headphones or speakers with a 3.5mm stereo TRS connection (if you want to hear any sound from your Raspberry Pi):

You might also want to buy a case for your Raspberry Pi but that is by no means essential.  Many people will already have the components listed above but if you need to buy them, they shouldn’t be too expensive.  Probably the most expensive parts are the keyboard and mouse but I picked up a wireless mini keyboard and mouse from Maplin today for £14.99 and they worked out of the box with my Pi.  You might also want to get a powered USB hub if you plan to use more than two USB devices (for example if you want to plug in a webcam, a USB flash drive, or a hard disk).

Putting it together

All of these components are different sizes and shapes so should be pretty easy to plug in. It doesn’t matter which of the two USB plugs are used for the keyboard and the mouse but this diagram (from the Raspberry Pi Foundation’s quick start guide) should help:

Just make sure that the power is coming directly from a 5V supply plugged into the mains and don’t be tempted to run a cable from a USB socket on a PC!

The operating system

Remember that I said I wasn’t going to show you how to prepare your Raspberry Pi with an operating system? There are other guides on the Internet (the Raspberry Pi website is a good place to start) but I strongly recommend you buy an SD card with Raspbian pre-loaded.

If you don’t know what an operating system is, don’t worry – it’s the software that runs on a computer when you turn it on and performs basic functions like driving the screen, keyboard, etc. (like Microsoft Windows on most PCs or Mac OS X on Apple Macintosh computers). Modern operating systems tend to include other functions, like web browsers and media players. Other applications can then be installed on top of the operating system to carry out more specialised tasks (like a word processor, an image editing package, or communications software like Skype).

Raspbian is a Linux operating system – that means that it is freely available (although some organisations might charge for supporting Linux distributions) and that the operating system is similar in many ways to a system called Unix that has been around for over 40 years and is used on many computer systems all over the world.

Logging in and getting going

After all of the “peripherals” (screen, keyboard, etc.) have been plugged in and the power has been switched on, you should see some characters appear on the screen and a prompt to login.

At the login prompt (which will say something like raspberrypi login: followed by a flashing _ cursor) type the username pi and press the Enter key, then type raspberry and press  Enter at the password: prompt.

Once you are logged in, the prompt will change to pi@raspberrypi:~$ followed by a flashing _ cursor. This is username@machinename so you can see that your user is pi and the computername is raspberrypi.

These are the default username and password settings but you really should change the password to something that only you know (I’ll tell you how to do this in a moment).

The first time you start your Raspberry Pi (the first “boot”, as us geeks like to say), your Pi will prompt you for some setup information. It’s important to select the options to expand_rootfs (expand the operating system to use the whole of the memory card) and change_pass (change password).

If you ever need to run this setup programme again, then the command to type is:

sudo raspi-config

Press  the  Enter key after typing the command (and for any other commands in this blog post). Then, just follow the instructions on screen.

Many people will find the command line interface (text-only, also called a CLI) unfriendly, so you can load a graphical user interface (GUI) to see something a little more familiar, driven by a mouse, and with applications in windows. To do this, the command is:

startx

This will slow down the Raspberry Pi a bit but it should be OK. There is a status indicator towards the bottom right of the screen (a green/black bar graph) that shows how busy the Raspberry Pi is. There are many applications pre-installed on the Raspberry Pi, accessible via the start menu (just like on Windows) and you can download others from the Internet (I’ll leave that for now – there’s plenty to get started already pre-loaded in Raspbian). Here are just a few ideas to get going with your Raspberry Pi:

  • You could try some programming in Scratch, or Python.
  • Or if that sounds a bit much for now, just browse the Internet (the browser is called Midori).
  • And, if you need to run any more commands from the CLI, then you can launch an application called LXTerminal.

Updating your Raspberry Pi

Before I sign off, it’s probably worth mentioning some commands that might be necessary to update the software on your Pi. Before I do that, I’ll explain something else – remember the command to run the Raspberry Pi Configuration Utility?

sudo raspi-config

The sudo part of this is worth remembering. Your username on the Raspberry Pi (pi) is what we call a standard user. It runs with a lower level of permissions to prevent any unintended consequences from running applications that might change the configuration of your system. When we want to make deliberate changes, we use sudo to run a command as a super user (like an  administrator in Windows or Mac OS X).

So, to update the software on the Raspberry Pi, run:

sudo apt-get update
sudo apt-get upgrade

APT is the Advanced Packaging Tool – so apt-get is getting details of available software. update downloads details of the available packages (a “resync”). upgrade is updating the operating system.

Finally, there is a tool called rpi-update that can be used to update the firmware (that’s the really low-level code that drives the components on the Raspberry Pi board, underneath the operating system).  This isn’t installed by default and is written by a programmer called Hexxeh.  You can find more details on Hexxeh’s blog and download rpi-update with these commands:

sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
sudo chmod +x /usr/bin/rpi-update

This will download the  rpi-update program and then change the permissions so that it can be executed (run) on the local computer. I found that I also needed to install git before I could use rpi-update:

sudo apt-get install git-core

Then type:

sudo rpi-update

to update the firmware on your Raspberry Pi.  Generally you will only need to do this if you are having problems getting something to work.

Wrapping up

So, we’ve seen:

  • What you need to buy/find to get your Raspberry Pi working.
  • How to logon to a Raspberry Pi running Raspbian and how to get past the command line and into a more familiar (graphical) environment.
  • Some basic commands to keep your Raspberry Pi up to date.

If you want to learn more, check out the Raspberry Pi Foundation website and there are also other resources available on the Internet. You could also read a book like Meet the Raspberry Pi by Gareth Halfacree and Eben Upton.

Acknowledgements

Much of the information in this post is from a talk given by Peter Onion (@PeterOnion) at the Milton Keynes Raspberry Jam, with additional input from Rob Bishop (@Rob_Bishop) of the Raspberry Pi Foundation.

The illustrations used are taken from Wikipedia and elsewhere as follows:

Due to the licensing conditions of the images listed above, this blog post (but not the rest of this website), is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.

First Milton Keynes #RaspberryJam

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

A few weeks ago, I mentioned that I’d been to a Raspberry Jam event in London, so I was very excited to see a jam advertised for Milton Keynes, one of the towns near where I live. Not only was it in Milton Keynes but at The National Museum of Computing in Bletchley Park – a place which I was embarrassed to say I’d never visited, despite only living a dozen or so miles away…

I booked onto the event and then noticed that it was on a Sunday morning.  Evenings are generally not a problem for me but weekends are sacred  family time so I thought I might have to pull out, until I realised my family would be away and I was home alone. Time to geek out!

This morning’s Raspberry Jam, organised by Peter Onion (@PeterOnion) did not disappoint. With around 30 enthusiasts of varying abilities and even representation from the Raspberry Pi Foundation, in the form of Rob Bishop (@Rob_Bishop), there were talks on a variety of topics, followed up with a tour of The National Museum of Computing (I’ll save that for a separate blog post).

  • First up was amateur radio engineer Andy Brown, who had brought along his 1940s television set, rescued from a skip and “upgraded” with a Raspberry Pi and a former CCTV monitor. The original CRT scanned at 405 lines and is non-functional (although Andy hopes to restore it one day) but running RaspBMC with a selection of videos from the Alexandra Place Television Society, Andy says the “television” generates a lot of interest in his shop! There’s more information including some videos on the Raspberry Pi website and a description and photograph on Andy’s own site.
  • Next, Brian Hogan demonstrated RISC OS on a Raspberry Pi. This is something I’d also seen at the London jam and the basic premise is that, as the ARM CPU on the Pi is a development of the CPU used in the BBC Micro and later Acorn computers, why not port the Acorn RISC OS operating system to run on a Raspberry Pi? RISC OS dates back to the 1980s and has many user interface features that are commonplace today (and a few that are less so – like the three-button mouse controls that replace menu bars). Currently available as an alpha release, it’s hoped that RISC OS Open  (which comes in at less than 6MB and runs pretty quickly on modern hardware!) will be stable in time for the upcoming Raspberry Pi educational launch, providing opportunities for a BBC BASIC renaissance as well as access to commercial and open source RISC OS software packages.
  • The final session was a basic introduction to getting started with the Raspberry Pi. It’s all to easy to forget that, although the current version of the Pi was intended for developers in preparation for a broader educational release, it’s been massively popular with 350,000 boards shipped (and on target for a million by the end of the year!). Add to that, the Raspberry Pi foundation is 20 guys and girls who don’t get paid and who have day jobs – that’s a very limited resource pool to support an awful lot of people! Even so, the Raspberry Pi is not necessarily the most user-friendly experience for those who are not used to hacking around in a command line interface, so I’ll be writing a follow-up post this evening I’ve written a follow-up post to help those of a less technical background to get going with their Pi.

Peter hopes to run future Raspberry Pi events at Bletchley Park on a monthly basis. I’m not sure if I’ll be able to attend every time but I hope to take the elder of my two sons along with me to learn some geek skills (“it’s time you learned about programming, son”), as well as picking up a few tips myself (like using the GPIO to control some electronics…). Watch this space for more Raspberry Pi adventures!

[Updated 22 August 2012 to include a link to my beginners guide to getting started with Raspberry Pi]

Streaming Spotify to remote speakers using Airfoil

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Much of the music I play these days comes from Spotify but there are times when I’d really like to stream my music to some speakers on the other side of the house that are plugged into an Apple Airport Express.

A few months ago I found out how to do this, using a nifty piece of software from Rogue Amoeba, called Airfoil.  For just $25, Airfoil will stream audio to other Macs and PCs running the Airfoil Speakers companion app or to an Airport Express, Apple TV or other supported receivers.

I did find a few gotchas along the way though:

  • Airfoil will only recognise the same devices as iTunes and iTunes will recognise the same Airport Express as AirPort Utility. It took several reboots to get AirPort Utility to recognise my Airport Express (although things seem to have settled down since).
  • When adjusting the volume/pause/play etc. there is a short delay before the changes take effect (due to latency in the network) – so this is unlikely to work for live DJing (it was fine for my 40th birthday party a few months ago though!).
  • Spotify has a nasty habit of duplicating itself when it upgrades, leaving a copy in ~/Applications as well as in /Applications.  To resolve this, delete the old version of Spotify in /Applications and move the new version from ~/Applications to /Applications. Restart Spotify and Airfoil should, once again, be happy to take Spotify as a source application.  This has happened several times now, each time Spotify release a new client app although it could be a side effect of me running as a Standard User and not an Administrator (as all users should!).

A few TOGAF 9 post-exam notes…

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Earlier today, I blogged about my preparation for the TOGAF 9 combined part 1 and part 2 exam, which should lead to me becoming TOGAF certified.

Now that I’ve taken the test, I just wanted to share some more experiences that might help people looking to do the same. I won’t say anything about the test content as there are strict disclaimers about that sort of thing – my post earlier today outlined my study/revision approach though (and it obviously worked as I passed the test) but here are a few extra pointers that might be useful:

  • The 4-hour time slot includes registration, pre-post exam questionnaires etc. (on this occaision, those weren’t offered to me) and the actual exam is 150 minutes long (as the courseware tells us – I believe there are slightly longer sessions for those who don’t speak English natively).
  • I found that I completed part 1 (40 questions, with a required pass mark of 55%) in about half the 60 minutes that are allocated but that didn’t give me extra time to use for part 2 (it’s still 90 minutes).
  • All of the responses are multiple choice, and you can mark questions to go back review them at the end, before moving on.
  • Confusingly, at the end of part 1, the only option is to “end” the exam – don’t worry, it does continue to part 2, even though it’s not clear that it will do so.
  • Part 2 is only 8 questions (for which the required pass mark is 60%), of the scenario-type with graded scoring (5 points for best answer, 3 for next, 1 for the least-best answer, and 0 for the distractor). I needed all of that time with some questions requiring reference to the TOGAF manual (provided electronically, more on that in a moment). If you allow 5 minutes per question to fully read the scenario and understand what is being asked of you, that doesn’t leave a lot of time to search the TOGAF reference, so it’s better not to rely on it too much and to save that for when you really need it!
  • I didn’t expect to get a score for part 2 immediately (at least not based on the advice from The Open Group) so wasn’t sure if I would get my part 1 score today either. Needless to say I was pleasantly surprised to find that scores were given for both parts 1 and 2 at the end of the test (a combined score on screen, and individual part 1 and part 2 scores on the test result certificate).

Prometric test centres have been dire since I first started taking Microsoft exams in the late 1990s (later I took some VMware ones too) but it seems nothing has changed. The test booking site feels like it was specified by the same user experience designers as the London Olympics ticketing site, with no ability to search for centres based on post code (I had to scroll through 5 pages of test centres, looking at each one to see if it was near me and had availability to book a test on the date I required). The centre I visited today had newer PCs than I’ve experienced in the past – even a widescreen monitor – but the software still looks like something from Windows 3.1 and the resolution was still 1024×768 (stretched, and spilling over the edge of the visible display!). That caused some challenges with the scenario-based questions (scenario on the left, answers on the right) – thankfully the keyboard allowed me to scroll as the on-screen controls were not visible…

Add to that the fact that I couldn’t even take a bottle of water in with me (some earplugs would have been nice too) and that the reference lookup of the TOGAF manual in the open book part of the test ran in an awful PDF browser that has terrible search facilities (and which crashed on me, requiring the test centre to restart the PC running my exam – thankfully back to the same state it was in before the crash!) – in all it’s not a very good user experience.

Hopefully all of this helps those who are less familiar with Prometric tests to prepare for their exam.  Good luck!

[Update: I just found some advice for those who are less successful – according to The Open Group, if you fail and you attended an accredited training provider, then you should contact the training provider for a retake voucher)

Getting my head around Enterprise Architecture (specifically TOGAF)

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

After many years designing and implementing technology infrastructure, I’ve been trying to move “up the stack” out of the (multiple) domain architect space, towards solutions architecture and onwards to develop as an enterprise architect. That involves a mindset change to progress from the role of a designer to that of an architect but I’m on my way… and I currently manage roadmaps, portfolios (standards) and reference architectures (amongst other duties), so it might be useful to know a bit about Enterprise Architecture…

I thought it might help to get certified in The Open Group Architecture Framework (TOGAF) and I spent a week on a TOGAF 9 training course last year following which I received a voucher to sit the combined part 1 and 2 exam. At the time of writing I don’t know how successful I’ve been – in fact, this post is timed to go live at the moment when I’ll be sitting at a Prometric testing station, no doubt getting frustrated with a single monitor and limited screen resolution as I try to search a PDF of the TOGAF manual at the same time as answering questions… but, even so, I thought I’d share my revision experience for the benefit of others.

For reasons that I won’t go into here, there was a gap between my course and my exam voucher being released so I wasn’t able to take it whilst the content was still fresh in my mind. Several months later, I set aside a week to spend four days revising the content, and reading around the topic, before taking the exam at the end of the week but I found it hard to revise – my main strategy was to going over the course content again, along with a variety of other resources – all of which were highly textual (even the diagrams are unattractive) and, above all, excruciatingly dull.

I decided I needed some visual content – not just diagrams but some animated content describing key TOGAF concepts would have been fantastic. I didn’t find anything like that, but I did find a series of videos recorded by Craig Martin, from Knotion Consulting in South Africa (thanks to Sunil Babu for his blog post that provided the tip).

The first and last two minutes are, understandably, an advert for the training that Knotion provides but then Craig gets into a really easy to understand overview of TOGAF and broader enterprise architecture concepts, even diving into service oriented architecture (SOA) at one point.  These are freely available on YouTube but, based on watching them, I would suggest that Craig could package up some training content for remote delivery and it would be a worthwhile investment for people in the same situation as me. In fairness, I did start to get lost towards the end, and the overview doesn’t seem to strictly follow the TOGAF materials (that may be seen as a good thing!) but the first hour was really useful – there is definitely a market for high quality subscription-based training in this space. Remote delivery ought to drive down the costs and it would certainly be better than the Architecting  The Enterprise course that I attended (of course, that’s a personal view and your mileage may vary – I’m sure many people enjoy hours and hours of very dull PowerPoint content mixed with some group exercises and squeezed into 4 days when 5 would be more appropriate…).

Of course, Craig’s 90 minute introduction isn’t everything I need to pass the exam but it has helped to cement a lot of concepts in my mind. After watching the videos, I stopped working through the course materials in detail, and concentrated on a more general understanding of the Architecture Development Model (ADM) and the related TOGAF concepts. The TOGAF Version 9 Pocket Guide (which was provided on my training course) helped here, as did the Practice Test Papers (also from the course but available online for a fee).  Other potentially useful resources include:

I’m still not sure I have enough knowledge to pass the exam (we’ll see – my scores in the practice tests were OK but not outstanding) but I do feel better prepared and, if anyone finds some useful, modern, engaging aids to learning about enterprise architecture in general and TOGAF specifically, then please do leave a comment!

Storing Arduino code in the cloud

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Earlier this week I blogged about some of the stuff I’d been doing with Arduino and I mentioned that my code is up on GitHub. What I didn’t mention is how it got there…

I use the Arduino IDE on a netbook running Ubuntu Linux (other development tools are available) and, a few weeks ago, I stumbed across an interesting-sounding hack to store sketches (Arduino code) in the cloud. The tool to make this happen is David Vondle’s Upload and Retrieve Source project. There’s a good description in Dave’s blog post about the project that clears up parts I struggled with (like: the location of the gistCredentials.txt file, used to store your GitHub credentials and which is found in the ~/.arduino folder on my system; and that you also need the username to be included in a comment inside the sketch).  Of course, you’ll need to create an account at GitHub first but you don’t need to know anything about the various git commands to manage source code once you have created the account.

The only downside I’ve found (aside from plain text passwords) is that there is only one project for each Arduino – if you re-use the Arduino with another circuit, the new sketch will be stored in the same gist (although the version control will let you retrieve old sketches, if you know which is which)

 

Creating a SharePoint calculated column that uses information from a lookup column

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

A few months ago, Klout suggested I knew something about SharePoint. I laughed at the time but the last few weeks have seen me spending far more time working on a couple of SharePoint-based systems than I would like, so maybe Klout is less of a measure of social influence than one of future gazing…

…anyway, back to the point.

SharePoint lists have the ability to include columns that are lookups from other lists. That’s really useful when building a system with several lists of related items, for example Technologies and Vendors. I use a lookup on Name from the Vendor list to populate the available entries for a Technology item’s Product Vendor column.  That’s all fine but I also have Product Family, Product Name and Product Version columns. And then there is a Similar Products column – for which Product Name is not a clear enough lookup – I need a combination of Product Vendor, Product Family (where present), Product Name and Product Version – For example a concatenation of Microsoft + Office + SharePoint Server + 2007.

Creating a calculated column (Full Product Name) for the “in-list” (Product Family, Product Name, Product Version) is straightforward but certain column types (Lookup, Person, Group) are not available for calculated columns. I believe this is because they are based on internal SharePoint IDs, rather than the information displayed.

The workaround seems to be to create an additional text column and a workflow in SharePoint Designer that sets a value in this field.

The workflow (which I named Set Product Vendor) is a basic workflow with one step. That step has no conditions (i.e. it applies to all items) and an Update List Item action which updates the Current Item to set my new column (Product Vendor Plain Text) to the Technologies:Product Vendor value (using the fx button to select).

Now, when creating a new item the lookup is used to select an existing Product Vendor but the plain text version of the field can then be used for calculations, like the Full Product Name. The formula for my Full Product Name column is:

=IF([Product Family]=””,[Product Vendor Plain Text]&” “,[Product Vendor Plain Text]&” “&[Product Family]&” “)&[Product Name]&” (version: “&[Product Version]&”)”

This is used to create a single line of text.

The logic here is that a Product Family value might be empty. If it is, then I take the Product Vendor Plain Text value and add a space, if it’s not I take the Product Vendor Plain Text Value and the Product Family, adding spaces to separate, then (regardless of the previous condition), I add the Product Name and the Product Version (with some additional text around it).

Unfortunately, whilst the workflow can be triggered manually for an item (which is what I did to test it), or on item creation/update, there is no way to run the workflow on all of the existing items in a list.  But, like so many things in SharePoint, this also has a workaround. By viewing all items in SharePoint datasheet view and making a minor change to each one (for example adding an entry to a temporary column that can then be removed), this will update the item, triggering the workflow.

The bonus of all of this is that I have now updated my Similar Products column to be a lookup on Full Product Name instead of Product Name and, because it works on the item IDs, the entries are now correct, with no data cleansing required on my part.

Installing Ubuntu 12.04 on an old laptop without PAE

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Initially perfect for young children (portable, cheap, small keyboard), the screen resolution (1024×576) on my sons’ netbook is becoming too restrictive and, with no Flash Player, some of the main websites they use (Club Penguin, CBeebies) don’t work on the iPad.  Setting up an external monitor each time they want to use the computer is not really practical so I needed to find another option – for now that option is recycling my the laptop that my wife replaced a couple of years ago (and which has been in the loft ever since…)

The laptop in question is an IBM ThinkPad T40 – a little long in the tooth but with a 1.5GHz Pentium M and 2GB of RAM it runs OK, although hundreds of Windows XP updates have left it feeling a little sluggish. Vista and 7 are too heavyweight so I decided to install Ubuntu (although I might also give ChromeOS a shot).

Unfortunately, the Ubuntu 12.04 installer stalled, complaining about a lack of hardware support:

This kernel requires the following features not present on the CPU:

pae

Unable to boot – please use a kernel appropriate for your CPU

So much for Linux being a lightweight operating system, suitable for use on old hardware (in fairness, other distributions would have worked). As it happens, it turns out that this is a known issue and there are a few workarounds – the one that worked for me was to use the non-PAE mini.iso installer (I wasn’t prompted to select the generic Linux kernel, but I did have to select the Ubuntu Desktop option).

Once Ubuntu was installed, Joey Sneddon (@d0od) has a useful article on the OMG! Ubuntu site listing 10 things to do after installing Ubuntu 12.04 – this helped with things like installing Codecs, Adobe Flash and better Libre Office menu integration – now to see how the family gets on with a non-Windows OS… I suspect the kids will hardly notice the difference.

Upgraded the “traffic lights” in my office already

This content is 13 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Last night I wrote a blog post about the “traffic lights” for my office. The trouble with the original setup was that the light was set to a particular state until I edited the code and uploaded a new version to the Arduino.

I was so excited about having something working that I hadn’t actually finished reading the Arduino Programming For Beginners: The Traffic Light Controller post that I referenced. Scroll down a bit further and James Bruce extends his traffic light sequence to simulate someone pressing a button to change the lights (e.g. to cross the road).

I worked on this to come up with something similar – using a variation on James’ wiring diagram (except with 2 LEDs rather than 3, and using pins 11 and 12 for my LEDs and 2 for the pushbutton switch), I now have a setup which waits for the button to be pressed, then sets the red LED, until the button is pressed again (when it goes green), etc.

My code is available on github but here’s the current version (just in case I lose that version as I get to grips with source control…):

/*
Red/green LED indicator with pushbutton control
Based on http://www.makeuseof.com/tag/arduino-traffic-light-controller/
*/

// Pins for coloured LEDs
int red = 11;
int green = 12;
int light = 0;

int button = 2; // Pushbutton on pin 2
int buttonValue = 0; // Button defaults to 0 (LOW)

void setup(){
// Set up pins with LEDs as output devices and switch for input
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(button,INPUT);
}

void loop(){
// Read the value of the pushbutton switch
buttonValue = digitalRead(button);
if (buttonValue == HIGH){
changeLights();
delay(15000); // Wait 15 seconds before reading again
}
}

void changeLights(){
// Change the lights based on current value: 0 is not set; 1 is green; 2 is red
switch (light) {
case 1:
turnLightRed();
break;
case 2:
turnLightGreen();
break;
default:
turnLightRed();
}
}

void turnLightGreen(){
// Turn off the red and turn on the green
digitalWrite(red,LOW);
digitalWrite(green,HIGH);
light = 1;
}

void turnLightRed(){
// Turn off the green and turn on the red
digitalWrite(green,LOW);
digitalWrite(red,HIGH);
light = 2;
}

Now I’m wondering how long it will be before the kids work out that they too can change the status (like pushing the button at a pedestrian crossing!)…