Sunday, 26 June 2016

It's the end of the world as we know it

So that's it then - brexit is happening. Dave's big gamble has failed. The UK will soon become the first country to leave the European Union. Not content with setting the people of Britain against each other, he has succeeded is setting us against other Europeans, migrants and refugees as well. And what of the labour party? A party which completely deserted their duty to hold the government of the day to account, voted through tory austerity cuts and failed to challenge the right wing narrative blaming the sick, the poor and the disabled for our country's woes. The election of left-wing Jeremy Corben was too little, too late.

This is a terrible result for Britain, not just because we are better off within the EU, but because it hands so much more power to the Tories who have ravaged the country with their systematic destruction of the public sector since they came to power in 2010. Tory austerity is a sham. The real reason for the tories' cuts is their belief in having a public sector that is as small as possible. Creeping privatisation in the NHS and their disgraceful and blatant attempt to privatise schools in England through "academies" are clear evidence of this.

The leave campaign was a cynical and dirty campaign which preyed on people's fears and presented a convenient scapegoat in the form of a European project most Britons actually know little about. There is much wrong with Britain that needs fixing. Unfortunately brexit hands power back to a Britain increasingly right wing that cares little about the plight of the disdvantaged, panders to a financial sector that behaves increasingly like an organised crime syndicate, and with no credible UK political party that offers any alternative.


Saturday, 11 June 2016

Online radio on the Raspberry Pi

I have seen lots of how-to's that explain how to get internet radio working on the Raspberry Pi. None of them really suited my needs, so I had a look to see if I could get software I already knew had the capability working reliably on my Pi. It turns out my solution works, so I thought I would document it here for anyone else that might find it useful.

I use a Java-based music player called MediaPlayer, as described in my previous blog post. To get online radio working on MediaPlayer you either need a TuneIn partner ID or you hand edit a file called RadioList.json. I have created my own custom build of MediaPlayer called VertexPlayer with Tunein radio support enabled by default as well as a RadioList.json file with some of the main commercial and BBC stations broadcasting in Scotland. Find it on github here: github.com/andrum99/vertexplayer.

Queensferry Crossing opening delayed by 5 months

The Scottish Government recently announced that the iconic Queensferry Crossing bridge is now expected to fully open to traffic 5 months after the intended opening date of December 2016. It seems the consortium building the bridge, FCBC, thought until recently that the December opening was 'challenging but acheivable'. Apparently without a recent 25 day delay to the deck fan construction, FCBC still considered a December 2016 opening acheivable.

A document posted on Transport Scotland's own website in 2012 shows that at that time FCBC estimated it would take 9 months after completion of the deck fans to have the bridge open both ways. At that time the estimated opening date was set at June 2016, which would mean essentially that FCBC would be carrying out the same works at the same time of year as is now being planned to allow completion mid 2017.

Here is a link to the document: Principle Contract FCBC Key Milestones.

The deck fan is now due for completion in 'autumn 2016' which means the bridge itself is bang on schedule for opening in May 2017.

Wednesday, 8 June 2016

Recycling old laptops

I've been handed the task of selling 4 old laptops to raise money for TWAM Scotland. Two are IBM Thinkpads - an R31 and an R30, an ancient PowerPC based MacBook, and a Fujitsu Siemens Lifebook C Series.

Out of the 4, only the Lifebook booted first time, and was running Windows 98 SE! After looking for various Linux distros I could run on it - it only has 64MB RAM installed - I ended up going for Windows XP SP3 just to get it going. The installed Windows 98 SE was doing odd things - processes were randomly hanging for no obvious reason. Loading XP onto it will let me check that it wasn't a hardware fault causing this problem.

I find it rather odd that it is actually easier to load Windows XP onto an old laptop than put Linux on it! All reasonably recent Linux distros I could find require more than 64MB of RAM just to install the OS. I know from past experience that Windows XP SP3 runs reasonably OK in 64MB of memory, as long as you disable loads of services, don't have it joined to a domain, have a very lightweight antivirus installed, and run a single app (for example, you are using it as a PC-based till).

Unfortunately the two Thinkpads have had their RAM removed. Luckily we have plenty of old RAM from old dead systems that were not worth saving, so I can try using some of that tomorrow. One has a post-it note on it that suggests the CMOS battery has died, other than that there is no info on whether it will even boot beyond that error message. (Old IBM systems will just refuse to boot if any error is detected, although they have an option to continue booting if it is just a keyboard error). The other Thinkpad has no info on it, but has obviously been kept in the hope that it can be sold on eBay either working or parts only.

The MacBook is minus a power supply and seems to need an odd power connector nobody else uses - as you would expect from Apple. I have a suitable 24V PSU handy so I'm thinking I can maybe bodge an adaptor together to see if the thing will boot.

Monday, 7 March 2016

Another new phone - HTC Desire 820

Unfortunately the phone I bought in November, an HTC Desire 510 that was supposedly manufacturer refurbished turned out to be a turkey, and the website I bought it from has disappeared, so I decided to shell out just over £200 on a brand new handset. I went to a reputable online store this time, although the handset I ended up with is localised for Poland or Russia or somewhere like that. It is still the same phone, it is just the "getting started" leaflet is in a language which is foreign to me.

HTC Desire 820 with noodle USB cable attached
The HTC Desire 820 is a large phone with a 5.5 inch display and currently runs Android 5, with the HTC Sense 6 UI. HTC plan to update this to Android 6 in the first half of 2016, which will be interesting. There are already features in Android 5 that I like that were not in Android 4.4 on my previous phones. I can unlock the phone with my face, assuming it is well lit enough, which avoids having to trace out a pattern on the screen, which is the primary unlock method I have set up. I also like the fact that the phone tells me how long it will take to reach full charge, and the UI for recent apps, accessible via the right soft-button at the bottom of the screen is nicer, defaulting to a sort of deck of cards appearance. It can also talk to my camera using NFC, which is a nice touch. At present here in the UK there are no payment services that support contactless payments on the Android operating system, but hopefully it won't be too long before I can use it for this as it would potentially speed things up a bit at the checkout.

I'm very impressed with the speed of the phone so far, and the big screen does make it easier to use than my previous phones. Although the screen is actually a lower resolution than my old phones - 760 pixels versus 800 pixels high, the size of the UI elements make it a pleasure to use. I can definitely see the benefit of the extra screen area. I am also very happy that this phone's camera has a flash, as I find this useful as a torch. As with other HTC phones, the built-in "flashlight" app enables that usage without having to load a 3rd party app.

As a side note, I loaded CPUZ onto the phone and discovered that it uses the same ARM processor cores as the new Raspberry Pi 3 - ARM Cortex A53's, although in this case there are 8 of them running at up to 1.45GHz compared to 4 at 1.2GHz on the Pi 3. The GPU is also different on the phone, being a Mali unit. Mali GPUs are designed by ARM, whereas the GPU in all Raspberry Pi is a Broadcom designed unit.

Sunday, 17 January 2016

Windows 10 Upgrade a success

I have been using Windows 10 on my primary machine, a 6 year old Toshiba Tecra laptop, since October last year and it has gone well so far. The only issue I had was with Office 2007 which started not wanting to save documents I had just opened for some reason. I moved to a trial version of Office 2016 for 30 days, then back to Office 2007 and it seems to be working fine now. The system is a fair bit faster on my system - newer systems will likely see less of a speed-up.

I also accidentally upgraded my Aunt's PC to Windows 10 by clicking "download now" then going home. This apparently caused it to upgrade without asking once it had downloaded it. Fortunately my Aunt is happy with the speedup. I have seen some other folk who have successfully gone the route of doing an in-place upgrade from Windows 7 to Windows 10 and it looks like in most cases this works fine. I did see one PC that was left to its own devices halfway through the upgrade but then didn't complete the upgrade correctly, leaving the PC with a non-bootable hard disk, but I think Windows 10 doesn't sleep correctly on that system which may have been the cause of that problem.

All told, I am happy with Windows 10, especially as it is a free upgrade for me.

Tuesday, 17 November 2015

New Phone!

I bought myself a new phone as my old one was getting a bit knackered - it has started to reboot itself occasionally and the micro USB connector was getting a bit loose so I decided to upgrade. I went for a refurb off eBay - an HTC Desire 510. The Desire series of phones in HTC's low cost line, so it is missing a few things - noticeably a flash from the camera, which I found useful as a torch on my old phone (an HTC One SV).

My new phone - an HTC Desire 510
I've had my phone since yesterday and am very pleased with it so far. It is much more responsive than the HTC One SV thanks to the faster processor, and although the screen is the same size the UI elements have all been resized so it seems bigger.

I also ordered an HTC Dot View case which arrived today. As you can see below, this has holes in the front that lets you see what is going on without opening it.

The Dot View app on the phone is telling me that it is a rather chilly 7C and cloudy where I am. :-( There is some sort of sensor in the phone that detects when the Dot View is there and changes the display accordingly. What you are seeing there is produced by the phone's display itself - the case is just made of what looks like silicone and has no active parts. Unlike the HTC One SV that it is replacing, the screen does not have Gorilla Glass so I am may end up having to buy a screen protector to stop it getting scratched. I've changed to a lower monthly tariff so over 12 months I will only be paying £40 more in total. I think I've done quite well since although the new phone is a refurb it looks and feels as good as new.

Tuesday, 27 October 2015

Upgraded to Windows 10

It has been a while since I posted to my blog and I was looking for a subject to write about. Yesterday I upgraded my laptop from Windows 7 to Windows 10 so that seemed like as good a subject as any - so here we are!

A few weeks ago I set up my laptop to dual boot both Windows 7 and Windows 10 to get a feel for how Windows 10 works on real hardware, having tested it in a virtual machine before it was released. Having come across no problems, apart from a couple that have been fixed by updates since Windows 10 was released, and having found a few things that I prefer compared to Windows 7, I decided to take the plunge and wipe my laptop's hard drive and start afresh with a clean install of Windows 10. (Obviously I backed up my files first). I use Windows 7's built in backup tool, which is fortunately fully supported on Windows 10 as well, including the ability to backup files - not just restore them.

My reasons for preferring Windows 10 to Windows 7 come partly from some specifics of my hardware, or rather the software that supports it. On my laptop I have a thumbwheel volume control, which is very useful as it means I don't need to use the mouse/trackpad to find the volume control on the taskbar, then drag a slider to change the volume. On Windows 7 I get no on-screen indication of what the volume is set to: on Windows 10 I do. I can also adjust the brightness of the screen without logging on with Windows 10: on Windows 7 I need to log in before the Toshiba tool that does this will respond.

I also get the use of my laptop's fingerprint reader back with Windows 10. Microsoft bought the company that makes the fingerprint reader in my laptop, then stopped distributing the software that allows it to be used to log in to Windows (see my previous blog post). With Windows 10 they added this functionality into the operating system so this works smoothly - it is part of Microsoft Hello.

The other attraction of Windows 10 is that it seems slightly faster that Windows 7 on my laptop. I'm not sure if this is because it is a fresh install, but it definitely seems a bit quicker. My laptop is more than 5 years old and wasn't the fastest when I bought it, so any speedup is definitely welcome.

Windows 10 seems to be working quite nicely so far but of course the real test will be whether it keeps working as smoothly over the coming months and years. Watch this space!

Sunday, 7 June 2015

Two Capitals 2015

I have just completed the Two Capitals Cycle Ride 2015. The route is from Pittencrieff Park in Dunfermline to Victoria Park in Edinburgh via the Forth Road Bridge and is 19 miles in length. The weather was good, apart from the wind, so I completed the course in good time. There were some fine views of the Fife coast as I cycled along the front at Granton.

me after finishing in Edinburgh


The organisers, Prentice Events, made a bit of a boob with the route maps they supplied. There were a total of six maps for the event - four available on their website, and a Google Maps map linked to from a Word document containing information about the event, which they emailed to all entrants, along with a PDF version which included descriptions and photos of parts of the route. It turns out that the four maps on the website were all wrong - only the two from the email showed the correct route. Cue much confusion on the day. Luckily I had a close look at both routes beforehand so managed to find my way successfully.

This year I was raising money for TWAM Scotland - a local charity which refurbishes old tools and computers, sending them to disadvantaged people in Africa. I enjoyed the cycle today - hopefully it can kick-start my cycling again now summer is upon us!

Monday, 6 April 2015

OpenHome ohMedia on the Raspberry Pi

My previous blog posts Raspberry Pi Version 2, New Adventures In HifiBerry and Sending Windows' Sound Across The Network described how I had set up my new Raspberry Pi 2 as a network music player with a HifiBerry card. Since then I have done some more research and have found a better software solution which I will now describe.

Linn Products Ltd is a Scottish company that produces high-end audio equipment, including a range of network music players. They have also released much of their software as open source, as well as making their "OpenHome" API freely available for others to use. Their hi-fi systems are well out of my price range, but since their software is available for free and can be used with other media players I thought I would give it a try.

Linn's "OpenHome" ohMedia system extends the UPnP Forum's AV standards with some useful extra features. The one that I currently make use of is playlist support. Normally with a UPnP network music player the playlist is stored on the control point (e.g. smartphone) rather than on the renderer itself (in this case my Raspberry Pi). With ohMedia the playlist is stored on the renderer which allows it to continue playing the next track even if the control point loses contact. It also allows multiple control points to be used at the same time, all with the same playlist. I find this useful since it allows me to use my phone and laptop to control the music player on my Pi without having to worry about copying the playlist between devices.

My HifiBerry setup
I am currently using a standard UPnP media server on the Pi - the reason being that there is currently no ohMedia media server that runs on the Pi. Minimserver is a free (as in beer) Java-based media server that comes with instructions for loading it on the Raspberry Pi, and seems to work well on my system. The media player I am using is simply called MediaPlayer and uses Linn's ohMedia API to provide playlist support on the renderer. Again this is Java-based and comes with instructions for getting it to run on the Raspberry Pi. I have found Minimserver and MediaPlayer both work well on my Pi. MediaPlayer is more responsive that Kodi and also supports Songcast, allowing me to stream the sound output from my laptop directly to the Pi with very little latency. This means I can watch videos on the laptop and use the Pi for sound output.

I am using Linn's Kazoo application to play music from my laptop, and BubbleDS Next on my Android mobile phone. Both work well with MediaPlayer, although I miss having the ability to see a list of tracks ordered by when I downloaded them. I have MediaMonkey loaded on my laptop for that purpose, and can play directly from MediaMonkey to MediaPlayer on the Pi. Note that BubbleDS Next requires payment to unlock some features - in particular playlists are limited to 16 entries in the free version. Unlocking only costs a few pounds and I think is well worth it.

I use Linn's Songcast application to stream the sound output from my (Windows-based) laptop to the Pi.

Sunday, 1 March 2015

Send Windows' Sound Across The Network

Update: I now use Songcast to stream sound from my laptop to my Raspberry Pi music player - see this blog post. Songcast has the advantage that the sound output is only very slightly delayed - SWYH introduces a few seconds delay which means I cannot use that for sound output when watching videos.

After setting up my HiFiBerry to stream sound from my laptop and phone, I then went to do what I usually do when looking for new music, I went online to listen to the tracks currently in the singles chart. It was at this point that I realised I didn't have a way to stream this to my HiFiBerry. I thought about just plugging in a cable from my laptop to the amp like I used to, but I thought there must be a better way.

After some googling I came across Stream What You Hear (SWYH). SWYH captures Windows' sound output and sends it across the network to a DLNA renderer - exactly what I was looking for.

Stream What You Hear UI
The SWYH User Interface is minimalist - you simply get an icon in the taskbar notification area. Once the program starts up it pops up a baloon tip telling you to right click on the icon to show the above menu. If there are DLNA renderers available on your network they appear under 'stream to'. The 'stream to' menu also contains a helpful 'my device is not listed' which explains that some DLNA devices are not renderers, but players, If your device is a player then you need to start the playback from that device. There is also a link to the SWYH website where you can get further instructions.

SWYH seems to work quite well on my laptop. It does use quite a lot of CPU though. My laptop is more than five years old so SWYH would probably require less CPU time on a more current system. SWYH works well when you are listening to a continuous piece of sound. I have had trouble when I am listening to a short item, then I start listening to another. SWYH seems to not stream the new item.

You can get Stream What You Hear from streamwhatouhear.com.

Friday, 27 February 2015

New Adventures In HifiBerry

Update: I am now using MediaPlayer rather than Kodi to play music on my Raspberry Pi - see this blog post.

My HiFiBerry DAC+ arrived yesterday and I have been busy setting it up. The HiFiBerry DAC+ is a Digital to Analogue Converter (DAC) card for the Raspberry Pi Models A+, B+ and Raspberry Pi 2 Model B. It produces high quality audio for output to a hi-fi system.

My HiFiBerry setup
The HifiBerry, along with a Raspberry Pi 2 Model B, is hidden in a small black box which can been seen under the blue hard disk on top of the graphic equalizer in the above picture. I chose the black case which HiFiBerry do in preference to their clear case as this setup is in my bedroom and I don't want the lights on the Pi keeping me awake.

I can hear from my tests that the HiFiBerry produces really good sound. I have had to use a wired network connection as the wireless dongle I tried was not reliable. I have also moved my Pi-based external hard disk to this unit to speed it up - I use it as a network attached backup drive for certain things. All in all a very satisfactory setup!

Monday, 23 February 2015

Raspberry Pi Version 2

After saying that a new Raspberry Pi version based on a more powerful chip would debut in 2017, the Raspberry Pi Foundation surprised (almost) everyone when they released the Raspberry Pi 2 Model B on 2nd February 2015. This is a significant upgrade which promises six times the performance of the original family of Raspberry Pi's that we all know and love. What makes this possible is a brand new SoC - the Broadcom BCM2836. Eben Upton has said that the Raspberry Pi Foundation is the anchor customer for the chip, and it seems pretty clear to me that this chip would not exist without what the Raspberry Pi Foundation have achieved with its predecessor. The Raspberry Pi would not have been possible in the first place without the strong support of Broadcom, and this new chip is a continuation of that. That said, it will also appeal to other device makers.

Raspberry Pi 2 box from Premier Farnell
The speed-up is made possible by the substitution of a quad core ARMv7 unit in place of the single core ARMv6 in the BCM2835. There are also enhancements to the cache arrangements for the ARM side of the chip to speed things up further. The chip is otherwise identical to the SoC at the heart of the original Raspberry Pi. This is extremely important because it means that all software that runs on the original Pi will have no trouble on the Pi 2.

The other major improvement on the Pi 2 is the inclusion of 1GB of memory - up from the 512MB on the Model B and B+, and quadruple the memory capacity of the original variants of the Model B. This is now the memory interface on the chip maxed out, which means that the only way to get a Pi with more memory in a future model would be to move to yet another SoC.

My Raspberry Pi 2 music player setup
Update: I am now using MediaPlayer to play music on my Pi - see this blog post.

My new Raspberry Pi 2 is being tasked with music playing with the addition of a HifiBerry DAC+. This is an HD audio output board which I will be connecting to my hi-fi and I will be enclosing it in the black case that the HifiBerry people also produce. I am using a USB wi-fi dongle to connect the Pi 2 to my network. From there I send music to it from my phone and laptop using DLNA. I am running OpenELEC 5.0.3, which runs a Pi-tuned version of Kodi, formerly known as XBMC.

I have found the new Pi much faster than the two old Pi 1's that I have, even though I am using my slowest micro-SD card. CPC (part of Premier Farnell) helpfully cancelled one of the lines of my order - two new micro-SD cards. I will therefore have to source suitable cards elsewhere. The HifiBerry has yet to arrive from Switzerland so until then raspi3 (which is the hostname I have assigned my new RasPi 2) is outputting sounds on its built-in analogue port. This produces noticeably better sound than my old Model B Pi's, but still sounds "cheaper" than the output of my cheap Denon hi-fi CD player. This was expected - the analogue sound output on the Pi is not meant to be hi-fi quality.

I had a small problem using my little TV as the screen for my Pi. The TV is an 'Onn' brand - which is (or was) Asda's brand for such items. For some reason it reports bogus EDID information - for a Beko TV. Presumably Beko made it and loaded the wrong EDID information on it. The solution was to remove the DDC data pin from one end of the VGA cable. Luckily I had a spare cheap VGA cable so I didn't have to knacker my good one.

The Raspberry Pi 2 Model B is on sale for the same price as the Model B and B+, and has similar power usage to these older models, making it the ideal choice for new purchases. The Model A, which uses the original BCM2835 SoC, is also available for those looking for a board with lower power consumption and smaller size.

Sunday, 15 February 2015

More Adventures in Temperature Monitoring

I recently completed updating the temperature monitoring system on one of my Raspberry Pi's to log data to an sqlite3 database. I also added a web page to display graphs of the temperature data, loosely modelled on the graphs I was already producing by sending the data to xively.com. You can see the web page with the graphs here.

The source code for the temperature logging script is at pastebin.com/tripg8jj. Note that it contains code to send the temperature data to xively.com and display the temperature on a 2-line display as well. See my previous blog post Multithreaded Python for more details of this script.

The source code for the web page is in two parts. Firstly, there is the web page itself. This contains Javascript to pull the data from the web server and display it as graphs us jqPlot. jqPlot is a Javascript graphing library which adds graphing capability to jQuery. The web page is available at pastebin.com/p8TMK3Jd. The graph data is generated by a PHP script which can be found at pastebin.com/cEkY0dfh.

Thursday, 5 February 2015

Multilingualism in Computer Programming

While working on my temperature monitoring system it struck me how many different programming languages I was using. I am also using one markup language, a style sheet language and one data format. The complete run-down is as follows:

Programming Languages:
  1. Python
  2. PHP
  3. Javascript
  4. SQL
 Markup Language:
  1. HTML 5
Style sheet Language:
  1. CSS
Data format:
  1. JSON
That is a total of seven different languages/formats just for one project! All of these languages have things in common, most obviously being based on English, and all of the programming languages are declarative. JSON is technically not a language, but I am including it here as it further demonstrates my point about working with multiple languages, markups and formats.

I am currently using Javascript, SQL, HTML 5 and CSS to develop some web-based graphs for my temperature monitoring system, based on the ones on xively.com. You can see the xively version of the graphs at xively.com/feeds/79499, and my home grown version, still under construction, at andrum99.no-ip.org/temp. I use Python and SQL to log the temperature from the 3 sensors into an sqlite3 database, as well as sending them to xively.com.

JSON and SQL are the only two languages/formats on my list that are used in two different parts of my project. JSON is used as the data format to send data to xively.com, and I also use it to send data from my web server to the browser, where it is rendered into graphs using Javascript. SQL is used by the Python script to log the temperature data in the database, and by my PHP script when retrieving them.

Saturday, 24 January 2015

Multithreaded Python

I recently bought an Adafruit LCD Plate so that I could display the output of my temperature monitoring script, which is written in Python. This also allowed me to try my hand at soldering again, for which I bought a new soldering iron with a smaller tip. My script logs the temperature of the Raspberry Pi's SoC, an attached hard disk, and the air temperature near the Pi using an I2C-attached sensor and sends them to xively.com (at xively.com/feeds/79499). As well as outputting the three temperatures to the 2 line display I also added code to perform certain actions in response to some of the buttons on the LCD Plate being pressed.

Adafruit LCD Plate on one of my Raspberry Pi's

Because of the particular way the LCD Plate works, you cannot use interrupts to respond to button pushes: you must poll the buttons instead. It is possible to use interrupts if you add a link between one of the INT lines on the IO expander chip and a spare GPIO line on the Pi, but I wanted to avoid making changes to the hardware. I chose to poll the buttons in a separate thread within my script so that it would be able to respond to any button pushes, even if the script was doing something else at the same time. I first had to convert my script from Python 3 to Python 2 as the module that Adafruit has written to interface the LCD Plate is for Python 2 and I did not want to have to port it to Python 3 myself. I previously chose Python 3 for my script as I figured it would be more useful to learn the current version of Python.

The script is available to download at pastebin.com/tripg8jj.

The script now logs the temperatures to a local sqlite database as well as sending them to xively. The next step is to create a web page to extract the temperature observations from the database and graph them locally on the Pi. This will allow temperature monitoring without an internet connection.

I am interested in learning more about the Arduino platform, so perhaps in the future I might create a version of my temperature sensing system for Arduino. I would also like to experiment with wireless sensors. I've also got in mind to buy a new Raspberry Pi B+ and turn it into a network music player, connected to my hi-fi. I've just ordered little rubber feet for the rack mount graphic equalizer I have paired with a "standard" domestic hi-fi amplifier, and am currently playing music from my laptop to the hi-fi. The next step is to offload music playing duties to a Pi!

Monday, 29 September 2014

How to Disable Samba Printing

I wrote the following paragraphs as part of a larger blog post I am writing about setting up Samba printing. After I wrote it I realised that it did not make sense to include it in a blog post about setting up Samba printing, so I have instead made it a separate blog post.

If no printing support is specifically enabled Samba will default to trying to use CUPS to access your local printers. If you do not have CUPS installed then this will fail, although it will also cause Samba to generate errors in its log (in the file /var/log/samba/log.smbd on Debian):

[2014/09/24 13:17:51.792288,  0] printing/print_cups.c:110(cups_connect)
  Unable to connect to CUPS server localhost:631 - Connection refused
[2014/09/24 13:17:51.792631,  0] printing/print_cups.c:487(cups_async_callback)
  failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL

Unfortunately Samba does not take 'no' for an answer and will keep attempting to contact CUPS on the local machine. Each time it does so it logs the above errors to its log file, making looking for real errors in the log file more difficult. The way to disable Samba printing is to add the following two lines to the[global] section of the smb.conf file:

printing = bsd
printcap name = /dev/null

This tells Samba to try to use the bsd printing system (lpr) and that it should look for the list of printers at the file /dev/null. The file /dev/null is a special file that is completely empty. So when Samba looks for a printer list and sees an empty list it disables its printing support. There does not seem to be a cleaner way to disable Samba printing. Using these settings ensures that not only is Samba printing disabled, but also that it will not log errors because it cannot find CUPS. It also means you can have CUPS installed and allow printing via CUPS, but prevent Samba from accessing the printers.

Tuesday, 23 September 2014

Samba on the Raspberry Pi - Interoperating with Windows

In my previous blog post Samba on the Raspberry Pi - sharing files with Windows PCs I explained some basic steps to getting Samba file sharing working on the Raspberry Pi. When I created that blog post I was having trouble getting my Pi's to show up in the browse list on my Windows machines. I have since managed to solve this problem.

Normally in Windows when you browse to "Network" in Windows Explorer you can see all of the computers on your network - the PC you are using along with any other Windows machines currently running. Samba servers should also show up here. Here is a screen shot to illustrate what I mean:

Browsing the network on a Windows 7 machine
You can see that my system has found 3 computers on the network - GRISSOM (the laptop that Windows is running on), RASPBERRYPI and RASPI2. In order to get the two Raspberry Pi's to show up on the browse list I had to do two things. Firstly, I needed to ensure that the workgroup name on the Pi's was the same as the workgroup set on my laptop. This is easy to do, since both Windows 7 and Samba default to using the workgroup name WORKGROUP. Secondly, I needed to force one of my Pi's to be the master browser for the local subnet, and also the master browser for the workgroup as well. Here are the settings I added to the [global] section of the /etc/samba/smb.conf file to achieve this:

workgroup = WORKGROUP
domain master = yes
local master = yes
preferred master = yes

Don't be put off by one of the settings being called domain master - my Samba server is still running in workgroup mode (i.e. I don't have a domain controller). When running in workgroup mode this setting tells the Samba server to become master browser for the workgroup, and to collate browse lists across subnets (actually across broadcast domains). Since my network only consists of a single subnet this setting may not be needed. The local master setting tells Samba to try to become the master browser for the entire local subnet, including any other workgroups/domains that may be present. The preferred master setting effectively forces this server to become browse master for this workgroup by giving it an advantage over other servers trying to become the browse master.

Without these settings my two Raspberry Pi's did not show up on the browse list of any Windows machines on my network. I could still access them, but having them show up in the browse list makes things a bit easier.

If you are still having trouble getting your Samba servers to show up in the browse list of your Windows machines check that the network settings on the Samba servers are the same as on the Windows machines. In particular make sure that all machines on your network have the same size of subnet configured. The easiest way to do this is to have all machines on your network set to use DHCP, and have them all use the same DHCP server. If you need to have specific machines keep the same IP address then set IP address reservations on the DHCP server.

Thursday, 11 September 2014

Why I will be voting for Scotland to return to being an independent country

As someone who was very much in the undecided camp until 2 weeks ago, the debate that has been going on in the media over the past few months has been an interesting one. I have long had doubts about Scotland continuing to be part of a political union with England, Wales and Northern Ireland, not because I particularly want Scotland to be separate, but because the government in Westminster, it seems to me, is entirely unsuitable for a modern country.

Since the Scottish parliament was reconstituted in 1997 the only reform made to how Westminster operates has been to stop the government of the day deciding the date of a general election. We still have a completely unelected House of Lords, a Privy Council which meets and makes decisions entirely in secret, and a House of Commons which has seen an expenses scandal and where MPs are about to awards themselves yet another inflation-busting pay rise.

But perhaps more importantly, the level of media scrutiny of our politicians at Westminster is rather lacking, in my view. In 2012 the Health and Social Care Act abolished the requirement for the Secretary of State to provide a comprehensive health service in England. In Scotland, this requirement is still in place. This requirement is surely the basis of our National Health Service. It is shocking enough that this piece of legislation passed at Westminster. What is, in my view, rather more serious is that none of the major media outlets pointed out this rather important fact. It was only on 31st August 2014 that a Glasgow-based publication, The Herald newspaper, brought this up. If we cannot rely on the UK press to keep our politicians honest, then this is surely another indicator that the Westminster-based democracy is fundamentally failing.

This lack of proper scrutiny by the UK press, combined with the fact that the unionist side has not attempted to put forward any positive arguments about why it is in our best interests to stay part of the UK, along with my general distrust of how Westminster operates, has convinced me that I should vote YES on 18th September 2014.

The NO campaign clearly decided early on to wage a negative campaign because they have bet on most voters playing it safe and opting for the status quo, rather than making a leap of faith and choosing a new path. I am normally quite a risk averse person so on the face of it I am well within their target demographic. Unfortunately for the NO camp, I also have a healthy disdain for cynical, negative campaigning. The yes campaign puts forward some powerful arguments about the type of Scotland we could build if we returned to being a separate nation. The creeping privatisation of public services in England is definitely something I want to avoid in Scotland. In fact, I would much prefer it had not begun in England either, but it has. So it seems to me that the only way to prevent Scotland succumbing to the same fate is to dissolve the current political union with the rest of the UK.

Scotland formed a political union with England 307 years ago because we were bankrupt. I see absolutely no reason why in 2014 why we need to be remain part of the UK. FUD (Fear, Uncertainty and Doubt) proffered by unionists is not a reason!

Monday, 1 September 2014

250+ pics of Forth Replacement Crossing

Just over a year ago I went for a walk over the Forth Road Bridge and took some photos of the Forth Replacement Crossing under construction. I also took lots of pics of the approach roads under construction on the north side. I wanted to do another bridge walk one year on to see close up how things were progressing. I ended up taking more than 250 photos of the works. Unfortunately the west walkway of the Forth Road Bridge is not open at the moment due to the preparations for the Forth Road Bridge 50th Birthday Party in 2 weeks time. Most of the pics are therefore of the approach roads. I also had a wander into South Queensferry and took a few pics there.

I have put most of the pics up on my Flickr photostream, and added captions and descriptions to them. Here are just a few:

South approach viaduct under construction
Forth Road Bridge viewed from viewing area at Bridge Control, South Queensferry
Forth Belle