Saturday, 14 March 2015


We have four sheep. They are pets and they all have names. They don't actually know they are pets, nor do they know their names, but they are safe from being eaten, even though we do eat other sheep. At some level they seem to know that.

I grew up on a dairy/sheep farm and I never took much notice of the sheep. They were just woolly blobs that roamed the hills. My father spend a lot of time in early spring 'going around the sheep' which meant checking if they were in difficultly giving birth. In my early childhood one or two abandoned lambs were brought home for us kids to bottle feed. My sister raised a black lamb which was very tame, for her anyway, even when it was grown up.

Our current sheep all arrived as adults at various ages, though one of them was barely grown. With just four we get to observe them closely and they have distinct personalities. They are actually quite clever or, at least, they are good at what they do ie being sheep.

For example at this time of year they really, really like to spend time in the orchard. There is fruit on the trees which they mostly can't reach (this is the reason we don't keep llamas) but they can watch for when it falls. We go up there once a day or so and they mill about knowing we will toss them some crab apples. Crab apples seem to be the best thing in the whole world, they lick their lips as they run up to us. At other times of the year they are easy to move to the other paddock, but when the crab apples are there they are quite reluctant.

Except today. Today we're expecting a cyclone and the other paddock has more shelter. This morning there wasn't any wind to speak of but we had the weather forecast. So we went out to argue with the sheep who would not want to leave the crab apples. But they did. They'd felt the weather, well we could feel the drop in air pressure too, and they wanted to move.

When they want to move it is just a matter of opening the two gates and they run from one to the other. They know the drill, they're good at this.

But, like I said, they are all different. One time I was explaining to visitors who was who, I can recognise them from any angle and I noticed some skepticism. They were thinking 'they're just sheep, they're all the same.' But really they aren't.

The oldest (we think) is Limpy. He's a wether, a castrated male. and he still knows he's the boy, he's in charge. He's quite brave in his way. There's a little yappy dog next door who sometimes runs across our paddock. It's harmless, but it is a dog, therefore a wolf. The girls all flock up, Limpy places himself between them and the wolf, and stands his ground. It's his job. He's not at all scared of me either. One time I was in the forest near the fence to their paddock and I kind of burst out of the trees. Limpy was right by the fence on the other side and I gave him a start. He gave me a pained look as if to say 'thought it was something dangerous but it was just you.' One time I was trying to block his way (we'd got into some rare confusion when shifting them to the other paddock) and he just put his head down and pushed past me. He can be a bit of a bully with the others. He will push them away from any fruit we throw them if he can, but he usually doesn't bother because there's plenty.

Next is NDF (for No Distinguishing Features). Well we couldn't see anything different about her back when we were naming them. In fact she's a romney where the others are perendales, it means she's a bit bigger (she gets any low hanging fruit) and broader in the face. She is inclined to stand and stare at us with an astonished look on her face which makes us think she's not too bright. She is also the most nervous of the four. She does love crab apples though and we see her screwing up her courage to come up close to where we're throwing them. If it's not crab apples we have to throw whatever it is a little further for her.

The smartest of the four is Curious. She's the one who gets ideas. Sheep tend to follow each other but it takes one of them to think 'let's go over here' and the others to follow. That's usually Curious. She likes to eat the grass right at the fence line possibly because no one has peed on it ever. Also she's likely to be the one calling out to us when she sees us in the garden. She only does that in crab apple season, except one or twice when we've had unexpected visitors, so she's a sort of watch-sheep too. Not a very good one though. She's fairly tame but she won't take apples from our hands, only from the ground. Given that she sees the others doing it I have to conclude that she doesn't want to.

She is also inclined to sleep very soundly. One time we were moving them we thought she was dead. She was lying there in a heap and the others all ran through the gate when we opened it. We called her, clapped our hands and got no reaction. So we finished moving the others and went back, we expected, to bury her. As I approached her she suddenly jumped up, looked alarmed she was by herself and ran off after the others. I wonder if being smarter means her brain is wired a bit differently and it changes the way she sleeps. But I don't know.

The youngest, though several years old now, is Lambkin. She was definitely a pet when she was tiny, probably bottle fed by some kids, and she's the tamest. During crab apple season she is rubbing around our legs almost like a cat, nibbling our trousers and generally looking very excited. She never wants to be patted but she's friendly enough. And she really enjoys life. She tends to toss her head when she runs and sometimes she does what we call her happy dance. I still haven't caught this on video yet but imagine a kind of bounding gait where all four feet leave the ground as she prances about. It is hilarious and it is obvious she is doing it for sheer joy. Lately she's got Curious doing it too.

The happy dance turns up after a good feed of crab apples or when she's moved to fresh pasture. But it isn't inevitable, she does it about four times a year, the rest of the time she just seems normally cheerful.

We get to observe them every day because we have a small property and very few sheep. Most farmers I know think of their sheep as stupid because they get in a panic whenever the farmer does anything with them. But those farmers bring dogs to help (they have to with that many sheep) and the sheep don't know them anyway. The thing is we do eat sheep, and they know it. We'd be in a panic if we were in a room with a tiger, even one that didn't seem hungry right now. Ours seem to know they're safe from us. Fairly safe anyway. They'll run if I chase them (once a year I need to catch each one to administer tick medicine and they run away then). But no way do they panic when they see us.

But when we have visitors they don't behave the same way. They don't know the visitors, they tend to flock up and look nervous. They're good at being sheep.

Monday, 23 February 2015

Installing Oracle XE on Linux

This is about getting Oracle XE running on a Linux laptop, specifically my laptop. running Xubuntu, a variation on Ubuntu, but not the kind of variation that would mess up a database. Back in  2009 I was comfortable with Oracle XE, fairly comfortable anyway. But it seems installing Oracle on Linux has moved on to something much, much harder. I did get it working, though it took a lot of swearing.

First take a look at this, then assume you're taking the third way, ie use Docker. You will need to install Docker if you haven't already.
I did try the first option (twice actually) and it failed the same way both times, near the end (I think) with no diagnostics.

The details of the Docker image you use are here:
It is a 300MB download, and it is trivial to start. I did not have any success with the apex stuff though. It kept asking me for the same password over and over. But that is likely an Oracle thing rather than a Docker thing. I didn't need apex, though. All I wanted to do was get a database running and import a known good backup to it.

With the docker image you already have the first part, all that remains is the import.

First, copy your dump to somewhere you can map easily, I used /tmp.
Now you need to modify your docker run command to look like this:

sudo docker run -d -p 49160:22 \

-p 49161:1521 -p 49162:8080 \
-v /tmp:/tmp alexeiled/docker-oracle-xe-11g

That makes docker map the tmp file on your host system as tmp on your docker image.

sudo ssh root@localhost -p 49160
(password admin)
--you're logged into root on the docker image.
cp /tmp/*.dmp /u01/app/oracle/admin/XE/dpdump/
chmod o+rw /u01/app/oracle/admin/XE/dpdump/*.dmp

next start sqlplus and do the following:

sqlplus system/oracle
create user platinum identified by mypassword;
create tablespace PLATINUM_DATA DATAFILE 'tbs_f2.dbf' SIZE 10M online;
alter database datafile 'tbs_f2.dbf' autoextend on maxsize unlimited;

The dump user is platinum and the dump has a tablespace of platinum_data. The only way I know to find this out is to try it before creating the tablespace, note the errors and then create what you need.

impdp system/oracle dumpfile=D16-platinum-previous.dmp logfile=impschema.log full=y

There are dozens of more complex variations of the impdp command but that seems to be all you really need. Your dmp file will be different to mine, of course.

Finally you should change the system password or it will expire:

sqlplus system/oracle

(change the password to something other than oracle 'cos it will expire)

And that is all you need.

But I have to add that I really dislike doing anything with Oracle. To do anything they expect you to have a depth of knowledge that a DBA ought to have, not a software developer. Lots of options, lots of complications which I'm sure makes everything run very fast, but if you can't get it running at all (and I gave up on this more than once) then it is no use.

In the end the import was not too hard but it took me half a day to wade through the complexities and rat holes some simple documentation would fix. The actual install remains appalling, so I'm thankful for Docker.

My next task is cleaning up the debris left over from the failed installs....

But one more thing. If you restart your Docker image all the data will be gone, including the changed password. This might be a good thing in some cases but I wanted it to remember my import. For that I needed to make a new Docker image from the running one. It is quite simple. Follow the instructions under 'commit' on this page.

Sunday, 30 November 2014


I finally did it. After putting up with years of sniggers and snide remarks from every time she runs a defrag or an anti-virus checkon her ageing Windows XP machine (I didn't need to say ageing there, I guess) Mrs finally succumbed and moved to Linux.

The trigger was that I upgraded my machine, which was just as ancient but I'd been running Ubuntu on it for years, more lately I've been running Xubuntu, which is basically the same thing but with a different UI layer. It's lighter and suits the old machine a little better, plus I'm not a fan of the Unity interface on Ubuntu. My new machine would handle the extra load of Unity no problem, but I still prefer the Xubuntu UI. It is interesting that we get this choice with Linux.

So, with me sporting a newer, faster machine Mrs realised just how old and crappy her machine was getting. Little things like some of the keys playing up, the fact it tends to crash if we pull the power supply even though the battery is just fine, and so on.

But, of course, she knew if she went from XP to Win8, which is what the new machines come with, it would be all so different to get used to she might as well switch to some Linux variant. I got the machine about a week ago, installed Lubuntu (another variation of Ubuntu, but this one has an even lighter UI and it feels more like WinXP to make it easier).

When I do this I pop the hard drive and put a new one in. That way I can switch back in a moment if there are any warranty problems. I don't mess about with dual booting. If you're going to switch then switch, dammit. There were some minor issues with getting the machine to boot off the replacement drive, nothing much there. The job could have been done in a couple of hours all up but I needed to find a quiet point in her schedule to switch over.

That happened yesterday. She has one rarely used thing on VirtualBox running WinXP, another couple of things on Wine, both of them infequently used, and the rest is mostly LibreOffice, Firefox and Thunderbird. She's had one glitch in LibreOffice relating to the behaviour of quotes which took 5 minutes on Google to sort out.

Otherwise she's all good. And no more defrags and virus checks. The keys all work too, though there's a different keyboard to get used to.

Sunday, 5 October 2014

Secret Scripts: the antipattern

The Secret Script is something I've been aware of for a while and, although I'm fairly sure I didn't make it up, I can't find any reference to it on Google. So I'll need to explain what I mean rather than just supplying a link.

A Secret Script is some procedure, possibly manual or automatic that you have to know about to complete a software build. It isn't intended to be secret as such, in fact it is one of those things that everyone knows, except the new guy who can't get his build to run.

You can see how these things start, especially in a small team under pressure to deliver. Cut a quick ant script to create a directory and copy some files to it, hack the maven settings file, and make sure you set up that environment variable. Sure, now everything works, and it works every time, so we can forget about it.

If you are building open source projects, where you put the entire thing up in the cloud with the expectation that anyone in the world can pull it down and build it on their machine you cannot have secret scripts. Not ever. If I pull down an open source project and it doesn't build first time that's a signal to delete it and find something else. But closed source have more leeway here, especially if the team is small and information can be easily passed around.

Note that I am not referring to documented steps. You can have a couple of dozen manual steps in your ReadMe file and, as long as that forms part of the project, ie anyone pulling down the software gets the ReadMe file in an easy-to-find directory. Those steps aren't secret, they are easily discoverable.

I said closed source projects have more leeway but not very much more. Every new hire programmer needs to get past these secret scripts. You either have someone who knows sit with them to get them going, which is time consuming, or you leave them to figure it out for themselves, which is even more time consuming, not to mention discouraging for the new guy. There is always the danger than the people who know have forgotten they had to edit some config file two years ago anyway and will be just as baffled as the new guy as to why his build fails.

And with modern tools there should be no need for this. If you're a Java shop you are probably using maven or maybe ant. On a new machine anyone ought to be able to type mvn or ant on a command line and get a working build. If they can't the system is broken with secret scripts.

Secret scripts have a sort of mirror pattern which is, unfortunately, still an antipattern. I call these decoy scripts. A decoy script is a script or procedure that is right there in plain sight looking like it is important and useful, but which does not actually work and everyone but the new guy knows to ignore it. The new guy tries it out, finds it doesn't work, and tries to fix what is obviously a local problem. The certainty that everyone else has this script working will lead him to waste hours trying to fix what has to be a problem local to his machine.

Here are some examples of decoy scripts:
  • Out of date instructions in the ReadMe file.
  • Unit tests that don't pass (and aren't flagged as @Ignore)
  • old ant scripts that refer to invalid paths
These things are fairly easily avoided, and fixing them can save a lot of time.

Saturday, 4 October 2014

My trousers caught fire!

There's the proof. Trousers and socks ablaze. Fortunately I was wearing other trousers at the time.

This time of year we burn the piles of prunings and other tree trimmings we've accumulated since the start of winter (it is spring here in NZ). We'd started it with some paper in a cardboard box which I took to the back door afterwards to fetch some tools.

When the blaze was starting to die down we headed back and found the box was just ashes and my gardening trousers that lay beside them were alight. Obviously the box had been too near that fire. Easily fixed and no damage done, except to a very old pair of trousers.

Could have been worse though.

Wednesday, 1 October 2014

Domestic Dramas

We got back from hols and, as you do, turned on the espresso machine. Bang!
What? Turned it off then back on. Nothing. But not on either. Checked the fuse box. Yep, one of the cutouts has flipped. I took the back off the espresso machine and wiggled some wires, one of which looked a bit blackened. Ficked the cutout back on and tried again. Bang! There were visible sparks this time. Okay, that's not good.

I disconnected the espresso machine altogether, called a service shop and arranged to take it in there to get fixed. It's a wonderful machine, one of those Electras with a brass eagle on the top, and it does a good job, been doing it for nearly 20 years now.

Meanwhile I fetched the emergency backup espresso machine (yes, we do have an emergency espresso machine cos of a more minor problem 3 years ago) and set it up on the kitchen bench. Espressos followed.

Getting the main machine to the repair shop is a little tricky because it has a plumbed in water supply. I remember when we set this up and there's a shut off on the incoming pipe so the machine can be disconnected without getting water everywhere. It is hidden behind a panel in the bench below. I took off the panel, found the shut off and turned it off. Then I set to disconnecting the machine.
The moment I got the water supply line off the machine I got water sprayed in my face and pretty much everywhere. What? I shut off the water! I did! (this, among other things was what I was yelling to Mrs as I asked her to go shut off the mains).

That's complicated too. We gather water from our roof and store it in a tank, then a pump sends it to the house. The pump is smart, it detects the drop in pressure when we turn on a tap and cranks up to maintain it. So Mrs ran outside to the pump switch while I jammed my finger across the tube to stop it squirting. It seemed to take a long time.

Next step was to find out what was going on with the shut off that didn't. I got a wrench and took it off... and noticed water was still dribbling steadily from the pipe. Huh? We turned off the pump. The kitchen tap is still on and is not running, that proves it.

Except that this particular pipe end is lower than all the taps because it under the bench. That means it is below the top of the water tank, so there's some pressure even without the pump running. I need to turn off the tap on the tank. Leaving Mrs in charge of a bucket to catch the dribble I went out and struggled with the tap which hasn't been turned in at least 5 years and didn't feel inclined to now until I started hitting it. That sorted out the dribble. So we were no longer in danger of flooding the kitchen any more than it was already.
I had enough bits and pieces to contrive a bung in the pipe and then I could turn the water on again. It held okay. Whew.

That's enough excitement for now, but I am going to take a long hard look at that shut off that didn't before I put this back together.

Sunday, 14 September 2014

Setting up Drools Execution Server

The Drools Execution server (6.2.0-Beta2) has a demo video which looks good, but I needed to know how to set it up on my own machine.

It is not quite obvious how to do this (but this is beta code, so there is a good excuse for that). Still, I thought I'd document how I did it here to save others time.

I'm running Xubuntu 14.04 but the operating system is unlikely to be relevant. Translate as necessary to Windows or OSX path names.

First you need an application server. I'm using Wildfly 8 (used to be called JBoss). Get and unzip it into a directory we will call . You need to add a couple of user names before you start it up. Use the /bin/ script to add two users we'll call user1 and user2. Make user1 an admin user and user2 an application user. Leave the groups field empty for user1 and (confusingly) make the group of user2 'admin'.
For the question after groups enter 'no'.

Now you can start Wildfly using /bin/ and browse to and log in as user1.

Download the two war files you'll need.
Drools Workbench (this is the Wildfly-specific version)
Drools Execution Server

Edit: I see those two links have gone dead. Here is how to find the right files. Go to this link (it may take a while to load). Now find the JBoss Releases repository. In the lower panel find the org/kie/kie-drools-wb and org/kie/kie-server-services. Under each of those are various versions you can chose from. You want two war files with the same version, bearing in mind the workbench has a specific war file for the app server in each version.

Use the Wildfly Management to load and enable the two war files.
Edit: it is a good idea to shorten the names when you load the war files, that's the second  question during the Wildfly load, and it means your url will be shorter.

We're nearly done...

Log into this URL using user2

(or, if you shortened the name you might use

Okay, now you are in the demo. The ones in the video have some different files loaded but the ones you have now seem to work. You can certainly deploy them and you can certainly call them with a REST client.