Can you spot the drowning child?

Here’s a fun game you can play just before heading off on the family holiday. Spot the Drowning Child is a simple educational game written by Francisco Saldaña to help people recognise what is happening.

The Instinctive Drowning Response — so named by Francesco A. Pia, Ph.D., is what people do to avoid actual or perceived suffocation in the water. And it does not look like what most people expect. There is very little splashing, no waving, and no yelling or calls for help of any kind. To get an idea of just how quiet and undramatic from the surface drowning can be, consider this: It is the number two cause of accidental death in children, age 15 and under (just behind vehicle accidents) — of the approximately 750 children who will drown next year, about 375 of them will do so within 25 yards of a parent or other adult. In ten percent of those drownings, the adult will actually watch them do it, having no idea it is happening.

For the record, I did manage to spot the drowning child, but it took a lot longer than I expected, especially when you take into account that I was actively looking for the drowning child.

Via io9

Flattr this!

Backyard camping

What's wrong with this picture?

What’s wrong with this picture?

21st July is the Belgian National Day and a national holiday. As it falls on a Tuesday this year, many businesses stayed closed on Monday which makes for a four day weekend. And, for the second year running, the holiday weekend saw Macsen heading off for a week-long camp with the local youth group.

Sunday, therefore, was spent carefully following unnecessarily winding roads, followed by a beer and barbecue fuelled send-off for the kids. And, as we returned (along a much more sensible road), the twins announced that they, too, would like to go camping.

Fortunately, we have a tent and, while Monday was a bit miserable weather-wise, Tuesday was perfect camping weather.

The tent is still up and providing a handy bug-proof shelter for outdoor eating.

Flattr this!


Iron Sky: The Coming Race I really enjoyed Iron Sky. The film had some mixed reviews but the people behind it knew their audience and, for their audience, they delivered spectacularly. And now there’s a sequel on the way.

Iron Sky the Coming Race takes place 20 years after and takes our heroes from the first film into the Hollow Earth.

Twenty years after the events of Iron Sky, the former Nazi Moonbase has become the last refuge of mankind. Earth was devastated by a nuclear war, but buried deep under the wasteland lies a power that could save the last of humanity – or destroy it once and for all. The truth behind the creation of mankind will be revealed when an old enemy leads our heroes on an adventure into the Hollow Earth. To save humanity they must fight the Vril, an ancient shapeshifting reptilian race and their army of dinosaurs.

As with Iron Sky, The Coming Race will be inspired by pulp science fiction of the early 20th Century. They are promising crazy concepts and an incredible visual world of dinosaurs and aliens but, this time, with a focus more on adventure and discovery.

Imagine Iron Sky meeting Indiana Jones on a safari in Jurassic Park.

I’m sold. Here’s a trailer.

Flattr this!

Managing network drives in Powershell

It used to be, in Windows, that the way to map network drives was with the net use command, but with Powershell this has become a bit easier. I haven’t, however, been able to find a simple overview of the commands and their usage so hopefully this will be of use to someone other than me.

There are three commands (cmdlets in Powershell speak) that you need to know about.


This lists the currently mapped drives and a bit of information about them, most usefully the network path that the drive is mapped to. You can also enter the drive letter as a parameter so that

Get-PSDrive C

Tells you that drive C is mapped to the Windows C: drive. Obvious, really, but more useful if you want to know about other mapped drives.


This is the cmdlet that maps drives to to shared folders. If I want, for example, to map my Y drive to folder \sharedfiles on server Server the command would look like this:

New-PSDrive –Name “Y” –PSProvider FileSystem –Root “\\Server\sharedfiles” –Persist

The PSProvider switch tells Powershell what sort of data this drive is accessing. Filesystem, obviously, is the filesystem but you can also map to environment variables and other oddities.

The Root switch is needed so that Powershell understands the path name.

The Persist switch tells Powershell that this mapping is persistent so the mapped drive is available every time you reboot. This switch also causes Powershell to create a mapped network drive in Windows which can be accessed via all the standard Windows tools such as Windows Explorer.


When you no longer need the mapped drive, you can remove the mapping with this command.

Remove-PSDrive Y

Does exactly what you would expect.

Flattr this!

Using QShell and CL to work with Stream files in the IFS

It turns out that there is no simple way of generating a list of files currently residing in a folder on the IBM i IFS. Simple, in this case, would be a command like DSPLNK OUTPUT(*FILE). An API does exist, but a combination of not enough time and too much lazy proved to be quite a disincentive for me going down that route.

The issue was that we recieve a number of very big files and, to save a bit of bandwidth, these files were being zipped before being sent to the IBM i. Dropping the file into the IFS and unzipping it was easy enough but then I found myself with an archive folder containing one of more files. While I can set the name of the folder into which the files should be extracted, I have no way of determining beforehand what the file names will be.

Here’s a solution:

/* -------------------------------------------------------------------------- */
/* Program     : EXTRACTZIP                                                   */
/* Description : Retrieve and unpack a zipped archive                         */
/* Written by  : Paul Pritchard                                               */
/* Date        : 27/05/2015                                                   */
/* -------------------------------------------------------------------------- */
dcl &library *char 10 value('MYLIB')
dcl &fromfile *char 50
dcl &tombr *char 50 value('/qsys.lib/qtemp.lib/IMPORTP.file/IMPORTP.mbr')
dcl &dltfile *char 50

/* Retrieve and the zipped file and unzip it.                                 */
/* I won't bore you with the details here, but the the production program is  */
/* retriving the ZIP file from an FTP server and using PKZIP to unzip it.     */
/* The extract directory is /home/EXPATPAUL/EXTRACTFLR which now contains one */
/* or more stream files                                                       */

/* Retrieve a list of extracted files                                         */
/* First, I use QShell to list the files in EXTRACTFLR. The output of this is */
/* redirected to ExtractedFiles.TXT.                                          */
/* In order to use this information, I copy the ExtractedFiles.TXT stream     */
/* to an ad-hoc physical file (QTEMP/EXTRACTP)                                */
qsh cmd('ls /home/EXPATPAUL/EXTRACTFLR/ > /home/EXPATPAUL/ExtractedFiles.TXT')
crtpf file(QTEMP/EXTRACTP) rcdlen(20)
cpyfrmstmf fromstmf('/home/EXPATPAUL/ExtractedFiles.TXT') +
           tombr('/qsys.lib/qtemp.lib/EXTRACTP.file/EXTRACTP.mbr') +

/* And now I can use QTEMP/EXTRACTP to drive my way through EXTRACTFLR and    */
/* copy each of the files in the archive into the IMPORTP physical file.      */
dowhile '1'
    monmsg msgid(CPF0864) exec(LEAVE)

    /* Copy the next sream file from the archive                              */
    chgvar &fromfile value('/home/EXPATPAUL/EXTRACTFLR/' *tcat &EXTRACTP)
    cpyfrmstmf fromstmf(&fromfile) tombr(&tombr) mbropt(*add) +

    /* and then delete the stream file                                        */
    chgvar &dltfile value('rm /home/EXPATPAUL/EXTRACTFLR/' *tcat &EXTRACTP)
    qsh cmd(&dltfile)


/* Clean up and exit                                                          */    
qsh cmd('rm /home/EXPATPAUL/ExtractedFiles.TXT')
dltf qtemp/EXTRACTP


It should go without saying that some of the names have been changed and that the above program should be treated as a sample only.

Being able to move information between the QShell/IFS and traditional i5/OS environments is both useful and (in my experience) increasingly important. Although it does take a bit of thinking about, it isn’t difficult which is why I find that the oft-seen solution of “buy this tool” is both disappointing and (often) overkill.

Flattr this!

International Steamdays

Internationale Stoomdagen Turnhout 2014 St00mgroep Turnhout is an association, run by amateurs, devoted to the construction, maintenance, care, expansion, improvement and operation of a miniature railway for passengers, especially for 5″ and 7″ gauge. The association promotes interest in and construction of technical models of vehicles with any means of propulsion, and with a special emphasis on railway vehicles.

The weekend of May 23rd to 25th saw their 34th International Steam Meeting, and much fun it was, too.

Obviously, we went as non-participants (or regular members of the public), which meant that we could ride the trains and take in the sights of the event. I shall admit now that the photo at the top of this post was lifted from the event’s 2014 gallery. It isn’t easy to take a photo of a miniature railway when you are sitting on a miniature train.

But here are a few pictures I did take while wondering around the event.

The miniature trains run from the first Sunday of April until the last weekend of September, every Saturday, Sunday and holidays from 1:00pm to 6:00pm. I suspect we will return to the City Park before the summer is over.

Flattr this!

A European adult with a computer can be as smart as a Vietnamese Eight year old

I’m quite liking the puzzles coming out of Alex Bellos’s Adventures in Numberland. This week’s challenge: Can you do the maths puzzle for Vietnamese eight-year-olds that has stumped parents and teachers?

You have a simple arithmetic equation and you have to place the digits from one to 9 in the grid so that the result is 66. And I thought that sounded pretty easy – there are only 362880 possible combinations, I just need a trial and error method to work through the combinations until I find the right one.

Thank you Python.

Firstly, a function to yield all the possible permutations in a list

def yield_permutations(the_list):
    """ Yields all permutations for a list """
    length = len(the_list)
    if length <= 1:
        yield the_list
        for i in range(0, length):
            for j in yield_permutations(the_list[:i] + the_list[i+1:]):
                yield [the_list[i]] + j

And then I just need to plug the values into the formula

digits = []
for i in range(1, 10): 

for x in yield_permutations(digits):
    result = x[0] + 13 * x[1] / x[2] + x[3] + 12 * x[4] - x[5] - 11 + x[6] * x[7] / x[8] - 10
    print(x, result)
    if result == 66:

I’m sure there is a more elegant way of doing this, but after checking my result by hand, I can confirm that this approach also works.

Flattr this!

Einstein’s election riddle

Back before we were all online, I used to spend quite a lot of time doing logic puzzles. These are problems in which you have a series of groups, a series of statements and have to figure out which elements make up each group. So when Alex Bellos posted an election themed puzzle a few days before the big day, I couldn’t resist.

There are five houses with the outside walls painted in five different ways. David, Ed, Nick, Nicola and Nigel each live in one of the houses. They each drink a certain type of coffee, have a preferred mode of transport and keep a certain pet. No owners have the same pet, the same preferred mode of transport or drink the same type of coffee.

Who owns the fish?

You will need to click through to see the actual statements about who lives where, what they drink and how they travel.

It took me a couple of hours (spread over most of a day) but I solved it, and then I checked the published solution. What struck me as interesting is that, while my approach worked, it was not the same approach as the one Alex used. You can see the approach taken by Alex, along with the solution, by clicking here. The approach I took is as follows:

I started with a grid like this one (except the grid I used was hand drawn with a ruler and pencil).


The first two statements tell us that Nicola lives in the tartan house and Ed has a guinea pig. This also tells us that the owner of the guinea pig doesn’t live in the tartan house.


Statement three tells us that David drinks mochaccino. Which means that the mochaccino drinker does not live in the tartan house and does not own a guinea pig.


And so on and so forth. And once the grid is filled you have your answer.

The article repeats the claim that only two per cent of the population are smart enough to solve it. I don’t think this is a question of being smart.

With any sort of logic problem you need to have some method of systematically capturing what is true and what is not true. Evidently more than one such method exists, but once you have a working methodology, these problems are solvable for anyone.

So if it is true that only two percent of the population are able to solve the puzzle, this does not tell us how smart people are but, instead, indicates that far too many people lack the skills to process information methodologically.

Also, what the hell is mochaccino?

Flattr this!


After my last post, @mcnalu queried my assumption that a referendum on Britain’s membership of the EU would result in an exit:

@expatpaul the only point I wonder about is whether a referendum will result in exit. Polls suggest no, but do I believe them?

It’s a good question and it’s certainly true that a majority of people say they want to remain in the EU. However, the majority of British people also support either reducing the EU’s powers or leaving the institution altogether. NatCen sums this up quite nicely:

The majority of us are Eurosceptic – our latest British Social Attitudes survey found 62% of Brits support either leaving the EU or reducing its powers. And although an anti-EU stance is common where we might expect – among supporters of UKIP and the Conservative party, for example – it’s also gathering pace in unexpected places. As many as 43% of those who feel European now say they want the EU’s powers reduced.

As the table below shows, Euroscepticism has been simmering away since the mid to late nineties. Since 2012 however the feeling has increased, having peaked in 2012 at 67%. However, the problem isn’t that straightforward. While we’re highly Eurosceptic, when given a choice between staying in or leaving, a majority (57%) say they want to stay. So the picture is complicated and people’s views on this issue are highly nuanced and emotive. The next government will have to be both bold and sensitive to navigate this complex terrain.

So, 57% of the population want to stay in the EU and 62% are in favour of leaving the EU or reducing its powers. I am sure there are many ways to interpret this apparent contradiction, but to me, this suggests that support for Britain’s continued membership is spongy.

Most people recognise that, on balance, staying in the EU is beneficial but also recognise that there are plenty of problems with the institutions and would like to see them addressed. This is not an unreasonable position but, when every step involves hammering out an agreement among 27 heads of government, change is always going to be a slow and painful process.

By promising to complete his negotiations and then have a referendum in 2017, I think Cameron is – at the very least – running the risk of creating wildly unrealistic expectations. People will be disappointed and, even if they don’t swing into the anti-EU camp, if enough people are disappointed enough to not bother voting in the referendum, the result will be heavily skewed in favour of withdrawal.

Digressing for a moment, this YouGov political tracker (pdf) seems to bear this out. As of May 8-9, 45% of people would vote to stay in the EU and 36% would vote to leave. The detailed questions indicate that people do recognise the value of the EU and, if David Cameron actually managed to renegotiate terms to “protect British interests” the percentage of people saying they’d stay in rises to 58%. Unfortunately, YouGov don’t ask how people would vote if Cameron failed to renegotiate terms.

And back to my second point: turnout.

Britain doesn’t have a lot of experience with referenda so there aren’t a lot of data points available when it comes to predicting how many people are likely to vote. In fact, I would go so far as to say that the only data point we really have is the 2011 AV referendum, in which 42% of the electorate voted. I am ignoring the more recent Scottish Independence referendum for reasons that will, hopefully, become apparent as I continue.

The turnout for the 2014 European Parliament elections was 34%. The average turnout for 2012 local elections was even worse. As The Guardian notes:

Basically, Brits don’t vote in elections that aren’t general.

And low turnouts lead to the motivated minority having a disproportionate effect on the result.

While it’s true that pollsters will attempt to adjust for turnouts, the previously noted paucity of data points leaves me with very little faith in their ability to judge these adjustments accurately.

In summary, while a majority of UK voters support staying in the EU there is also a very strong desire to see the implementation of reform. By promising to have his negotiations completed in time for a 2017 referendum, David Cameron is, at minimum, running the risk of creating some horribly unrealistic expectations about what can be achieved and by when.

People are going to be disappointed and, with the EU not being a primary concern for many, these people are likely to stay at home when the referendum comes around. Consequently, the two groups that are likely to have the most influence are older voters (more likely to vote overall and more anti-EU than the average) and the vehemently anti-EU who are going to vote against no matter what.

Because of the way Cameron has approached this, support for staying in the EU is, in my view, likely to fall further and faster than the polls are currently able to indicate.

Of course, when the referendum comes around there will be a campaign to remain in the EU. In my view, this campaign needs to get its act together already. They need to be pointing out, and explaining why, Cameron has set himself up to fail. They need to be working across EU NGOs and political groupings to build a visible reform agenda with some realistic timelines attached.

Then, when 2017 comes around, they will be able to say “the idiot has thrown his tantrum, now this is what the grown-ups are going to do.”

Flattr this!

Random post-election musings

So that’s it then. The Scottish Nationalists won is Scotland, and the English Nationalists won in England.

This is not a good result.

From my (slightly detached) position, it does feel a lot like two elections were contested – one in Scotland and one in England and Wales – and they have returned very different results. Scotland has, in effect, voted against the London parties (Conservative, Labour and Liberal Democrat) leaving the SNP to mop up as the only remaining alternative. In England and Wales, on the other hand, the electorate appears to have taken leave of their collective senses and fallen, frankly divisive, rhetoric coming out of the Conservative campaign.

So, two elections, two results, and an overall majority for the Conservatives. The phrase “May you live in interesting times” purports to be a translation of a Chinese curse. While no actual Chinese source has actually been produced, I do think that the UK is about to go through some very interesting times indeed.

To start with the Conservatives, David Cameron is not a strong leader and the Conservative Party is not a one-nation party. Indeed, for a long time I have felt that the main problem with the Conservative party is that it counts very few actual conservatives among its members. Let me digress for a moment to justify that assertion…

It used to be that Conservatism in the UK was a change-resistant but essentially pragmatic philosophy, best summed up by this quote from Edmund Burke:

Parliament is not a congress of ambassadors from different and hostile interests; which interests each must maintain, as an agent and advocate, against other agents and advocates; but parliament is a deliberative assembly of one nation, with one interest, that of the whole; where, not local purposes, not local prejudices ought to guide, but the general good, resulting from the general reason of the whole. You choose a member indeed; but when you
have chosen him, he is not a member of Bristol, but he is a member of parliament.

Note the assumption that the great and the good will come together and agree what is best for the nation.

In the 1980s, the traditional/Burkian/one-nation Tories were marginalised as “wets” and steadily pushed out of the party, to be replaced by a harder, more ideologically Libertarian and more English cadre of MPs and members. In the 1950s, the Tories were winning slightly more votes than Labour in Scotland. In the 1960s, Labour were winning slightly more votes than the Tories in Scotland. In the 1970s, the Tory vote in Scotland dipped slightly and in the 1980s, the Tories decided that Scotland didn’t matter and let their share of the vote plummet.

And now, all (or nearly all) of the one-nation Tories are gone, and the party that has been elected is an economically ideological English nationalist party.

It may well be true that the English are an instinctively conservative nation. The problem is that the Conservatives are no longer an instinctively conservative party.

Digression over, let me try to get back to the point.

David Cameron has made a career of not really standing for anything and he gets away with this because he does have a good sense of what people want to hear and an unscrupulous willingness to say it. We saw this when he was campaigning for the leadership for the Conservative party – his commitment to leave the mainstream centre-right grouping in in the European Parliament was classic Cameronism. It was a purely tactical response to the fact that David Davis was – at that time – more popular among anti-EU Tories. It was also an entirely short-term response that led, in the longer term, to a more isolated Conservative party in the European Parliament and a more isolated Britain in the EU.

And now this man, who has spent the best part of a decade annoying other EU heads of government with his infantile behaviour, thinks that he can renegotiate some (vague, unspecified) parts of the UK’s EU treaties.

What is the French for “Go stuff yourself”?

I’d be laughing now if it wasn’t for the fact that Cameron has also promised to hold an in-out referendum on the basis of his fantasy negotiations.

I don’t think that Cameron is going to get anywhere when he attempts to renegotiate Britain’s membership of the EU. And, truth be told, I don’t think Cameron expects to achieve anything either. He was worried about both UKIP and his own right wing and has committed himself to a disastrous course of action in order to stave off a short term threat to his leadership. I don’t know whether he is still worried about UKIP – this was always a bubble that was bound to burst – but he now has nothing to shield himself from the hard-right, English nationalist elements in his own party.

Even if he did come back with a collection of concessions, nothing will be good enough for the anti-EU parts of his own party (which is most of them), and none of this will be good enough for the more rabid parts of the press (which, in circulation terms, is most of them). Then his much vaunted referendum comes around, and I think the result will probably prove to be quite predictable.

In short, Cameron’s weakness as a leader will open the way for his backbenchers to drive the UK out of the EU.

Flattr this!