Unknown's avatar

About Bruce Ryan

https://about.me/bruce.ryan

I just retook an old online test

When Mood Music
2012-04-30 10:13:00

LJ Friends Meme by coolerq

.embresponse {font-weight: bolder;}

• You must tell 96 people about this game.
Kate Bush is the one that you love.
Margaret Thatcher is one you like but can’t work out.
• You care most about Pete Lindsay.
Elly is the one who knows you very well.
Ian is your lucky star.
Comfortably Numb is the song that matches with Kate Bush.
Drugs for Everybody is the song for Margaret Thatcher.
The Gunner’s Dream is the song that tells you most about YOUR mind.
• and Knees up mother Brown is the song telling you how you feel about life
Take this quiz

Miles and miles and miles

When Mood Music
2012-04-29 19:27:00 pleased I’m the Least You Could Do – Bloodhound Gang

Raise your shields and don your anti-waffle devices (should that be ‘switch on your waffle-iron’?), reader, because here comes another batch of turgid Bruce-prose.

The main alternative activity to my sweating over programming coursework and to my hostess’ employment has been preparing for our summer holiday. We’ll cycle along the Danube from Passau to Vienna then spend a few days exploring bits of Vienna we’ve not yet seen. Both of us are uncertain whether we could currently cycle 40 miles each day for 5 successive days so we’ve been devoting Saturdays to training.

 

30 March: Edinburgh to Falkirk (32 miles)

Our first foray is chronicled here – nothing more to add.

 

7 April: Edinburgh to Stirling (37 miles)

My hostess found a a cycling app that draws route maps as you travel, so here’s this trip’s map.

I recall stops at Linlithgow and Larbert Cross. I remain impressed with my hostess cycling over 35 miles on a bike that’s not designed for distance.

 

14 April: to Broxburn and back (30 miles)

Here’s this trip’s map.

My hostess had wanted to revisit Uphall: there’s a slight but draining incline through Broxburn but it gets bad at Uphall. She also wanted to see if we could revisit the canal towpath without fear or incident. To achieve both in one trip, we did most (and the worst parts) of the Broxburn-Uphall torture incline, before turning north and finding even more challenging gradients.

A couple of miles along the canal convinced us it wasn’t fun: the path was by turns muddy and hence slippery, challenging even Che’s grip, and gravelly, threatening to do worse things to Lev’s wheels. So as soon as we could, we reverted to road: what a relief!

 

21 April: around Edinburgh (22 miles)

Here’s this trip’s map.

I was only 3 days away from needing to demonstrate and turn in my programming project so didn’t want to go too. My hostess expressed slight disappointment our route being relatively short. A year ago this distance, by her own admission, would have been very challenging. As happens so often, I’m impressed by her determination to improve and her stamina. As we cycled, she mused about getting a road bike or a faster, higher geared hybrid because she was dissatisfied with her speed. She loves Che – and he’s ideal for Edinburgh’s currently-abysmal road surfaces – but she feels the need for speed.

 

27 April: Bruce’s let-off-steam solo (28·5 miles)

I don’t have the app so this trip’s map is glommed from Google.

I may have mentioned that I’d agreed to help teach cycling skills to some P7 (11- to 12-year-old) students by one of my hostess’ friends. I’d been told that I would need to apply for ‘I’m not a kiddie-fiddler’ certification while the teaching was in progress. So this morning, after the second session, I took my documentation and completed form to the school office and received a strong ticking off for not having the certification in place.

While I understand the need for such things, I was made to feel as if I had done something dirty by even being near the children without this piece of paper. This soon became anger: if it had been the school who had asked me to help, told me the criteria and then changed their opinion, I’d have walked. However, I’d been asked by the parent organising these sessions – and she had been told an en-route application would be acceptable. So I’m not going to let her – or the children – down. I know I’m not evil (I admit I might be stupid – and have acted cruelly to some adults as a result – but that’s another matter) and I don’t think my hostess would have anything to do with me if I was harmful in the way so nearly alleged.

Anyway, utterly fuming, I decided to try to expiate my anger through my pedals. I also wanted to take Lev on a long spin to see if I could begin to learn to love him. He still seems to have friction, even though the brakes have been sorted. (Both wheels spin freely so maybe it’s me.) So I decided to head west and see where I got to. I left Servants’ Quarters at 1:18 knowing I’d need to be back around 5:30 to get ready to go to a social event that evening. My texts to let my hostess know where I was were as follows:

position distance time speed notes
Broxburn 10·5 miles 14:21 10 mph On cycle paths, I could get up to 28th gear and feel quite fast, as if friction wasn’t happening
Tesco depot near Livingston 4·7 miles 14:49 7·4 mph The road surfaces along this stretch of the A89 look smooth but aren’t. The coarseness does bad things to speed and my posterior suspension.
Bathgate station 2·7 miles 15:03 11·5 mph The station toilet is the most aromatic I’ve experienced in this country. Ugh!
enter East Lanarkshire 7·2 miles 15:52 8·8 mph What a relief to leave the dreariness of west West Lothian and enter the wild west. Honestly, the sky brightened and the buildings looked less run-down and threatening.
Caldercruix Station 3·4 miles 16:09 12·0 mph I could have pushed for Airdrie but I was beginning to get concerned about lack of time, trains and light. As it was, while I waited at Caldercruix the weather worsened.
overall 28·5 miles 2 hours 51 minutes 10·0 mph I’m not impressed with this average speed.

It was interesting that at some points, mostly on cycle paths, I didn’t feel the friction that seems to be Lev’s leitmotiv. At other points, I definitely did. The towns at the far west of West Lothian seem so dead. Their appearance wasn’t helped by the weather: cold dark and overcast. Yet as soon as I passed into East Lanarkshire, the sky brightened. There is a cycle path running along the railway but I’ve yet to see how to get onto it. Instead, I plodded along the A89 until I saw the sign for Caldercruix station. The remaining 4 miles to Airdrie would have taken another 20 minutes, so I could have got there within my self-imposed 3-hour limit – and if I’d realised I’d done under 30 miles I would have pushed on anyway.

Also, until today I’d been scared to take on the Newbridge roundabout. However there’s no need. It has traffic lights strictly controlling who has access, so it’s far safer than, for example, Gogar roundabout. using this means you don’t have to carry your bike over the awful stepped bridge at Ratho. No more of that nonsense ever!

 

28 April: Edinburgh to Spott (35 miles)

Here’s this trip’s map.

We had arranged to go and visit a friend who lives in Spott in East Lothian. This meant setting off into a biting east wind. Worse was to come. From just outside Musselburgh, the road (A199) slopes up inexorably until the centre of Tranent. There’s a fairly nasty spot where the gradient gets steep as the road crosses the A1. From Tranent to Haddinton the only obstacle was the wind but thereafter a long and grinding gradient and hailstorms forced us to stop slightly west of East Linton. Also, this section of the A199 was treated as an F1 track by everything that passed us. Surely the A1 is the local road for petrol-heads? Anyway, once the weather had abated slightly, we plodded on into Dunbar, convinced the station staff that we really were the people who’d booked the bike-spaces on the 18:41 train back to Edinburgh and turned south towards Spott. We’ve always feared that the road up to Spott would be fearsome. It’s not – we’ve been tricked by our friend’s drive which is. (Broken potholed concrete at crazy angles isn’t good for road bikes!). Thanks indeed to the inestimable Ms B for warmth, sustenance, tea and very pleasant company.

 

Conclusions

  • I can cycle 30 miles one day, then do it again the next day.
  • I need cycling gloves with are simultaneously
    1. warm
    2. waterproof
    3. good for wiping my nose en route.

    My current fleece gloves achieve 1 and 3 when dry, while my current waterproof gloves are cold.

  • I need to wear much thicker socks in inclement weather.
  • Lev will never be a speed demon. I think he’ll always be a sturdy plodder. At 7-8 mph, he can keep going without real effort by me. If I want speed, I’ll need to look into a lower-geared, lighter-framed racer (or speed-centric commuter if it’s to survive Edinburgh).
  • East Lothian road surfaces are quite good. They also have cycle paths where they are needed. Edinburgh council needs a time-machine to go back, not bother with the bloody trams (it breaks my heart to say this because I like trams) and invest the money in road-maintenance and cycle-paths. How much fitter would we all be?

Over and out – almost!

When Mood Music
2012-04-24 23:43:00 satisfied Finished Symphony – Hybrid

Well, the programming coursework is over apart from the shoutingmarking. We had to demonstrate our programs this afternoon and submit reports on how our programs worked, programming style and problems encountered.

Some of my classmates hadn’t done all of the set tasks or put in in all the required features, while others had non-working programs (e.g. not saving, creatures not moving), so I’m quite pleased that I had (as far as I can tell) done all that was required, the only bug being the Ogre’s intermittent inability to count his enemies when he’s recalled from disk.

On the other hand, one of my classmates had a graphical swamp, on which you could see the ogre and his enemies actually moving. Ah well, I’m pretty sure I’ve passed. My code is here and my report is here. Oh, and the actual problem/task is here.

I’m grateful that we had to write reports: while I was writing I was able to refine my code and improve the UI a lot. (I don’t claim my UI is good, just that it works and isn’t abysmal.)

All that’s left for this term is tomorrow’s web-enabled business wrap-up/feedback lecture. Then I’m free until September. I don’t intend to slob though: my plans include
• learning more about Swing and other Java graphical tools
• beginning to learn Objective C (iOS apps!)
• beginning to learn PHP
• some literature and real-life research into e-democracy
• if possible, learning to weld so I can start on my bike trailer
• lots of cycling and spinning

I’m also helping teach cycling skills to P7 children on Friday mornings for the next 6 weeks.

Do feel free to remind me how the road to hell is paved!

QuankAbcess

When Mood Music
2012-04-23 22:34:00 accomplished Songs Of Love Pt 2 – Roy Harper

For reasons that are too tedious to explain, occasionally I need to run an old version of the DTP application I loathe – hence the title of this post. It needs MacOS10·5, but Iggy runs 10·6 and 10·7.

I had 10·5 on my XServe but that’s horribly noisy when its working and now the power-supply seems to be dying, so he won’t stay alive long enough to finish booting most of the time. I had picked up an old TiBook which will run MacOS9, 10·4 and 10·5. This was OK but a little slow, and the screensharing image on Iggy was fuzzy.

I had read that VirtualBox won’t fly versions of MacOS earlier than 10·6 server or 10·7 client. I’m very pleased to say this in not true. Installation is a little tedious and not perfect – no VB guest additions, scary verbose boot but it can be done quite easily.

  1. Put your 10·5 installer disk in your host intel mac and start up VB.
  2. Create a blank virtual machine, telling VB you’re going to install MacOS Server.
  3. I’d suggest giving your new vm 4GB of RAM.
  4. Create a new HD – at least 20 GB. VDI format seems to work, so stick with it. The same goes for dynamic allocation.
  5. When you first run your new VM, there will be a very verbose and scary-looking startup. Stick with it!
  6. Eventually you will get to the traditional ‘select language’ first screen of MacOS install. Go through the process as normal until you are asked where to install OSX. There will be no available hard disks, even though you created one in step 4.
  7. At this point, choose DiskUtility from the installer menu. You’ll find that no partitions/volumes have been created on the HD you created. So use partition, remembering to set format as GUID in the options pane.
  8. Once the partitioning is done, close DU. This will take you back to the main installer, so install away!
  9. When the installation is finished, shut down your vm and eject the installer disk from your host mac. Otherwise you’ll just be taken through the installation process again.
  10. Reboot your new VM, sit through the verbose boot and lo and behold you’ll get to the normal personalisation screens as if you were installing MacOS on a real mac.
  11. You won’t be able to install VB guest additions, but you’re not left without being able to share stuff between host and guest. InVB, under the devices menu, set your vm to use a ‘bridged adaptor’. Then in the VM, under system prefs, set up sharing as normal. Then your host mac will be able to see the guest and the guest will be able to see the host.

You are stuck with 1024 by 768 screen area but there are speed advantages over the 1GHz TiBook I was using – a 10·5 system running at over 2·5 GHz. I’m very pleased!

 

Completely puzzling

 

When Mood Music
2012-04-21 04:42:00 frustrated Heroes – Roni Size/Reprazent

Having achieved non-trivial, working JUnit tests, I thought I could spend some time improving the UI/UX of my game. Several frustrating hours later, I’m not sure this was a good idea.

Poor UI/UX
The ‘working’ version first asks the user if s/he wants to restart a saved game, and warns him/her that if there isn’t one, a brand-new game will be started. This is presented as a bog-standard yes-no dialog.

On choosing ‘No’, i.e. the user is presented with the first representation of the swamp in a very plain dialog. The user’s only choice is to click ‘OK’ (or force-quit).

Clicking ‘OK’ forces the program to redraw the swamp after the ogre has moved and potentially been joined by an enemy. The user is offered the choice of seeing the creatures move again (by clicking ‘Yes’) or saving the game (by clicking ‘No’). Again. it’s a standard yes-no dialog.

Clicking ‘Yes’ here does make the creatures move as they should. Clicking ‘No’ refreshes the view of the game-state that will be saved. Here’ the user’s only choice is again to click ‘OK’. Doing so terminates the program quietly, cleanly and boringly!

Should the user initially have chosen to restore a saved game, the saved state is displayed, again in a plain dialog with just an ‘OK’ button. Clicking ‘OK’ brings up the yes-no-dialog where the user can carry on moving the creatures.

Road to nowhere
This seemed poor – I wanted to offer the user some kind of menu. It’s easy to create a dialog with text offering numbered choices and a space for the user to type his or her choice. It’s fairly easy to trap invalid numeric input and force the user to re-enter a choice. Alternatively, if the user enters a non-numeric choice, it’s possible to use exceptions to trap this. However, trying to account for users entering random strings of differently incorrect choices led me into a merry hell of nested do-while loops.

So nearly!
Then inspiration struck – while looking for ways of replacing the standard icons in Java dialog boxes, I’d seen a way to ‘doctor’ standard ‘yes-no-cancel’ dialogs with my own text. So I could do away with needing to trap poor user input by offering buttons for ‘I don’t want to play at all’, ‘play a brand-new game’ and ‘restore saved game’. Setting this up took a fairly short time, and so I set about testing whether my better-UI/UX game worked.

The brand-new game worked as it should. Saving and recalling seemed to work, so I set about doing more rigorous testing: starting a game, saving it, recalling it, saving it again, terminating the app, restarting the app, recalling the game…

Hmm – not quite right. In any recalled game, regardless of whether or not the app was terminated and restarted, the ogre intermittently ignores 1 or 2 immediate enemies. Sometimes 2 immediate enemies will kill him, as should happen. Sometimes he kills one of them. If there are three immediate enemies, he may kill one of them or two of them may kill him while the third is ignored. If there are four, the ogre is definitely killed.

Bah encore
So I thought I could go back to the early, ‘working’ version of the game which didn’t have this fault. WRONG! The fault is there – I’d just not tested thoroughly enough at the time! It appears my choice is not ‘working but poor UI’ or ‘intermittently faulty but better UI’. Instead, it’s ‘intermittently faulty but poor UI’ or ‘intermittently faulty but better UI’. So the choice is easier – big hairy wow.

I have to start writing up tomorrow to have time to create a decent report for the end of Tuesday. We also have to demonstrate our programs working on Tuesday afternoon. The lecturer has to see 20 programs and interview their creators in 2 hours. So there’s a chance he might not see the fault. (I’m not relying on this!) I’m wondering whether I should point out the fault and/or mention it in my report.

Weird

When Mood Music
2012-04-20 16:58:00 boggled Shuttin’ The Ole Dirt Down – Rev Hammer

Even though 1 + 1 ≠ 2, the following test passes. (swampSize is set elsewhere to be 4)

public void testDrawSwampMap() {
//Set up
Swamp s1 = new Swamp(swampSize);
String actualMap;
String expectedMap;

//Get value. The swampMap will vary every time the Swamp is created because
//an Ogre is added IN A RANDOM PLACE each time a Swamp is created.
//So remove the ogre, then draw the map.
s1.removeCreature(s1.ogreXcoord(), s1.ogreYcoord(), “OGRE”);
actualMap = s1.drawSwampMap();

expectedMap =
“(0,0): t(1,0): t(2,0): t(3,0): tnn” +
“(0,1): t(1,1): t(2,1): t(3,1): tnn” +
“(0,2): t(1,2): t(2,2): t(3,2): tnn” +
“(0,3): t(1,3): t(2,3): t(3,3): tnn”;

//Test
assertEquals(expectedMap, actualMap);
}

So “=” ≠ “equals”!

1 + 1 ≠ 2

When Mood Music
2012-04-20 16:05:00 annoyed, puzzled In The City – Razorlight

Following on from here, take a look at this code:

package _06Swampless_JUnitTests;

public class testString {

public static void main(String[] args) {
String piece1 = “donkeyOGREsnake”;
String piece2 = “donkeysnake”;
String piece3 = piece1.replace(“OGRE”, “”);
if (piece3 == piece2) {
System.out.println(“yeehah”);
}
System.out.println(“piece1: ” + piece1);
System.out.println(“piece2: ” + piece2);
System.out.println(“piece3: ” + piece3);
} //end main

} //end class

This sets up pieces of text which are identical except the first one has some extra characters, namely “OGRE” . A third piece is created as the first one minus “OGRE”. So the third piece should be the same as the second. The if block will print ‘yeehah’ if this is true and ‘boo hiss’ if they’re not.

The actual output is:
boohiss
piece1: donkeyOGREsnake
piece2: donkeysnake
piece3: donkeysnake

So two identical-looking pieces of text are in fact not identical. Bah!

Need drugs!

 

When Mood Music
2012-04-20 13:31:00 shattered Chinese Rock – The Ramones

I’ve just drunk my first coffee for over 2 years. 90 minutes of intensely watching 11-year-olds cycling – and trying to demonstrate and lead them towards good cycling habits – is utterly draining. And this was in a school play-ground. I’m not really looking forward to taking them out on the road.

Now I’m back to writing JUnit tests…

Testing my head

 

When Mood Music
2012-04-19 15:24:00 puzzled Fiji – K-series

Original thoughts
On the last of the JUnit tests, namely testing writeSwampToDisk(). This is called within the game if the user decides he or she is bored with watching creatures move around and try to kill each other.

The way I’d want to test it is to invoke a game and record the current state, e.g. the current value of Swamp() or drawSwampmap(). Then I’d save the game (which automatically closes it. Then I’d recall the game and compare the recalled state with the previously-noted saved state. If the two are the same, the read and write have succeeded.

The write method is within Swamp(), so that it can be called from Swamp()‘s basic routine. However, the read method is within a separate interface.

(The interface presents the user with a choice of new game or saved game.

  • If the user wants a new game, an new instance of Swamp() is kicked off.
  • If the user wants to recall a game from disk and a saved game exists, the interface’s read method is invoked.
  • [If there isn’t a saved game, the user gets a blocking for not reading the warning previously presented and a new game is started anyway.])

The read method can’t be in Swamp() because this would involve Swamp() trying to read itself. I’d like move the write method fromSwamp() to the interface (partly so I don’t have to write this test but mostly because that would seem neater) but the interface abdicates control to Swamp()‘s basic routine and then exits.

I guess the saved thing could be Swamp()‘s list of creatures, rather than Swamp() itself…… yes, that seems to work.

Some experimentation later
The test didn’t work when I compared lists of creatures. So to make it obvious, I’ve changed to comparing maps – purely textual output. While the two bits of text look identical, the test fails – implying they’re not!

Bah!

Destruction testing

 

When Mood Music
2012-04-18 14:37:00 puzzled Take a Breath (Live) – David Gilmour

Doggedly writing JUnit tests for my Swamp class.

Is there any point in writing a test for a method that randomly returns either ‘true’ or ‘false’? The only test I can think of is that the return value should b done of these values.

Also puzzled how I write a test for my method that draws a map of the Swamp and its Creatures. This will vary each time the game is run because an Ogre is placed in a random position each time the game is run, before the map is ever drawn.