Sep 162016
 

Mention the infamous haggis to most people, and naby will turn pale and need to steady themselves on any conveniently placed furniture at the thought of eating it. But why?

Those very same people will quite happily chomp through a plate of sausages without a thought.

One contains bits of an animal chopped up with a grain, and sealed within another part of an animal, and the other contains bits of an animal chopped up with a grain, and sealed within another part of an animal. Of course both sausages and haggises usually use artificial skins these days, but the point remains – a haggis is just a variation on a theme.

The key difference is the animal choice – haggis is based on sheep, and sausages are based on any animal that isn’t a sheep.

So you could say those people who are horrified by haggis are just anti-mutton, but that turns out not to be the case. Many of those horrified by haggis are quite happy chomping their way through a sheep.

2015-12-31-seagull in the light.p1

Sep 122016
 

The title of this post came from a tongue-in-cheek post on a forum I sometimes post on, and this post is not about the NHS nor it is even about socialism.

What it is really about is the over the top reaction you get when anything even tangentially related to socialism crops up anywhere someone from the US can see it. I’ve mentioned elsewhere that this is a variant on Godwin’s law whereby if someone accuses something of being socialist, they instantly win and condemn the “thing”.

To which I want to respond: grow up and think for yourself.

First of all, socialism is not the same as communism and in turn, communism is not the same as the kind of communism as practised by the Soviets. It is possible that communism inevitably leads to the kind of totalitarianism that the Soviets were so keen on, although there are those who disagree. But this is not about what sort of government you have.

It’s about how to run certain things. How do we pay for, and run certain services we have decided are essential such as :-

  • Health care (of individuals)
  • Public health (of society as a whole – vaccinations, sewage, water supply, etc.)
  • Police and justice system.
  • Defence

There are plenty of things that we have historically decided that should be paid for by the community as a whole, and be run by our government (in a very loose sense the community itself), including many of the items listed above. Even the most rabid anti-socialist is unlikely to start bleating about how the government is interfering with the private sector when talking about defence.

Yet suggest something new should be paid for by the community as a whole – such as the health care system – and Americans will start shouting “Socialism” and condemn the notion without looking at the merits.

By all means condemn a new community-funded notion if there are obvious problems with it, but to condemn it because it might be something suggested by a socialist government is ideologically-driven stupidity of the first order.

stack-of-coins-p1

Sep 082016
 

Freedom of information requests are a pretty cool feature of law that forces public bodies to disclose information on request if it is appropriate to do so. However it effectively only applies to public bodies which effectively excludes most charities and private companies.

Why?

The purpose of the FOI law is to catch out public bodies that are up to some sort of shenanigans – spending public money on first class junkets to Hawaii (or Italy if you’re on the American continent), diverting funds intended for hospital beds to some less worthy purpose, losing nuclear submarines, and all sorts of other nefarious activities that idiots with inadequate supervision can get up to.

This is all very well … indeed very useful, because the public should be able to obtain details from public bodies about what they get up to.

But what about other organisations?

In theory, private companies are supervised by the board, which in turn is supervised by the shareholders. In practice, shareholders are unlikely to be interested in the day to day operation of a company until that company starts losing money. So what happens when a company is up to something nasty, but is still making profits? Well there is always the hope that hard investigative journalism will expose the scandal.

Or you could change the law and make freedom of information requests apply to all organisations.

Because journalists can use FOI requests to delve into the secrets of public organisations to get an easy story, we are in danger of getting a skewed picture of the relative merits of public organisations versus private organisations. If scandals within the public sector are easy to expose, and scandals within the private sector are hard to expose, we will get more stories about scandals in the public sector.

Which may lead the naïve to believe that the public sector is more prone to nefarious behaviour than the private sector.

So in a way FOI requests applying to only the public sector is another way of demonising the public sector.

But ultimately the question is: do charities and private companies sometimes get up to activities that it is in the public interest to know? If the answer is yes, then of course FOI requests should apply to them.

stack-of-coins-p1

 

Sep 012016
 

Although I use graphical on-screen calculators for many calculations, it can sometimes be convenient to perform calculations at the command-line (or in shell scripts). In which case the old tool is expr :-

» expr 3 \* 9 
27

Very convenient; even though I can do such a calculation in my head there are circumstances where checking with a calculator is suitably cautious. You can of course perform calculations directly in the shell; if you are using a modern shell such as zsh or bash :-

» echo $((3 * 9))
27

Whilst convenient, such methods do have their disadvantages :-

  • The expr tool takes it’s expression after the shell has had it’s way with interpreting it – which is why I have escaped the “*” to multiply. You cannot put quotes around the expression either as expr assumes it to be a string.
  • These calculations are integer calculations, so you cannot find out what 77/4 is (19.25). Oops! Turns out that if you make one of the numbers in the expression a float, then the result is properly calculated: echo $((77.0/4) -> 19.25.
  • These calculators are limited to relatively small numbers – according to zsh, 2^63 is -9223372036854775808

If you need something a little more sophisticated then qalc (this is the command-line interface for Qalculate!) makes a pretty good command line calculator. It has to be installed with sudo apt-get install qalc and once installed it should be run interactively to get the initial configuration out of the way :-

» qalc
You need the download exchange rates to be able to convert between different currencies.
You can later get current exchange rates with the "exchange rates" command.
Do you want to fetch exchange rates now from the Internet (default yes)? yes
> quit

Once installed you can perform calculations in the same way as expr (although you can enclose an expression in quotes) :-

» qalc "3 * 9"
3 * 9 = 27
» qalc "2 ^ 72"
2^72 = approx. 4.7223665E21
» qalc "0xff"  
255 = 255
» qalc "86400s to hours"                                                                  
86400 * second = 24 h

You can add the “-t” option to prevent qalc telling you the expression it calculated; perhaps more useful in scripts than interactively.

damascus-unix-prompt

Sep 012016
 

One of the advantages that ZFS brings, is that it is so easy to create file systems, that you can create them for purposes that you would not previously do. For example, I have an additional file system mounted under my home directory for a certain application that generates a lot of data that I do not need backed up. Because the script I use to back up stuff does not cross file system boundaries (i.e. it does not descend into a directory that contains a mounted file system), I can simply exclude a large amount of frequently changing data by making a file system.

Or I might (as it happens I do not, but I could well do) create file systems for large lumps of data to easily see how much space they occupy – perhaps ~/Pictures. You can run a command like du -sh ~/Pictures, but that is an expensive command (it takes a while) and it tells you how large the files are; not how much space they occupy on disk. And on-disk compression can make that a significant difference! So simply run df -h ~/Pictures if that directory is on a separate file system.

But there is a bit of a gotcha with that. If you create such file systems in the normal way (such as zfs create pool/mikes-pictures; zfs set mountpoint=/home/mike/Pictures pool/mikes-pictures) you risk creating a situation that may prevent your home directory from mounting. If the “child” file system is mounted before the parent, it will not be possible for the parent file system to be mounted when booting.

Instead create the hierarchy properly :-

zfs create pool/h2
mkdir /h2
zfs set mountpoint=/h2 pool/h2
zfs create pool/h2/mike
zfs create pool/h2/mike/Pictures
ls /h2/mike/Pictures

You will also have to fix the permissions, but this is a far safer way of organising things suitable for future file system creation.

damascus-unix-prompt