Friday, January 29, 2016

In the MoOde for streaming internet radio on the Raspberry Pi Zero (updated)


When I saw the announcement of the Raspberry Pi Zero my first thought was that it would be a good basis for a headless Internet Radio Streamer for my hifi system.

So when I got my Pi Zero, I looked around for a cost-effective Digital to Audio Converter and found Pimoroni's pHAT DAC for the Pi Zero.

After a bit of web searching and reading, I settled on Tim Curtis' MoOde as my Media Player.

I've updated the instructions which follow for Moode 2.6 TR1 and later.

So, I downloaded MoOde 2.6 TR1 and flashed it to a MicroSD card.

I had a spare TP-Link wifi USB stick which worked with the Pi, so to make that work I booted up MoOde with the TV and USB keyboard plugged in, and edited /etc/network/interfaces so it looked something like this:

auto lo
iface lo inet loopback
#allow-hotplug eth0
#iface eth0 inet dhcp lan0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid your-ssid
wpa-psk your-pre-shared-key

Change the ssid and PSK to suit your environment.

After a reboot, I could SSH into moode.local and had a web interface to play with.

For the pHAT DAC, I selected the hifiberry DAC as it uses the same chipset, and lo, I soon had internet radio streaming into my hifi.

But gosh, the low quality BBC radio streams sounded just awful.

A bit more web searching revealed the solution.

And so I installed minimserver and minimstreamer and access the Beeb's HLS streams via minimstreamer.

The process is:

1: install JDK 8.

    sudo apt-get install oracle-java8-jdk

2: download MinimServer-0.8.4-linux-armhf.tar.gz and MinimWatch-0.8.4-linux-armhf.tar.gz from the minimserver download page.

3: extract as follows:

    sudo tar zxvf MinimServer-0.8.4-linux-armhf.tar.gz -C /opt
sudo tar zxvf MinimWatch-0.8.4-linux-armhf.tar.gz -C /opt

4: configure minimserver and minimwatch

    sudo /opt/minimserver/bin/setup

change the settings to not run at startup, and do the same for minimwatch

5: configure minimserver's media directory and enable the minimstreamer module in minimserver:

    sudo /opt/minimserver/bin/startc
packages
install minimstreamer-0.5.24
exit

6: create a new file minimserver.service in /etc/systemd/system

    sudo nano /etc/systemd/system/minimserver.service
with the following contents

[Unit]
Description=MinimServer

[Service]
RemainAfterExit=true
ExecStart=/opt/minimserver/bin/startd
ExecStop=/opt/minimserver/bin/stopall

[Install]
WantedBy=network.target

7: Enable the newly created minimserver service

    sudo systemctl enable minimserver.service

8: Create a BBCRadio.m3u file in minimplayer's media directory with contents as per here

9: Reboot your Raspberry Pi

10: Add individual stations via Moode's interface using urls like http://127.0.0.1:9790/minimstreamer/*/R1/

And then enjoy the BBC's 320kbps HLS streams via your Pi Zero and pHAT DAC.

MoOde has excellent support over on the DIYAudio forum


Posted by Phil at 3:39 PM
Edited on: Monday, May 02, 2016 12:01 PM
Categories: Raspberry Pi

Sunday, January 18, 2015

H G Wells on Technological Unemployment


The concept of "Technological Unemployment" seems to be in fashion once again.

The sanest words I've read on the subject come from H. G. Wells in his 1914 work "The World Set Free":

He asked a passing stroller, and was told that the men had struck that day against the use of an atomic riveter that would have doubled the individual efficiency and halved the number of steel workers.
'Shouldn't wonder if they didn't get chucking bombs,' said Barnet's informant, hovered for a moment, and then went on his way to the Alhambra music hall.
Barnet became aware of an excitement in the newspaper kiosks at the corners of the square. Something very sensational had been flashed upon the transparencies. Forgetting for a moment his penniless condition, he made his way over a bridge to buy a paper, for in those days the papers, which were printed upon thin sheets of metallic foil, were sold at determinate points by specially licensed purveyors. Half over, he stopped short at a change in the traffic below; and was astonished to see that the police signals were restricting vehicles to the half roadway. When presently he got within sight of the transparencies that had replaced the placards of Victorian times, he read of the Great March of the Unemployed that was already in progress through the West End, and so without expenditure he was able to understand what was coming.
He watched, and his book describes this procession which the police had considered it unwise to prevent and which had been spontaneously organised in imitation of the Unemployed Processions of earlier times. He had expected a mob but there was a kind of sullen discipline about the procession when at last it arrived. What seemed for a time an unending column of men marched wearily, marched with a kind of implacable futility, along the roadway underneath him. He was, he says, moved to join them, but instead he remained watching. They were a dingy, shabby, ineffective-looking multitude, for the most part incapable of any but obsolete and superseded types of labour. They bore a few banners with the time-honoured inscription: 'Work, not Charity,' but otherwise their ranks were unadorned.
They were not singing, they were not even talking, there was nothing truculent nor aggressive in their bearing, they had no definite objective they were just marching and showing themselves in the more prosperous parts of London. They were a sample of that great mass of unskilled cheap labour which the now still cheaper mechanical powers had superseded for evermore. They were being 'scrapped'—as horses had been 'scrapped.'
Barnet leant over the parapet watching them, his mind quickened by his own precarious condition. For a time, he says, he felt nothing but despair at the sight; what should be done, what could be done for this gathering surplus of humanity? They were so manifestly useless—and incapable—and pitiful.
What were they asking for?
They had been overtaken by unexpected things. Nobody had foreseen——
It flashed suddenly into his mind just what the multitudinous shambling enigma below meant. It was an appeal against the unexpected, an appeal to those others who, more fortunate, seemed wiser and more powerful, for something—for INTELLIGENCE. This mute mass, weary footed, rank following rank, protested its persuasion that some of these others must have foreseen these dislocations—that anyhow they ought to have foreseen—and arranged.
That was what this crowd of wreckage was feeling and seeking so dumbly to assert.
'Things came to me like the turning on of a light in a darkened room,' he says. 'These men were praying to their fellow creatures as once they prayed to God! The last thing that men will realise about anything is that it is inanimate. They had transferred their animation to mankind. They still believed there was intelligence somewhere, even if it was careless or malignant.... It had only to be aroused to be conscience-stricken, to be moved to exertion.... And I saw, too, that as yet THERE WAS NO SUCH INTELLIGENCE. The world waits for intelligence. That intelligence has still to be made, that will for good and order has still to be gathered together, out of scraps of impulse and wandering seeds of benevolence and whatever is fine and creative in our souls, into a common purpose. It's something still to come....'

Posted by Phil at 7:28 PM
Edited on: Sunday, January 18, 2015 7:41 PM
Categories: Comment

Wednesday, June 04, 2014

Deja Vu, Again


The Beeb's been at it again. Their finest journos have rehashed a press release from Premier Oil into yet another gushing news item about fossil fuels.

Just as in my "Here We Go Again" blog post from last June, there's no mention of climate change, not one word, apart from the "Climate" in the Department for Energy and (for) Climate Change's title.

Read it and weep.

Again.


Posted by Phil at 8:44 PM
Edited on: Wednesday, April 01, 2015 9:53 PM
Categories: Environment

Sunday, October 13, 2013

Domestic LED lighting is Cost-effective Right Now


Of late I've been looking in the lighting sections of supermarkets in search of usable LED replacements for compact fluorescent and incandescent lamps for normal room lighting, but to no avail.

Until yesterday, that is, when I stumbled across this little beauty in my local Aldi store.

This is a Medion MD14536 11W LED lamp (equivalent to 75W incandescent, 18W compact fluorescent), 1055 lumens, 2700K colour temperature, rated lifetime of 35000 hours. Their light output is around 100 lumens per watt. And all for a princely £9.99. The only drawback is that they are not dimmable.

An equivalent Philips 18W compact fluorescent with a 6000 hour lifetime sells for a fiver on Amazon and gives around 60 lumens per watt.

10W (60W incandescent, 810 lumens) and 5.5W (40W incandescent, 470 lumens) are also available.

My experience of modern CFLs is that they rarely last their rated lifetime. I'm lucky if they get to half of it in my residence. CFLs I purchased over a decade ago were much more reliable.

LED lighting at this price is cost-effective right now. A real bargain!

Postscript, October 14th

My local Asda now has 12W (60W incandescent, 810 lumens, 25000 hour rated lifetime) LED lamps for £16. Not such a bargain.


Posted by Phil at 8:45 PM
Edited on: Wednesday, April 01, 2015 9:20 PM
Categories: Comment, Environment

Friday, September 06, 2013

Scientific Illiteracy, Propaganda, or Both?


The Beeb are are being sloppy, ignorant, incompetent, or just plain malicious propaganda-spreaders once again.

A tweet by Greenpeace Nuclear @nukereaction alerted me this morning

Here it is:

 

Back in November, I commented on this nonsense:

 

The irony is that nuclear energy is the ultimate non-renewable, actually destroying matter.


Posted by Phil at 11:53 AM
Edited on: Wednesday, April 01, 2015 9:53 PM
Categories: Comment, Environment

Monday, June 03, 2013

Here we go Again


BBC Radio 4's just run a pro shale gas propaganda piece on behalf of UK firm IGas which says "there may be up to 170 trillion cubic feet of gas in the areas it is licensed to explore in northern England".

Up to.

And guess what, no mention of climate change, not one word, though it does appear twice in their web version of the article. In the title of the Dept for Energy and [for] Climate Change.

As I've mentioned several times before, the BBC seems to have a blind spot on the issue of fossil fuels and climate change.

Sigh.


Posted by Phil at 7:47 AM
Edited on: Wednesday, April 01, 2015 9:52 PM
Categories: Environment

Thursday, May 02, 2013

That Which Must Not be Mentioned, Episode 5,100,000


The Beeb reports that Royal Dutch Shell's profits are up.

As usual, no mention of the impacts of the consumption of fossil fuels on the climate.

Worse than that, BBC Radio 4's Today programme's coverage sounded like a worshipful paean to the company, praising the company's performance without any mention of the impacts of burning the stuff.


Posted by Phil at 8:02 AM
Edited on: Wednesday, April 01, 2015 9:54 PM
Categories: Comment, Environment

Monday, April 29, 2013

Migrating Nagios Configuration from Nagmin to Check_MK's WATO


When I first set up a Nagios server, many years ago, in the days of Nagios 1.x, the best configuration tool I could find was Fred Reimers' Nagmin. That has since turned into abandonware, but there is a fork, NagminV, under development.

I'd patched Nagmin to support Nagios 2.x and 3.x, and added a few fields to its database, but it was still buggy and quirky.

So, after I'd installed Mathias Kettner's Check_MK for its livestatus broker module for use with PNP4Nagios, I started investigating Check_MK's broader features.

What soon caught my eye was Check_MK's use of rulesets based on host tags. The temptation of editing text files (python scripts in disguise) was too great for me, so I started converting my Nagios service checks into Check_MK format.

These are very rough notes, proceed with caution. Back up everything first!!!

First thing to do was get Check_MK's agent on all our hosts.

Then, to list all of them in /etc/check_mk/main.mk:

# don't generate host config yet
# comment this out when Nagmin is decommissioned
generate_hostconf = False
all_hosts = [
host1,
host2,
]

Then I added the obvious tags, win, linux, etc, and created config files for legacy checks in /etc/check_mk/conf.d, until eventually all service checks were defined in Check_MK and not in Nagmin.

After each check was migrated to Check_MK, I'd run

check_mk -U
nagios -v /etc/nagios/nagios.cfg

The first command generates a new Nagios config in /etc/nagios/check_mk.d/check_mk_objects.cfg

The second validates the resulting config. Here I'd find duplicate definitions, reminding me to delete them from Nagmin.

So, after a while plodding away at this - in my case this meant over a year of coexistence - all that was left in Nagmin was hosts, host groups, contacts, contact groups, and timeperiods.

Time to abandon Nagmin and get serious.

Do not, under any circumstances, try to generate a Nagios config using Nagmin again. It will always fail!

Comment out the Command.cfg include in nagios.cfg

#cfg_file=/etc/nagios/Command.cfg

Try validating the nagios config again, with nagios -v. If it fails, you've forgotten to define some commands as legacy checks

Rinse, repeat until you've got it right.

Check the contents of /etc/nagios/Services.cfg - if it contains any service definitions, you've forgotten something.

Do the same with all the service-related .cfg files; if things fail, change your config to use Check_MK's default service templates.

Get your custom Time Periods into WATO - check_mk has a default, hidden timeperiod 24X7 (Nagmin's is 24x7, case matters), and comment out TimePeriods.cfg in nagios.cfg. Revalidate.

And so on till you're left only with hosts, host groups, contacts, and contact groups from the original Nagmin.

So now was the time to take the leap and use Check_MK's WATO to configure nagios.

I created contacts and contact groups manually in WATO. There's no conflict with your existing Nagios config until you associate a contact group with hosts and/or services in WATO. That was the last thing I did.

Now comes the fun bit.

We need to import our hosts into WATO.

Run the attached hosts.py which will generate a list of hosts in the format hostname;alias;parents;ipaddress

python hosts.py >wato.csv

Our import script requires a file containing

wato folder;hostname;alias;parents;ipaddress;tags

where tags is a list of check_mk tags separated by |

So, we'll have to manually edit it. I didn't use WATO folders so just preceded each line with a ;

Tags are the fun bits. By now you may have been using them in your check_mk config. WATO comes with some predefined ones, which we need to list in our import file (wato.csv).

You'll need one each of the 'agent', 'criticality', and 'networking' tags. As well as your custom tags, which should also be entered into WATO.

Download and edit my_wato_import.py adding your tag definitions into tagz, run:

python my_wato_import.py wato.csv

and watch the output scroll by. If there are any errors reported, then you've forgotten to add a tag definition to tagz, or misspelt a tag in wato.csv. Rinse and repeat until all's well.

Set testing = False near the top of the script, and run again.

Comment out generate_hostconf = False in your main.mk, and check_mk -U

Comment out Host.cfg in /etc/nagios/nagios.cfg

Validate your nagios configuration. It should be OK.

A look in WATO will show all your hosts, with appropriate tags.

Hidden away in /usr/share/doc/check_mk/treasures is a script wato_host_svc_groups.py

I ran this against my original Nagmin Hosts.cfg file, which produced output which was easily massaged into the form needed for WATO. I could have amended the script to produce output of the following form, but a few regular-expression search and replaces got me there quickly enough.

host_groups = [
( 'group1', []. ['server1', 'server2']),
( 'group2', []. ['server3', 'server3']),
]

Place that code into /etc/check_mk/conf.d/wato/rules.mk and create the host groups (with descriptions) in WATO. Before applying changes in WATO, run check_mk -U

Comment out the Hostgroup.cfg include in nagios.cfg, and validate config once more.

#cfg_file=/etc/nagios/HostGroup.cfg

Now, if you've done everything properly, the Nagios config validation will succeed, and on a restart of Nagios your host groups will be there as before.

That just leaves Contacts, Contact Groups and notifications.

I'll leave that as an exercise for the reader. Hint: don't try any of the above until you've figured out how to apply contact groups to hosts and services.

And you'll also need to adjust host and service check intervals and retries in WATO too, otherwise everything gets polled every minute, which probably isn't what you want.


Posted by Phil at 9:59 PM
Edited on: Wednesday, April 01, 2015 9:24 PM
Categories: IT, Software

Tuesday, March 26, 2013

No More Covering Up Errors, Government Told


By our own correspondent:

The Government will have a legal duty to be honest about mistakes as part of an overhaul of the system in the wake of the umpteenth scandal.

The move is part of a package of measures in England to put citizens at the heart of government, ministers said.

Propaganda Secretary Hegemony Junta said the response on Tuesday marked the start of a "fundamental change to the system".

"We cannot merely tinker around the edges - we need a radical overhaul with high quality care and compassion at its heart."

He said he wanted to create a culture of "zero harm" through the changes.

Key to this will be the new post of chief inspector of MPs - and the statutory duty of MPs to be honest about mistakes, known as a duty of candour.

But the government said it would wait before deciding whether to make individual MPs criminally accountable for hiding mistakes as it was concerned about creating a "culture of fear".

On training for MPs, ministers said there would be a pilot programme whereby MPs will have to work for up to a year as healthcare assistants before getting parliamentary expenses.

Meanwhile, cabinet ministers who fail in their jobs will be barred from holding such positions in the future.

Oh, how I wish!

The above wishful thinking is inspired by this news story.


Posted by Phil at 7:46 PM
Edited on: Tuesday, March 26, 2013 7:56 PM
Categories: Comment

Saturday, February 23, 2013

It's Time to Bury the "Two Degrees Celsius Temperature Rise is Safe" Meme


The journal Science has just published a paper by Anton Vaks, O. S. Gutareva, S. F. M. Breitenbach, E. Avirmed, A. J. Mason, A. L. Thomas, A. V. Osinzev, A. M. Kononov, and G. M. Henderson about historical periods of Siberian permafrost melt, entitled Speleothems Reveal 500,000-Year History of Siberian Permafrost.

Unfortunately it's behind a paywall (grumble, grumble), but the abstract and reports give us enough information to be very concerned. From the paper's abstract:

Growth at that time indicates that global climates only slightly warmer than today are sufficient to thaw significant regions of permafrost

Siberian permafrost thaw warning sparked by cave data, reports the Beeb, who mention temperatures 1.5ºC above the present, without qualifying 'the present'. Such lack of rigour is a godsend to the climate change deniers, who doubtless will be equally sloppy. But read on.

Scientific American elaborates:

The details of the study reveal that conditions were warm enough even in Siberia for these mineral deposits to form roughly 400,000 years ago, when the global average temperature was 1.5 degrees Celsius higher than present. It also suggests that there was no permafrost in the Lena River region at that time, because enough water seeped into the northernmost cave to enable roughly eight centimeters of growth in the formations.

That was, in fact, the last time the formations in the Ledyanaya Lenskaya Cave grew, although other caves further south showed multiple periods of growth coinciding with other warmer periods. "That boundary area of continuous permafrost starts to degrade when the mean global temperature is 1.5 degrees C higher than present," Vaks explains. "Such a warming is a threshold after which continuous permafrost zone starts to be vulnerable to global warming."

Since Vaks's present is the "preindustrial late Holocene," that means the planet is already more than halfway there, having experienced 0.8 degree C warming to date. Such a thaw is no small matter, given that permafrost covers nearly a quarter of the land in the Northern Hemisphere and holds roughly 1,700 gigatonnes of carbon—or roughly twice as much carbon as is currently trapping heat in the atmosphere. Much of that carbon would end up in the atmosphere if the permafrost was to thaw further.

...

"The potential impact of these results extends to global policy: these results indicate the potential release of large amounts of carbon from thawed permafrost even if we attain the 2 degree [C] warming target under negotiation," says Kevin Schaefer, a scientist at the U.S. National Snow and Ice Data Center, who has also studied permafrost but was not involved in this, in his words, "great science" effort. "Permafrost thaws slowly and the carbon will be released into the atmosphere over two to three centuries."

Read that again. An average global temperature rise of 1.5ºC above pre-industrial levels would be enough to cause significant permafrost melt.

Time to stop talking that "2ºC rise is safe" nonsense, a myth I debunked over six years ago.

Postscript, March 22nd, 2013

Dr Chris Shaw, aka @kalahar1, has an interesting post today on Talking Climate, "Time to ask the public: Why 2 degrees?"

The most important determinants of the two degree limit are the social settings in which the deliberations are conducted. Under conditions of empirical uncertainty, such as those characterising climate change projections, institutional setting alongside social and political values come to play a determining role in defining what is considered ‘true’.

Achieving group uniformity becomes an increasingly important determinant of decision making the greater the level of uncertainty. The groups that have defined the two degree dangerous limit are powerful political and technical actors. The idea of a limit has been defined according to the interests of those groups making the decisions.

What does climate change look like if the available information is interpreted by the values of citizens? The purpose of such an exercise would not be to agree a new ‘dangerous’ limit. Rather, it would be to allow publics to better understand the decision making process and see how uncertainty - rather than offering a reason for doing nothing - actually shows that there is not a single dangerous limit, the avoidance of which means safety from harmful climate impacts.

Postscript, December 2nd, 2013

Also read this summary from David Spratt - Is climate change already dangerous (5): Climate safety and an unavoidably radical future (and the rest of the series).

And today's hot story: 2C rise will be a disaster say leading scientists

Postscript, October 1st, 2014

Controversy erupted today when David Victor and Charles Kennel, writing in Nature, suggested that we should ditch the 2°C warming goal.

Climate Controversy: Does the 2 Degree Goal Need to Go? asks Stephanie Pappas at Livescience.

Limiting global warming to 2°C – why Victor and Kennel are wrong argues Stephan Rahmstorf over at RealClimate.

Victor and Kennel: re-arrange the deckchairs, says William M. Connolley.

I hadn't seen this one before, but it's worth a read: Defining dangerous anthropogenic interference. A handy background by Dr Michael E. Mann to the whole two degrees thing.

Joe Romm nails it in 2°C Or Not 2°C: Why We Must Not Ditch Scientific Reality In Climate Policy.

My own view, for what it's worth, is that it's hard to avoid the conclusion that 2°C is way too high, and that 1°C is the better, more cautious target.


Posted by Phil at 3:47 PM
Edited on: Wednesday, April 01, 2015 9:55 PM
Categories: Comment, Environment

October 2017
Mon Tue Wed Thu Fri Sat Sun
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Syndicate this site
Archives
January 2016
January 2015
June 2014
October 2013
September 2013
June 2013
May 2013
April 2013
March 2013
February 2013
December 2012
November 2012
June 2012
May 2012
March 2012
January 2012
December 2011
November 2011
September 2011
May 2011
April 2011
March 2011
January 2011
December 2010
October 2010
September 2010
August 2010
May 2010
April 2010
December 2009
October 2009
September 2009
June 2009
May 2009
April 2009
February 2009
January 2009
December 2008
November 2008
October 2008
July 2008
June 2008
May 2008
April 2008
March 2008
January 2008
December 2007
November 2007
July 2007
June 2007
May 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
April 2006
February 2006
January 2006
December 2005
November 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
January 2005
December 2004
November 2004
September 2004
August 2004
July 2004
May 2004
April 2004
February 2004
August 2003
January 2003
December 2002

Archive Index
Categories
Comment
Computer Security
Doctor Who
Environment
IT
Music
Photos
Poetry
Raspberry Pi
Software
Tsunami
Waffle
Weird
Credits
Design by Movablestyle
Twitter Updates
Tweets by @philrandal
Powered by
Thingamablog 1.5.1