Mac with Windows

I have been experimenting with the best way of having both Windows and MAC.  Linux is great for servers – but you dont need it for apps.  I’ve got Lion on a 27 Inch iMac.  So I loads up Oracle VirtualBox.  Its like VMWare except its free and its amazing.  So within maybe 1/2 hour I got Windows 7 running in a seamless mode – which means I really do have the best of both.  I need Mac for development and xcode – but I can also run the Windows sessions on Visual Studio – works like a charm. – you can get the Mac version here.  It’s really very easy to set up.

I am going to get a 4Gb upgrade for starters – I put Windows 64 bit on as well – so it makes sense to have a bit more.  But you can’t do two things at once so VB seems to allow you to reallocate.  I really like the seamless mode – just works together very nicely.



Arduino – Pond Filler Upper

I have this little pond see.  Its not terribly big and it looks quite nice – but it has a small leak somewhere.  And its driving me nuts. So in a moment of geekery I thought the problem could be solved with a bit of software and an Arduino board.  So I concocted a small plan to keep the pond topped up.  Nothing too complex – just used a water level sensor and a solenoid driven water valve.  I also used the excellent Ciseco relay for Arduino. Simple and elegant.  Some pics here of the installation.  It’s really just a prototype – if it works I’ll put a more rugged version together.

Parts List

  • Arduino Duemilove
  • Hose Solenoid ( This is one from Ebay ) Its 12v
  • Tank Sensor ( Again from Ebay )
  • Ciseco Relay 
  • Wires of various kinds
  • Project Box
  • Switches
  • LED
  • Resistors – 10k, 1k – switch controls
  • 12-9V Regulator – I used this with a Capacitor so I can drive everything off a 12v DV PSU
  • 12V DC PSU

This is the Sketch to control the board

The sketch is rather simple and a bit clumsy.  I used the timerone library.  It works by trying to detect if the water has been running for more than WATERTIMEOUT.  If it does it waits for WAITIME. If it does that more than SYSTEMJAMED times – then the system switches off.  This should protect it if the sensor jams open.  I reckoned 1 minute at my water pressure was enough to fix the leak.

Still got to check if the sensor bounces for a few seconds but so far it works quite well.

#include <TimerOne.h>

 *  Pond Relay
 *  August 2011 (c) Dave Robertson
 *	Arduino based pond relay with CISECO relay

#define SYSTEMJAMMED 10      // Number of times the system starts a wait look
#define WATERTIMEOUT 60    // Number of seconds to run the sensor
#define WAITTIME 60    // Number of seconds to wait until running again
// constants won't change. They're used here to
// set pin numbers:
const int sensorPin = 2;     // the water sensor switch
const int switch1Pin = 3;     // control switch 1 - Manual Override
const int switch2Pin = 5;     // control switch 2
const int ledPin =  13;      // the number of the LED pin ( ardunio diag only )
const int relayPin =  7;      // the number of the relay pin that controls the valve

long timerRunning;        // Number of seconds since we started
long waterrunningTimer = 0;
long waitingTimer=0;
const int ledStatus =  4;      // the number of the LED pin

int systemJammed=0;        // The system is jammed so switch it off
int overrideSystem=0;      // Override the system and shut off the valve regardless

int s1State = 0;         // variable for reading the pushbutton status
int s2State = 0;         // variable for reading the pushbutton status
int sensorState = 0;         // variable for reading the pushbutton status
int oldsensorState = 0;         // variable for reading the pushbutton status
int ledFlash =0;
int beginwait=0;    // Controls waiting for next

void setup()
  pinMode(10, OUTPUT);
  Timer1.initialize(1000000);         // initialize timer1, and set a 1/2 second period

  Timer1.attachInterrupt(callback);  // attaches callback() as a timer overflow interrupt

  pinMode(ledPin, OUTPUT);
    pinMode(ledStatus, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(switch1Pin, INPUT);
  pinMode(switch2Pin, INPUT);
  pinMode(sensorPin, INPUT);

  pinMode(relayPin, OUTPUT);

  digitalWrite(relayPin, HIGH);
    digitalWrite(relayPin, LOW);
  Serial.println("Starting Now 5 Second Delay");

  // Flash to indicate we starting up

  for (int i=0;i<100;i++)  {
        digitalWrite(ledStatus, digitalRead(ledStatus) ^ 1);
    Serial.println("Entering loop");

//  Timer call back here - update timers and LED for status
void callback()

  // Flash the led to show valve is on


  if (systemJammed>SYSTEMJAMMED) {

    Serial.println("System Jammed - all off");

    for(int i=0;i<10;i++) {
      digitalWrite(ledStatus, digitalRead(ledStatus) ^ 1);


//   if (ledFlash)
//      digitalWrite(ledStatus, LOW);
//   else
//      digitalWrite(ledStatus, HIGH);

    if (sensorState && !beginwait) {
       Serial.print("Water is running now for secs: ");


    timerRunning += 1;
    // We rest after 24 hours as this a fine time window for what we want
    if (timerRunning == 5184000) {
      timerRunning = 0;
      waterrunningTimer = 0;
      Serial.println("Time now");

    // Increment the waiting timer
    if (beginwait) {
      digitalWrite(ledStatus, digitalRead(ledStatus) ^ 1);

      Serial.println("Water ran too long - switched off waiting");

void loop()

  // Get the state of water sensor  and switches
  sensorState = digitalRead(sensorPin)^1;
  s1State = digitalRead(switch1Pin)^1;
  s2State = digitalRead(switch2Pin)^1;

  if (s2State == HIGH) {
   // System off - no action
    digitalWrite(ledPin, LOW);
    digitalWrite(relayPin, LOW);
    digitalWrite(ledStatus, LOW);
    oldsensorState = LOW;
    systemJammed=0;  // Reset jammed sensor counter

    else {
    //  Timer1.start();


  if (s1State == HIGH) {
    // Override sensors and reset everything
    if ( oldsensorState == LOW)
       waterrunningTimer = 0;
       oldsensorState = HIGH;
    //digitalWrite(ledStatus, LOW);
    digitalWrite(ledPin, HIGH);
    digitalWrite(relayPin, HIGH);
    digitalWrite(ledStatus, HIGH);

  if (systemJammed >  SYSTEMJAMMED)

  if (sensorState == LOW ) {  // Clear everything as water has filled
    // Sensor has read water filled
    digitalWrite(ledPin, LOW);
    digitalWrite(relayPin, LOW);
    digitalWrite(ledStatus, LOW);
    oldsensorState = LOW;
    systemJammed=0;  // Reset jammed sensor counter

  if (waterrunningTimer > WATERTIMEOUT ) {
      // Water has been running for over  a minute and the sensor is still high

    sensorState=LOW;    // Switch it off
    digitalWrite(ledPin, LOW);
    digitalWrite(relayPin, LOW);
    digitalWrite(ledStatus, LOW);

    oldsensorState = LOW;
    if (!beginwait) {
          Serial.println("Water running too long");


  if (beginwait && waitingTimer>WAITTIME){

    Serial.println("Timeout - switching off");


    // The sensor state read

  if (sensorState == HIGH ) {

    if ( oldsensorState == LOW)
       waterrunningTimer = 0;
       oldsensorState = HIGH;

    //digitalWrite(ledStatus, LOW);

    digitalWrite(ledPin, HIGH);
    digitalWrite(relayPin, HIGH);
    digitalWrite(ledStatus, HIGH);




Content Management Interoperability System.

Had a quick look at this for a client last week.  Managed to get it working with Documentum from .NET clients – a bit slow but it does work.

I used the DotNET client from openCMIS – Apache Chemistry.

DotCMIS is the best thing I found – although I really struggled to get web services working with Documemtum – so I used the AtomPub binding and the session factory.- that seemed to work reasonably well.







I must be mad – going back in a timewarp to my first job – programming on a DEC PDP 11/34

So anyway I needed to do a DCL script for openVMS – which is still alive apparently.  So using FreeAXP and openVMS – I managed to get a VMS session up again.

Why people think VMS is good in the world of Unix and Windows is beyond me.  Navigating around the filesystem is just plain confusing.  But I was able to boot it up and get it working – so all credit to those folks at FreeAXP – works fine for me.

SO I’m writing DCL again…

Maybe I’m in dreamland…









Arduino and LadyAda Wave Shield

I’ve been messing around with my fantastic Arduino board.  The whole Arduino thing is without question an Italian masterpiece of our generation.  I could spend 24 hours a day just messing with it.  The software side is as elegant as the hardware side – the idea you can add C++ and Java libs is stunningly brilliant.

Anyways – I wanted to do something with it – and I decided I wanted to build a simple SFX box for my little rock band.  We use sequencers and MIDI – but I wanted to do AC/DC’s For those about to rock.  The song has some nice cannon fire effects and this really has to be in the mix for a live performance.  So I thought that if the Arduino can be used.  I’ll be doing a more complex project later using Arduino to drive MIDI for live performance.

So I bought a kit for a the Wave Shield from AdaFruit – very very good business that – and sampled some effects.  I then put together a new app based on  the supplied player code on the AdaFruit site – hooked up a couple of footswitches on the Arduino and thats it – super fast special effects in WAV format – for the AC/DC song – some nice real cannon fires.  Hook it all up to the PA and boom.. nice.

This is the Arduino with a Wave Shield all hooked up in test

Footswitch found in dump… RS good quality – works well on stage

Buy the Arduino at RS Components and get the Wave Shield and info at  Get the footswitch at your local tip/dump/junkyard/scrapyard

Afternoon Tea – A Review

I’m not a theatre critic as you can probably tell but I do like the theatre. An so it was that I went to see a play in Manchester City centre on Saturday evening.

Afternoon Tea, a short play written by Lindsay Kernighan was performed at the Taurus Bar in Canal Street in Manchester. The basement of the bar had been transformed into a small 50 seater theatre – an intimate setting for  a uniquely intimate play.

On descending to the basement theatre – we were met with a tea room setting. Walking past the actors – you immediately had a sense of attention to detail that would make this short play interesting. As the actors nibbled on their cakes – my appetite for a good performance was whetted.

I was not disappointed. This was the last of 4 performances and it was clear that the actors and the director had established themselves and were comfortable in the setting and their roles. The writing was sharp and observational and at the same time had a touch of surrealism – like Father Ted without the priests – Mrs Doyle would not have been out of place serving her tea sandwiches and goading with a few go-ons

For me – the main thrust of the story was the young girl /old guy couple – struggling to find common ground and although the plot thread was clichéd to an extent – it was well performed and believable. The other couple – a two well heeled ladies of lunches who have a good old gossip – was nicely interwoven. I particularly liked the character of the “old guy” – William – whom having managed to catch himself a 25-years-younger female was aptly demonstrating that he was not satisfied by admiring himself having caught the eye of a presumably even younger checkout assistant in Tesco… You knew this would end with a soaking!

The performance of the ladies was engaging as it was funny. Clearly the actors were comfortable and the banter and the gestures led to a sharp and comical interpretation of the roles. “Making a dozen sweaters out of her mop” – nicely delivered.

The story was lightweigth – I didnt lose any sleep  – but it wasnt meant to change hearts – only make sure you’d enjoyed your visit.  I did.

The 35 minutes went by far too quickly and for me and the rest of the audience enjoyable. I’d go back again and I ended up staying in the bar for some food and some nicely poured Leffe Blond. As an evening – well it was memorable, enjoyable and I’d recommend them went they go back to the Buxton Fringe..

Webtop Browser Tree

In webtop or any WDK app if you see

This folder has more than 1000 objects, use doclist to browse to desired folder, then modify this thing:

wdk\strings\com\documentum\web\formext\control\docbase\ (version 6.5)

Adding text to Webtop delivered documents

I always thought that it would be pretty cool to use Webtop as a viewing tool directly – something that access a Docbase directly.  If you have umpteen million users – then caching is a good idea – but in a corporate environment where a few thousand users – well why not.

So I use Webtop as the delivery platform and the virtual link component.  I’m sure you could do this better – but this works fine.  The idea is that a user access a document using a virtual link – a straight HTTP link.  The document must be PDF – and when it comes out of the repository – its stamped with a small watermark.  This gives a better level of integrity – if you print it off for example then you’d know where it came from.  With everything being in Webtop it gives you a good opportunity to add in any Documenutm properties/values that may be appropriate for content.

You need iText – without doubt brilliant.

Add that as an external JAR to your Webtop Eclipse project.  I put the iText jar into the tomcat lib.

Create a custom package area in webtrop/custom/src/com/document/web/virtuallink – place this file in it.  That should recompile and replace the class file in the webtop app.  You could also do this by subclassing the whole thing – but it seemed easier to do it this way. 

All that happens is when the document eventually gets extracted from the repository – an iText function is called to create a new file – this is the one thats viewed.  Its all done in a local folder so everything gets deleted by Documentum – which is handy

Thats it – the watermark I’ve applied is a bit crap – but you can buy the iText book – details here and do your own thing… If you want.

You can also extend the view action – so that you can do same sort of thing with a view of a document.  Its a bit more involved – but extending webtop view action. 

Again I did this with full debug on Webtop – that works very well I have to say and using iText means that it works on ‘nix and Windows platforms…

Rails Standalone

My employer proxy just makes it difficult sometimes… So to install Ruby on Rails standalone

Do everything on until yu get to gem install rails

Then you need to download and install these packages from  

H:\Development\ruby>gem install rails
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
8 gems installed

Thats it- not much but if you get this post it might have a valuable 5 mins off your time to rails and that could make all the difference

Documentum Webtop on Eclipse with debug

ok, Documentum good, really good.  WDK very sophisticated, Webtop good web app for ECM and such stuff.  All good.  Except when it comes to writing apps.  Say you want to mod webtop – can you debug it live in an app server ?  Sure – well not so easy I found.   But here is what I did and it does work.

I am using Documenutm 6.5 with Eclispse 3.1 and tomcat 6 on Windows 2008 64 bit… yeah – 64.  Tried various combos with Tomcat 5.x but seems to have difficulty with 64 bit. 

Read this – works fine.  Very very good actually.  Good job and many thanks

Now you need to configure Eclispse to debug.  I used Run > Debug Configurations. 

Added a new server – Tomcat 6.

For the arguments, I copied in the once from the tomcat configure dialog

For the source, I added the webtop project

The run – it does run – pretty cool – you can now debug

One issue for 6.5 seems to be an error in a java source – About comparable types on ids.append.  You need to go back to the webtop project properties in Eclispse.  java build path – The on the order and export  of the libs tab – put the JRE System Library right at the top.  Dont mess with anything else.   The error went away immediately.  I think this is only on 6.5 related.

 Then you can do your usual.  If you want to mod a class – then do it in the custom/src area or decompile a class and do same. 

I was writing a bit of stuff to add a watermark stamp to a webtop PDF delivered doc on the fly.  So that when you view, you can see the time it was generated.  I did this for the virtual link handler by decompiling the virtual404handler – adding in a method after the object is pulled from the docbase and before its sent to the client. 

Did all this with debug – so its pretty handy.

Paul Warren is the definitive source for all things to do with this sort of stuff – pure genius – but lots of other very smart folks out there – many thanks for their posts on this as well